Update to work in standalone mode - pull in required external dependencies not available via plugin api - specify the usage of OptionalSubject directly Change-Id: I4ad404eb0c8dbbb51bef7e59279974609accc478
diff --git a/.bazelversion b/.bazelversion index 7c69a55..f9da12e 100644 --- a/.bazelversion +++ b/.bazelversion
@@ -1 +1 @@ -3.7.0 +6.3.2 \ No newline at end of file
diff --git a/BUILD b/BUILD index 147b37f..2c4c06e 100644 --- a/BUILD +++ b/BUILD
@@ -16,6 +16,9 @@ "Gerrit-HttpModule: com.googlesource.gerrit.plugins.quota.HttpModule", ], resources = glob(["src/main/resources/**/*"]), + deps = [ + "@commons-lang3//jar" + ] ) junit_tests(
diff --git a/WORKSPACE b/WORKSPACE index a4f7efa..bb118ba 100644 --- a/WORKSPACE +++ b/WORKSPACE
@@ -12,6 +12,9 @@ "gerrit_api", ) +load(":external_plugin_deps.bzl", "external_plugin_deps") +external_plugin_deps() + # specify version with `-SNAPSHOT` prefix to pull from local repo # example: gerrit_api(version = "3.3.0-SNAPSHOT") gerrit_api()
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl new file mode 100644 index 0000000..196a715 --- /dev/null +++ b/external_plugin_deps.bzl
@@ -0,0 +1,8 @@ +load("//tools/bzl:maven_jar.bzl", "maven_jar") + +def external_plugin_deps(): + maven_jar( + name = "commons-lang3", + artifact = "org.apache.commons:commons-lang3:3.17.0", + sha1 = "b17d2136f0460dcc0d2016ceefca8723bdf4ee70", + )
diff --git a/src/test/java/com/googlesource/gerrit/plugins/quota/QuotaPluginIT.java b/src/test/java/com/googlesource/gerrit/plugins/quota/QuotaPluginIT.java index 3762cee..4322a39 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/quota/QuotaPluginIT.java +++ b/src/test/java/com/googlesource/gerrit/plugins/quota/QuotaPluginIT.java
@@ -24,6 +24,7 @@ import com.google.gerrit.extensions.api.groups.GroupApi; import com.google.gerrit.extensions.restapi.RestApiException; import com.google.gerrit.server.IdentifiedUser; +import com.google.gerrit.truth.OptionalSubject; import com.google.inject.Inject; import com.googlesource.gerrit.plugins.quota.AccountLimitsConfig.Type; import java.util.Optional; @@ -106,8 +107,8 @@ private void assertAdminUserHasNoLimitsOn(Type type) { AccountLimitsFinder accountLimitsFinder = getAccountLimitsFinder(); - assertThat(accountLimitsFinder.getRateLimit(type, "Administrators")).isEmpty(); - assertThat(accountLimitsFinder.firstMatching(type, userFactory.create(admin.id()))).isEmpty(); + OptionalSubject.assertThat(accountLimitsFinder.getRateLimit(type, "Administrators")).isEmpty(); + OptionalSubject.assertThat(accountLimitsFinder.firstMatching(type, userFactory.create(admin.id()))).isEmpty(); } private void asserUserLimitedOn( @@ -115,12 +116,12 @@ AccountLimitsFinder accountLimitsFinder = getAccountLimitsFinder(); Optional<AccountLimitsConfig.RateLimit> groupLimit = accountLimitsFinder.getRateLimit(limitType, groupName); - assertThat(groupLimit).isPresent(); + OptionalSubject.assertThat(groupLimit).isPresent(); assertRateLimits(groupLimit.get(), limitType, ratePerSecLimit, burstSecs); Optional<AccountLimitsConfig.RateLimit> rateLimit = accountLimitsFinder.firstMatching(limitType, userFactory.create(user.id())); - assertThat(rateLimit).isPresent(); + OptionalSubject.assertThat(rateLimit).isPresent(); assertRateLimitsAreEqual(rateLimit.get(), groupLimit.get()); }
diff --git a/tools/bzl/maven_jar.bzl b/tools/bzl/maven_jar.bzl new file mode 100644 index 0000000..cd065d7 --- /dev/null +++ b/tools/bzl/maven_jar.bzl
@@ -0,0 +1,3 @@ +load("@com_googlesource_gerrit_bazlets//tools:maven_jar.bzl", _maven_jar = "maven_jar") + +maven_jar = _maven_jar \ No newline at end of file