From 3450ddecdc3d877709ba0198c75c4a55f91514c7 Mon Sep 17 00:00:00 2001 From: Edwin Kempin Date: Fri, 23 Aug 2019 10:36:57 +0200 Subject: [PATCH] Set submitWholeTopic field in ServerInfo only if it is not false This is consistent with how the other boolean fields are treated. Also add tests for this field. Signed-off-by: Edwin Kempin Change-Id: Ib8afe7ec64a37f540ff59d73c7e6c4e9bc6d9aad --- Documentation/rest-api-config.txt | 2 +- .../gerrit/server/restapi/config/GetServerInfo.java | 2 +- .../gerrit/acceptance/rest/config/ServerInfoIT.java | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Documentation/rest-api-config.txt b/Documentation/rest-api-config.txt index e7571306a2..b58d22aaa3 100644 --- a/Documentation/rest-api-config.txt +++ b/Documentation/rest-api-config.txt @@ -1545,7 +1545,7 @@ button]. |`update_delay` || link:config-gerrit.html#change.updateDelay[How often in seconds the web interface should poll for updates to the currently open change]. -|`submit_whole_topic` || +|`submit_whole_topic` |not set if `false`| link:config-gerrit.html#change.submitWholeTopic[A configuration if the whole topic is submitted]. |`disable_private_changes` |not set if `false`| diff --git a/java/com/google/gerrit/server/restapi/config/GetServerInfo.java b/java/com/google/gerrit/server/restapi/config/GetServerInfo.java index 8b5a7462a0..a36e75c1c3 100644 --- a/java/com/google/gerrit/server/restapi/config/GetServerInfo.java +++ b/java/com/google/gerrit/server/restapi/config/GetServerInfo.java @@ -234,7 +234,7 @@ public class GetServerInfo implements RestReadView { + "\u2026"; info.updateDelay = (int) ConfigUtil.getTimeUnit(config, "change", null, "updateDelay", 300, TimeUnit.SECONDS); - info.submitWholeTopic = MergeSuperSet.wholeTopicEnabled(config); + info.submitWholeTopic = toBoolean(MergeSuperSet.wholeTopicEnabled(config)); info.excludeMergeableInChangeInfo = toBoolean(this.config.getBoolean("change", "api", "excludeMergeableInChangeInfo", false)); info.disablePrivateChanges = diff --git a/javatests/com/google/gerrit/acceptance/rest/config/ServerInfoIT.java b/javatests/com/google/gerrit/acceptance/rest/config/ServerInfoIT.java index 297a835d5d..1d87ca1af0 100644 --- a/javatests/com/google/gerrit/acceptance/rest/config/ServerInfoIT.java +++ b/javatests/com/google/gerrit/acceptance/rest/config/ServerInfoIT.java @@ -168,6 +168,7 @@ public class ServerInfoIT extends AbstractDaemonTest { assertThat(i.change.replyLabel).isEqualTo("Reply\u2026"); assertThat(i.change.updateDelay).isEqualTo(300); assertThat(i.change.disablePrivateChanges).isNull(); + assertThat(i.change.submitWholeTopic).isNull(); assertThat(i.change.excludeMergeableInChangeInfo).isNull(); // download @@ -192,6 +193,13 @@ public class ServerInfoIT extends AbstractDaemonTest { assertThat(i.user.anonymousCowardName).isEqualTo(AnonymousCowardNameProvider.DEFAULT); } + @Test + @GerritConfig(name = "change.submitWholeTopic", value = "true") + public void serverConfigWithSubmitWholeTopic() throws Exception { + ServerInfo i = gApi.config().server().getInfo(); + assertThat(i.change.submitWholeTopic).isTrue(); + } + @Test @GerritConfig(name = "change.api.excludeMergeableInChangeInfo", value = "true") public void serverConfigWithExcludeMergeableInChangeInfo() throws Exception {