GEODE-2818: Making "groups" a valid option when starting locators or servers and adding a comprehensive test to cover changes.
* this closes #598 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/92f26f17 Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/92f26f17 Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/92f26f17 Branch: refs/heads/feature/GEODE-3251 Commit: 92f26f176f2a6530d334eee2bb74fdda23ea6f8e Parents: 81c7014 Author: YehEmily <emilyyeh1...@gmail.com> Authored: Tue Jun 20 12:43:07 2017 -0700 Committer: Jinmei Liao <jil...@pivotal.io> Committed: Thu Jul 20 08:31:16 2017 -0700 ---------------------------------------------------------------------- .../geode/test/dunit/rules/gfsh/GfshRule.java | 2 +- .../tools/pulse/PulseSecurityWithSSLTest.java | 15 +- .../management/internal/cli/GfshParser.java | 13 +- .../cli/commands/LauncherLifecycleCommands.java | 53 +-- .../cli/GfshParserAutoCompletionTest.java | 16 +- .../internal/cli/OptionAliasesParsingTest.java | 344 +++++++++++++++++++ .../cli/commands/ExportLogsIntegrationTest.java | 3 +- .../internal/security/LogNoPasswordTest.java | 15 +- 8 files changed, 405 insertions(+), 56 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/geode/blob/92f26f17/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/gfsh/GfshRule.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/gfsh/GfshRule.java b/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/gfsh/GfshRule.java index fc6f376..23445bd 100644 --- a/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/gfsh/GfshRule.java +++ b/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/gfsh/GfshRule.java @@ -48,7 +48,7 @@ public class GfshRule extends ExternalResource { return execute(GfshScript.of(commands)); } - protected GfshExecution execute(GfshScript gfshScript) { + public GfshExecution execute(GfshScript gfshScript) { GfshExecution gfshExecution; try { File workingDir = temporaryFolder.newFolder(gfshScript.getName()); http://git-wip-us.apache.org/repos/asf/geode/blob/92f26f17/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java ---------------------------------------------------------------------- diff --git a/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java index 0bacd99..6c87204 100644 --- a/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java +++ b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java @@ -25,11 +25,9 @@ import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTOR import static org.apache.geode.util.test.TestUtil.getResourcePath; import static org.assertj.core.api.Assertions.assertThat; -import org.apache.geode.security.SecurableCommunicationChannels; -import org.apache.geode.security.SimpleTestSecurityManager; -import org.apache.geode.test.dunit.rules.HttpClientRule; -import org.apache.geode.test.dunit.rules.LocatorStarterRule; -import org.apache.geode.test.junit.categories.IntegrationTest; +import java.io.File; +import java.util.Properties; + import org.apache.http.HttpResponse; import org.junit.BeforeClass; import org.junit.ClassRule; @@ -37,8 +35,11 @@ import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; -import java.io.File; -import java.util.Properties; +import org.apache.geode.security.SecurableCommunicationChannels; +import org.apache.geode.security.SimpleTestSecurityManager; +import org.apache.geode.test.dunit.rules.HttpClientRule; +import org.apache.geode.test.dunit.rules.LocatorStarterRule; +import org.apache.geode.test.junit.categories.IntegrationTest; @Category(IntegrationTest.class) http://git-wip-us.apache.org/repos/asf/geode/blob/92f26f17/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParser.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParser.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParser.java index c31c50d..9cebc63 100755 --- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParser.java +++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParser.java @@ -14,6 +14,12 @@ */ package org.apache.geode.management.internal.cli; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + import org.apache.commons.lang.StringUtils; import org.springframework.shell.converters.ArrayConverter; import org.springframework.shell.core.CommandMarker; @@ -23,13 +29,6 @@ import org.springframework.shell.core.Parser; import org.springframework.shell.core.SimpleParser; import org.springframework.shell.event.ParseResult; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Properties; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** * Implementation of the {@link Parser} interface for GemFire SHell (gfsh) requirements. * http://git-wip-us.apache.org/repos/asf/geode/blob/92f26f17/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java index b325e18..b8904a9 100755 --- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java +++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java @@ -45,7 +45,31 @@ import static org.apache.geode.management.internal.cli.i18n.CliStrings.START_SER import static org.apache.geode.management.internal.cli.shell.MXBeanProvider.getDistributedSystemMXBean; import static org.apache.geode.management.internal.cli.util.HostUtils.getLocatorId; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.InetAddress; +import java.net.MalformedURLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.TimeUnit; + +import javax.management.MalformedObjectNameException; +import javax.net.ssl.SSLException; +import javax.net.ssl.SSLHandshakeException; + import org.apache.commons.lang.ArrayUtils; +import org.springframework.shell.core.annotation.CliCommand; +import org.springframework.shell.core.annotation.CliOption; + import org.apache.geode.SystemFailure; import org.apache.geode.cache.server.CacheServer; import org.apache.geode.distributed.AbstractLauncher; @@ -90,29 +114,6 @@ import org.apache.geode.management.internal.cli.util.ThreePhraseGenerator; import org.apache.geode.management.internal.configuration.utils.ClusterConfigurationStatusRetriever; import org.apache.geode.management.internal.security.ResourceConstants; import org.apache.geode.security.AuthenticationFailedException; -import org.springframework.shell.core.annotation.CliCommand; -import org.springframework.shell.core.annotation.CliOption; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.TimeUnit; -import javax.management.MalformedObjectNameException; -import javax.net.ssl.SSLException; -import javax.net.ssl.SSLHandshakeException; /** * The LauncherLifecycleCommands class encapsulates all GemFire launcher commands for GemFire tools @@ -168,7 +169,8 @@ public class LauncherLifecycleCommands implements GfshCommand { @CliOption(key = CliStrings.START_LOCATOR__FORCE, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = CliStrings.START_LOCATOR__FORCE__HELP) final Boolean force, - @CliOption(key = CliStrings.GROUP, optionContext = ConverterHint.MEMBERGROUP, + @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS}, + optionContext = ConverterHint.MEMBERGROUP, help = CliStrings.START_LOCATOR__GROUP__HELP) final String group, @CliOption(key = CliStrings.START_LOCATOR__HOSTNAME_FOR_CLIENTS, help = CliStrings.START_LOCATOR__HOSTNAME_FOR_CLIENTS__HELP) final String hostnameForClients, @@ -874,7 +876,8 @@ public class LauncherLifecycleCommands implements GfshCommand { @CliOption(key = CliStrings.START_SERVER__FORCE, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = CliStrings.START_SERVER__FORCE__HELP) final Boolean force, - @CliOption(key = CliStrings.GROUP, optionContext = ConverterHint.MEMBERGROUP, + @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS}, + optionContext = ConverterHint.MEMBERGROUP, help = CliStrings.START_SERVER__GROUP__HELP) final String group, @CliOption(key = CliStrings.START_SERVER__HOSTNAME__FOR__CLIENTS, help = CliStrings.START_SERVER__HOSTNAME__FOR__CLIENTS__HELP) final String hostNameForClients, http://git-wip-us.apache.org/repos/asf/geode/blob/92f26f17/geode-core/src/test/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionTest.java index 4069c06..aa76ecb 100644 --- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionTest.java +++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/GfshParserAutoCompletionTest.java @@ -122,7 +122,7 @@ public class GfshParserAutoCompletionTest { buffer = "start server --name=name1 --"; candidate = parser.complete(buffer); assertThat(candidate.getCursor()).isEqualTo(buffer.length() - 2); - assertThat(candidate.size()).isEqualTo(51); + assertThat(candidate.size()).isEqualTo(52); assertTrue(candidate.getCandidates().contains(new Completion("--properties-file"))); assertThat(candidate.getFirstCandidate()).isEqualTo(buffer + "J"); } @@ -132,7 +132,7 @@ public class GfshParserAutoCompletionTest { buffer = "start server --name=name1 "; candidate = parser.complete(buffer); assertThat(candidate.getCursor()).isEqualTo(buffer.length() - 1); - assertThat(candidate.size()).isEqualTo(51); + assertThat(candidate.size()).isEqualTo(52); assertTrue(candidate.getCandidates().contains(new Completion(" --properties-file"))); assertThat(candidate.getFirstCandidate()).isEqualTo(buffer + "--J"); } @@ -142,7 +142,7 @@ public class GfshParserAutoCompletionTest { buffer = "start server --name=name1"; candidate = parser.complete(buffer); assertThat(candidate.getCursor()).isEqualTo(buffer.length()); - assertThat(candidate.size()).isEqualTo(51); + assertThat(candidate.size()).isEqualTo(52); assertTrue(candidate.getCandidates().contains(new Completion(" --properties-file"))); assertThat(candidate.getFirstCandidate()).isEqualTo(buffer + " --J"); } @@ -167,7 +167,7 @@ public class GfshParserAutoCompletionTest { public void testCompleteWithDash() throws Exception { buffer = "start server --name=name1 --J=-Dfoo.bar --"; candidate = parser.complete(buffer); - assertThat(candidate.size()).isEqualTo(50); + assertThat(candidate.size()).isEqualTo(51); } @Test @@ -185,7 +185,7 @@ public class GfshParserAutoCompletionTest { buffer = "start server --name=name1 --J=-Dtest=test1 --J=-Dfoo=bar"; candidate = parser.complete(buffer); assertThat(candidate.getCursor()).isEqualTo(buffer.length()); - assertThat(candidate.size()).isEqualTo(50); + assertThat(candidate.size()).isEqualTo(51); assertThat(candidate.getFirstCandidate()).isEqualTo(buffer + " --assign-buckets"); } @@ -194,7 +194,7 @@ public class GfshParserAutoCompletionTest { buffer = "start server --J=-Dtest=test1 --J=-Dfoo=bar --name=name1"; candidate = parser.complete(buffer); assertThat(candidate.getCursor()).isEqualTo(buffer.length()); - assertThat(candidate.size()).isEqualTo(50); + assertThat(candidate.size()).isEqualTo(51); assertThat(candidate.getFirstCandidate()).isEqualTo(buffer + " --assign-buckets"); } @@ -203,7 +203,7 @@ public class GfshParserAutoCompletionTest { buffer = "start server --name=name1 --locators=localhost --J=-Dfoo=bar"; candidate = parser.complete(buffer); assertThat(candidate.getCursor()).isEqualTo(buffer.length()); - assertThat(candidate.size()).isEqualTo(49); + assertThat(candidate.size()).isEqualTo(50); assertThat(candidate.getFirstCandidate()).isEqualTo(buffer + " --assign-buckets"); } @@ -212,7 +212,7 @@ public class GfshParserAutoCompletionTest { buffer = "start server --name=name1 --locators=localhost --J=-Dfoo=bar --"; candidate = parser.complete(buffer); assertThat(candidate.getCursor()).isEqualTo(buffer.length() - 2); - assertThat(candidate.size()).isEqualTo(49); + assertThat(candidate.size()).isEqualTo(50); assertThat(candidate.getFirstCandidate()).isEqualTo(buffer + "assign-buckets"); } http://git-wip-us.apache.org/repos/asf/geode/blob/92f26f17/geode-core/src/test/java/org/apache/geode/management/internal/cli/OptionAliasesParsingTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/OptionAliasesParsingTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/OptionAliasesParsingTest.java new file mode 100644 index 0000000..a33e95e --- /dev/null +++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/OptionAliasesParsingTest.java @@ -0,0 +1,344 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.management.internal.cli; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.ClassRule; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import org.apache.geode.test.dunit.rules.GfshParserRule; +import org.apache.geode.test.junit.categories.IntegrationTest; + +@Category(IntegrationTest.class) +public class OptionAliasesParsingTest { + + private String buffer; + + @ClassRule + public static GfshParserRule parser = new GfshParserRule(); + + @Test + public void startLocator() { + buffer = "start locator --name=locator1 --groups=g1,g2"; + validateParsedResults(false, true); + } + + @Test + public void startServer() { + buffer = "start server --name=server1 --groups=g1,g2"; + validateParsedResults(false, true); + } + + @Test + public void exportConfig() { + buffer = "export config --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void createRegion() { + buffer = "create region --name=region1 --type=REPLICATE_PERSISTENT --groups=g1,g2"; + validateParsedResults(false, true); + } + + @Test + public void alterRegion() { + buffer = "alter region --name=region1 --groups=g1,g2"; + validateParsedResults(false, true); + } + + @Test + public void deploy() { + buffer = "deploy --jars=j1,j2 --groups=g1,g2"; + validateParsedResults(false, true, true); + } + + @Test + public void undeploy() { + buffer = "undeploy --jars=j1,j2 --groups=g1,g2"; + validateParsedResults(false, true, true); + } + + @Test + public void listDeployed() { + buffer = "list deployed --groups=g1,g2"; + validateParsedResults(false, true); + } + + @Test + public void createDiskStore() { + buffer = "create disk-store --name=ds1 --dir=dir1 --groups=g1,g2"; + validateParsedResults(false, true); + } + + @Test + public void compactDiskStore() { + buffer = "compact disk-store --name=ds1 --groups=g1,g2"; + validateParsedResults(false, true); + } + + @Test + public void destroyDiskStore() { + buffer = "destroy disk-store --name=ds1 --groups=g1,g2"; + validateParsedResults(false, true); + } + + @Test + public void listDurableCQs() { + buffer = "list durable-cqs --durable-client-id=id1 --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void showSubscriptionQueueSize() { + buffer = "show subscription-queue-size --durable-client-id=id1 --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void closeDurableCQs() { + buffer = + "close durable-cq --durable-client-id=id1 --durable-cq-name=cq1 --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void closeDurableClient() { + buffer = "close durable-client --durable-client-id=id1 --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void exportLogs() { + buffer = "export logs --dir=/temp --groups=g1,g2 --members=m1,m2"; + validateParsedResults(true, true); + } + + @Test + public void executeFunction() { + buffer = "execute function --id=function1 --groups=g1,g2"; + validateParsedResults(false, true); + } + + @Test + public void destroyFunction() { + buffer = "destroy function --id=function1 --groups=g1,g2"; + validateParsedResults(false, true); + } + + @Test + public void listFunctions() { + buffer = "list functions --groups=g1,g2 --members=m1,m2"; + validateParsedResults(true, true); + } + + @Test + public void createIndex() { + buffer = + "create index --name=index1 --expression=expression1.id --region=region1 --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void destroyIndex() { + buffer = "destroy index --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void createDefinedIndexes() { + buffer = "create defined indexes --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void gc() { + buffer = "gc --groups=g1,g2"; + validateParsedResults(false, true); + } + + @Test + public void netstat() { + buffer = "netstat --members=m1,m2"; + validateParsedResults(true, false); + } + + @Test + public void exportStackTraces() { + buffer = "export stack-traces --file=file1.txt --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void changeLogLevel() { + buffer = "change loglevel --loglevel=severe --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void createAsyncEventQueue() { + buffer = "create async-event-queue --id=id1 --listener=listener1 --groups=g1,g2"; + validateParsedResults(false, true); + } + + @Test + public void listRegions() { + buffer = "list regions --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void createGatewaySender() { + buffer = + "create gateway-sender --id=id1 --remote-distributed-system-id=2 --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void startGatewaySender() { + buffer = "start gateway-sender --id=sender1 --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void pauseGatewaySender() { + buffer = "pause gateway-sender --id=sender1 --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void resumeGatewaySender() { + buffer = "resume gateway-sender --id=sender1 --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void stopGatewaySender() { + buffer = "stop gateway-sender --id=sender1 --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void createGatewayReceiver() { + buffer = "create gateway-receiver --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void startGatewayReceiver() { + buffer = "start gateway-receiver --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void stopGatewayReceiver() { + buffer = "stop gateway-receiver --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void listGateways() { + buffer = "list gateways --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void statusGatewaySender() { + buffer = "status gateway-sender --id=sender1 --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void statusGatewayReceiver() { + buffer = "status gateway-receiver --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void destroyGatewaySender() { + buffer = "destroy gateway-sender --id=sender1 --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + @Test + public void alterRuntime() { + buffer = "alter runtime --members=m1,m2 --groups=g1,g2"; + validateParsedResults(true, true); + } + + private void validateParsedResults(boolean canHaveMembers, boolean canHaveGroups) { + GfshParseResult result = parser.parse(buffer); + if (canHaveMembers) { + assertThat(result.getParamValue("member")).isEqualTo("m1,m2"); + } + if (canHaveGroups) { + assertThat(result.getParamValue("group")).isEqualTo("g1,g2"); + } + } + + private void validateParsedResults(boolean canHaveMembers, boolean canHaveGroups, + boolean canHaveJars) { + GfshParseResult result = parser.parse(buffer); + validateParsedResults(canHaveMembers, canHaveGroups); + if (canHaveJars) { + assertThat(result.getParamValue("jar")).isEqualTo("j1,j2"); + } + } + + /** + * This characterizes the current behavior but it may be incorrect. + */ + @Test + public void gc_memberWithCommas() { + buffer = "gc --member=m1,m2"; + GfshParseResult result = parser.parse(buffer); + assertThat(result.getParamValue("member")).isEqualTo("m1,m2"); + } + + @Test + public void gc_onlySupportsMember_returnsNull() { + buffer = "gc --members=m1,m2"; + assertThat(parser.parse(buffer)).isNull(); + } + + @Test + public void destroyFunction_memberWithCommas() { + buffer = "destroy function --id=function1 --member=m1,m2"; + GfshParseResult result = parser.parse(buffer); + assertThat(result.getParamValue("member")).isEqualTo("m1,m2"); + } + + @Test + public void destroyFunction_onlySupportsMember_returnsNull() { + buffer = "destroy function --id=function1 --members=m1,m2"; + assertThat(parser.parse(buffer)).isNull(); + } + + @Test + public void memberAndMembersReturnsNull() { + buffer = + "create region --name=region1 --type=REPLICATE_PERSISTENT --members=m1,m2 --member=m4,m5"; + assertThat(parser.parse(buffer)).isNull(); + } + + @Test + public void groupAndGroupsReturnsNull() { + buffer = + "create region --name=region1 --type=REPLICATE_PERSISTENT --groups=g1,g2 --group=g4,g5"; + assertThat(parser.parse(buffer)).isNull(); + } +} http://git-wip-us.apache.org/repos/asf/geode/blob/92f26f17/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsIntegrationTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsIntegrationTest.java index 0b012c9..4ca625a 100644 --- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsIntegrationTest.java +++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsIntegrationTest.java @@ -34,7 +34,8 @@ import java.nio.file.Path; public class ExportLogsIntegrationTest { @ClassRule - public static LocatorStarterRule locator = new LocatorStarterRule().withAutoStart(); + public static LocatorStarterRule locator = + new LocatorStarterRule().withJMXManager().withProperty("groups", "g1,g2").withAutoStart(); @Rule public GfshShellConnectionRule gfsh = new GfshShellConnectionRule(); http://git-wip-us.apache.org/repos/asf/geode/blob/92f26f17/geode-web/src/test/java/org/apache/geode/management/internal/security/LogNoPasswordTest.java ---------------------------------------------------------------------- diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/security/LogNoPasswordTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/security/LogNoPasswordTest.java index 688af78..3176f54 100644 --- a/geode-web/src/test/java/org/apache/geode/management/internal/security/LogNoPasswordTest.java +++ b/geode-web/src/test/java/org/apache/geode/management/internal/security/LogNoPasswordTest.java @@ -18,18 +18,19 @@ package org.apache.geode.management.internal.security; import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL; import static org.assertj.core.api.Assertions.assertThat; +import java.io.File; +import java.util.Properties; +import java.util.Scanner; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; + import org.apache.geode.security.AuthenticationFailedException; import org.apache.geode.security.SecurityManager; import org.apache.geode.test.dunit.rules.GfshShellConnectionRule; import org.apache.geode.test.dunit.rules.LocatorStarterRule; import org.apache.geode.test.junit.categories.IntegrationTest; -import org.junit.Rule; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import java.io.File; -import java.util.Properties; -import java.util.Scanner; @Category(IntegrationTest.class) public class LogNoPasswordTest {