Java 8: Make GerritConfig repeatable annotation
Change-Id: I6e823a5b2ecb960f87c7128342b811fa40e4d1ba
diff --git a/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/GerritConfig.java b/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/GerritConfig.java
index 4b956a2..4e40d92 100644
--- a/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/GerritConfig.java
+++ b/gerrit-acceptance-framework/src/test/java/com/google/gerrit/acceptance/GerritConfig.java
@@ -17,11 +17,13 @@
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Target({METHOD})
@Retention(RUNTIME)
+@Repeatable(GerritConfigs.class)
public @interface GerritConfig {
String name();
String value() default "";
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/UseGerritConfigAnnotationTest.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/UseGerritConfigAnnotationTest.java
index 2f50480..5773da4 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/UseGerritConfigAnnotationTest.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/UseGerritConfigAnnotationTest.java
@@ -35,10 +35,8 @@
}
@Test
- @GerritConfigs({
- @GerritConfig(name = "x.y", value = "z"),
- @GerritConfig(name = "a.b", value = "c")
- })
+ @GerritConfig(name = "x.y", value = "z")
+ @GerritConfig(name = "a.b", value = "c")
public void testMultiple() {
assertThat(serverConfig.getString("x", null, "y")).isEqualTo("z");
assertThat(serverConfig.getString("a", null, "b")).isEqualTo("c");
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/api/change/ChangeIT.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/api/change/ChangeIT.java
index 8af4098..265a17d 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/api/change/ChangeIT.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/api/change/ChangeIT.java
@@ -36,7 +36,6 @@
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.AcceptanceTestRequestScope;
import com.google.gerrit.acceptance.GerritConfig;
-import com.google.gerrit.acceptance.GerritConfigs;
import com.google.gerrit.acceptance.GitUtil;
import com.google.gerrit.acceptance.NoHttpd;
import com.google.gerrit.acceptance.PushOneCommit;
@@ -1699,10 +1698,8 @@
}
@Test
- @GerritConfigs({
- @GerritConfig(name = "gerrit.editGpgKeys", value = "true"),
- @GerritConfig(name = "receive.enableSignedPush", value = "true"),
- })
+ @GerritConfig(name = "gerrit.editGpgKeys", value = "true")
+ @GerritConfig(name = "receive.enableSignedPush", value = "true")
public void pushCertificates() throws Exception {
PushOneCommit.Result r1 = createChange();
PushOneCommit.Result r2 = amendChange(r1.getChangeId());
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/SuggestReviewersIT.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/SuggestReviewersIT.java
index 6b1907f5..184b174 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/SuggestReviewersIT.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/SuggestReviewersIT.java
@@ -19,7 +19,6 @@
import com.google.common.collect.Iterables;
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.GerritConfig;
-import com.google.gerrit.acceptance.GerritConfigs;
import com.google.gerrit.acceptance.Sandboxed;
import com.google.gerrit.acceptance.TestAccount;
import com.google.gerrit.common.data.GlobalCapability;
@@ -84,10 +83,8 @@
}
@Test
- @GerritConfigs(
- {@GerritConfig(name = "suggest.from", value = "1"),
- @GerritConfig(name = "accounts.visibility", value = "NONE")
- })
+ @GerritConfig(name = "suggest.from", value = "1")
+ @GerritConfig(name = "accounts.visibility", value = "NONE")
public void suggestReviewersNoResult2() throws Exception {
String changeId = createChange().getChangeId();
List<SuggestedReviewerInfo> reviewers =
@@ -227,10 +224,8 @@
}
@Test
- @GerritConfigs({
- @GerritConfig(name = "addreviewer.maxAllowed", value="2"),
- @GerritConfig(name = "addreviewer.maxWithoutConfirmation", value="1"),
- })
+ @GerritConfig(name = "addreviewer.maxAllowed", value="2")
+ @GerritConfig(name = "addreviewer.maxWithoutConfirmation", value="1")
public void suggestReviewersGroupSizeConsiderations() throws Exception {
AccountGroup largeGroup = group("large");
AccountGroup mediumGroup = group("medium");
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/config/ServerInfoIT.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/config/ServerInfoIT.java
index a252aeb..cac293c 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/config/ServerInfoIT.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/config/ServerInfoIT.java
@@ -19,7 +19,6 @@
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.GerritConfig;
-import com.google.gerrit.acceptance.GerritConfigs;
import com.google.gerrit.acceptance.NoHttpd;
import com.google.gerrit.extensions.client.AccountFieldName;
import com.google.gerrit.extensions.client.AuthType;
@@ -37,44 +36,42 @@
public class ServerInfoIT extends AbstractDaemonTest {
@Test
- @GerritConfigs({
- // auth
- @GerritConfig(name = "auth.type", value = "HTTP"),
- @GerritConfig(name = "auth.contributorAgreements", value = "true"),
- @GerritConfig(name = "auth.loginUrl", value = "https://example.com/login"),
- @GerritConfig(name = "auth.loginText", value = "LOGIN"),
- @GerritConfig(name = "auth.switchAccountUrl", value = "https://example.com/switch"),
+ // auth
+ @GerritConfig(name = "auth.type", value = "HTTP")
+ @GerritConfig(name = "auth.contributorAgreements", value = "true")
+ @GerritConfig(name = "auth.loginUrl", value = "https://example.com/login")
+ @GerritConfig(name = "auth.loginText", value = "LOGIN")
+ @GerritConfig(name = "auth.switchAccountUrl", value = "https://example.com/switch")
- // auth fields ignored when auth == HTTP
- @GerritConfig(name = "auth.registerUrl", value = "https://example.com/register"),
- @GerritConfig(name = "auth.registerText", value = "REGISTER"),
- @GerritConfig(name = "auth.editFullNameUrl", value = "https://example.com/editname"),
- @GerritConfig(name = "auth.httpPasswordUrl", value = "https://example.com/password"),
+ // auth fields ignored when auth == HTTP
+ @GerritConfig(name = "auth.registerUrl", value = "https://example.com/register")
+ @GerritConfig(name = "auth.registerText", value = "REGISTER")
+ @GerritConfig(name = "auth.editFullNameUrl", value = "https://example.com/editname")
+ @GerritConfig(name = "auth.httpPasswordUrl", value = "https://example.com/password")
- // change
- @GerritConfig(name = "change.allowDrafts", value = "false"),
- @GerritConfig(name = "change.largeChange", value = "300"),
- @GerritConfig(name = "change.replyTooltip", value = "Publish votes and draft comments"),
- @GerritConfig(name = "change.replyLabel", value = "Vote"),
- @GerritConfig(name = "change.updateDelay", value = "50s"),
+ // change
+ @GerritConfig(name = "change.allowDrafts", value = "false")
+ @GerritConfig(name = "change.largeChange", value = "300")
+ @GerritConfig(name = "change.replyTooltip", value = "Publish votes and draft comments")
+ @GerritConfig(name = "change.replyLabel", value = "Vote")
+ @GerritConfig(name = "change.updateDelay", value = "50s")
- // download
- @GerritConfig(name = "download.archive", values = {"tar",
- "tbz2", "tgz", "txz"}),
+ // download
+ @GerritConfig(name = "download.archive", values = {"tar",
+ "tbz2", "tgz", "txz"})
- // gerrit
- @GerritConfig(name = "gerrit.allProjects", value = "Root"),
- @GerritConfig(name = "gerrit.allUsers", value = "Users"),
- @GerritConfig(name = "gerrit.enableGwtUi", value = "true"),
- @GerritConfig(name = "gerrit.reportBugText", value = "REPORT BUG"),
- @GerritConfig(name = "gerrit.reportBugUrl", value = "https://example.com/report"),
+ // gerrit
+ @GerritConfig(name = "gerrit.allProjects", value = "Root")
+ @GerritConfig(name = "gerrit.allUsers", value = "Users")
+ @GerritConfig(name = "gerrit.enableGwtUi", value = "true")
+ @GerritConfig(name = "gerrit.reportBugText", value = "REPORT BUG")
+ @GerritConfig(name = "gerrit.reportBugUrl", value = "https://example.com/report")
- // suggest
- @GerritConfig(name = "suggest.from", value = "3"),
+ // suggest
+ @GerritConfig(name = "suggest.from", value = "3")
- // user
- @GerritConfig(name = "user.anonymousCoward", value = "Unnamed User"),
- })
+ // user
+ @GerritConfig(name = "user.anonymousCoward", value = "Unnamed User")
public void serverConfig() throws Exception {
ServerInfo i = gApi.config().server().getInfo();