geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject [05/50] [abbrv] geode git commit: GEODE-3436: revert recent refactoring of GFSH commands
Date Tue, 15 Aug 2017 23:10:16 GMT
http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandUnitTest.java
deleted file mode 100644
index 3550638..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandUnitTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.commands;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.spy;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.result.CommandResult;
-import org.apache.geode.test.dunit.rules.GfshParserRule;
-import org.apache.geode.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class StartLocatorCommandUnitTest {
-  @Rule
-  public GfshParserRule gfshRule = new GfshParserRule();
-
-  private StartLocatorCommand command;
-  private CommandResult result;
-
-  @Before
-  public void before() throws Exception {
-    command = spy(StartLocatorCommand.class);
-  }
-
-  @Test
-  public void failsOnMissingGemFirePropertiesFile() throws Exception {
-    result =
-        gfshRule.executeCommandWithInstance(command, "start locator --properties-file=notExist");
-    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
-    assertThat(result.toString()).contains("notExist could not be found");
-  }
-
-  @Test
-  public void failsOnMissingGemFireSecurityPropertiesFile() throws Exception {
-    result = gfshRule.executeCommandWithInstance(command,
-        "start locator --security-properties-file=notExist");
-    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
-    assertThat(result.toString()).contains("notExist could not be found");
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartMemberCommandTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartMemberCommandTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartMemberCommandTest.java
deleted file mode 100644
index 911e752..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartMemberCommandTest.java
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * 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.commands;
-
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.NAME;
-import static org.apache.geode.distributed.ConfigurationProperties.START_DEV_REST_API;
-import static org.assertj.core.api.Java6Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TemporaryFolder;
-import org.junit.rules.TestName;
-
-import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.util.IOUtils;
-import org.apache.geode.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class StartMemberCommandTest {
-  private StartMemberCommand startMemberCommand;
-
-  @Rule
-  public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
-  @Rule
-  public TestName testName = new TestName();
-
-  @Before
-  public void before() {
-    startMemberCommand = new StartMemberCommand();
-  }
-
-  @Test
-  public void testAddGemFirePropertyFileToCommandLine() {
-    final List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addGemFirePropertyFile(commandLine, null);
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addGemFirePropertyFile(commandLine, null);
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addGemFirePropertyFile(commandLine, null);
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addGemFirePropertyFile(commandLine, new File("/path/to/gemfire.properties"));
-    assertFalse(commandLine.isEmpty());
-    assertTrue(commandLine.contains("-DgemfirePropertyFile=/path/to/gemfire.properties"));
-  }
-
-  @Test
-  public void testAddGemFireSystemPropertiesToCommandLine() {
-    final List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addGemFireSystemProperties(commandLine, new Properties());
-    assertTrue(commandLine.isEmpty());
-
-    final Properties gemfireProperties = new Properties();
-    gemfireProperties.setProperty(LOCATORS, "localhost[11235]");
-    gemfireProperties.setProperty(LOG_LEVEL, "config");
-    gemfireProperties.setProperty(LOG_FILE, org.apache.commons.lang.StringUtils.EMPTY);
-    gemfireProperties.setProperty(MCAST_PORT, "0");
-    gemfireProperties.setProperty(NAME, "machine");
-    startMemberCommand.addGemFireSystemProperties(commandLine, gemfireProperties);
-
-    assertFalse(commandLine.isEmpty());
-    assertEquals(4, commandLine.size());
-
-    for (final String propertyName : gemfireProperties.stringPropertyNames()) {
-      final String propertyValue = gemfireProperties.getProperty(propertyName);
-      if (org.apache.commons.lang.StringUtils.isBlank(propertyValue)) {
-        for (final String systemProperty : commandLine) {
-          assertFalse(systemProperty.startsWith(
-              "-D" + DistributionConfig.GEMFIRE_PREFIX + "".concat(propertyName).concat("=")));
-        }
-      } else {
-        assertTrue(commandLine.contains("-D" + DistributionConfig.GEMFIRE_PREFIX
-            + "".concat(propertyName).concat("=").concat(propertyValue)));
-      }
-    }
-  }
-
-  @Test
-  public void testAddGemFireSystemPropertiesToCommandLineWithRestAPI() {
-    final List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addGemFireSystemProperties(commandLine, new Properties());
-    assertTrue(commandLine.isEmpty());
-    final Properties gemfireProperties = new Properties();
-    gemfireProperties.setProperty(LOCATORS, "localhost[11235]");
-    gemfireProperties.setProperty(LOG_LEVEL, "config");
-    gemfireProperties.setProperty(LOG_FILE, "");
-    gemfireProperties.setProperty(MCAST_PORT, "0");
-    gemfireProperties.setProperty(NAME, "machine");
-    gemfireProperties.setProperty(START_DEV_REST_API, "true");
-    gemfireProperties.setProperty(HTTP_SERVICE_PORT, "8080");
-    gemfireProperties.setProperty(HTTP_SERVICE_BIND_ADDRESS, "localhost");
-
-    startMemberCommand.addGemFireSystemProperties(commandLine, gemfireProperties);
-
-    assertFalse(commandLine.isEmpty());
-    assertEquals(7, commandLine.size());
-
-    for (final String propertyName : gemfireProperties.stringPropertyNames()) {
-      final String propertyValue = gemfireProperties.getProperty(propertyName);
-      if (StringUtils.isBlank(propertyValue)) {
-        for (final String systemProperty : commandLine) {
-          assertFalse(systemProperty.startsWith(
-              "-D" + DistributionConfig.GEMFIRE_PREFIX + "".concat(propertyName).concat("=")));
-        }
-      } else {
-        assertTrue(commandLine.contains("-D" + DistributionConfig.GEMFIRE_PREFIX
-            + "".concat(propertyName).concat("=").concat(propertyValue)));
-      }
-    }
-  }
-
-  @Test
-  public void testAddInitialHeapToCommandLine() {
-    final List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addInitialHeap(commandLine, null);
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addInitialHeap(commandLine, org.apache.commons.lang.StringUtils.EMPTY);
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addInitialHeap(commandLine, " ");
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addInitialHeap(commandLine, "512M");
-    assertFalse(commandLine.isEmpty());
-    assertEquals("-Xms512M", commandLine.get(0));
-  }
-
-  @Test
-  public void testAddJvmArgumentsAndOptionsToCommandLine() {
-    final List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addJvmArgumentsAndOptions(commandLine, null);
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addJvmArgumentsAndOptions(commandLine, new String[] {});
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addJvmArgumentsAndOptions(commandLine,
-        new String[] {"-DmyProp=myVal", "-d64", "-server", "-Xprof"});
-    assertFalse(commandLine.isEmpty());
-    assertEquals(4, commandLine.size());
-    assertEquals("-DmyProp=myVal", commandLine.get(0));
-    assertEquals("-d64", commandLine.get(1));
-    assertEquals("-server", commandLine.get(2));
-    assertEquals("-Xprof", commandLine.get(3));
-  }
-
-  @Test
-  public void testAddMaxHeapToCommandLine() {
-    final List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addMaxHeap(commandLine, null);
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addMaxHeap(commandLine, org.apache.commons.lang.StringUtils.EMPTY);
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addMaxHeap(commandLine, "  ");
-    assertTrue(commandLine.isEmpty());
-    startMemberCommand.addMaxHeap(commandLine, "1024M");
-    assertFalse(commandLine.isEmpty());
-    assertEquals(3, commandLine.size());
-    assertEquals("-Xmx1024M", commandLine.get(0));
-    assertEquals("-XX:+UseConcMarkSweepGC", commandLine.get(1));
-    assertEquals(
-        "-XX:CMSInitiatingOccupancyFraction=" + StartMemberCommand.CMS_INITIAL_OCCUPANCY_FRACTION,
-        commandLine.get(2));
-  }
-
-  @Test(expected = AssertionError.class)
-  public void testReadPidWithNull() {
-    try {
-      startMemberCommand.readPid(null);
-    } catch (AssertionError expected) {
-      assertEquals("The file from which to read the process ID (pid) cannot be null!",
-          expected.getMessage());
-      throw expected;
-    }
-  }
-
-  @Test
-  public void testReadPidWithNonExistingFile() {
-    assertEquals(StartMemberCommand.INVALID_PID,
-        startMemberCommand.readPid(new File("/path/to/non_existing/pid.file")));
-  }
-
-  @Test
-  public void testGetSystemClasspath() {
-    assertEquals(System.getProperty("java.class.path"), startMemberCommand.getSystemClasspath());
-  }
-
-  @Test
-  public void testToClasspath() {
-    final boolean EXCLUDE_SYSTEM_CLASSPATH = false;
-    final boolean INCLUDE_SYSTEM_CLASSPATH = true;
-    String[] jarFilePathnames =
-        {"/path/to/user/libs/A.jar", "/path/to/user/libs/B.jar", "/path/to/user/libs/C.jar"};
-    String[] userClasspaths = {"/path/to/classes:/path/to/libs/1.jar:/path/to/libs/2.jar",
-        "/path/to/ext/libs/1.jar:/path/to/ext/classes:/path/to/ext/lib/10.jar"};
-    String expectedClasspath = StartMemberCommand.GEODE_JAR_PATHNAME.concat(File.pathSeparator)
-        .concat(toClasspath(userClasspaths)).concat(File.pathSeparator)
-        .concat(toClasspath(jarFilePathnames));
-    assertEquals(expectedClasspath,
-        startMemberCommand.toClasspath(EXCLUDE_SYSTEM_CLASSPATH, jarFilePathnames, userClasspaths));
-    expectedClasspath = StartMemberCommand.GEODE_JAR_PATHNAME.concat(File.pathSeparator)
-        .concat(toClasspath(userClasspaths)).concat(File.pathSeparator)
-        .concat(System.getProperty("java.class.path")).concat(File.pathSeparator)
-        .concat(toClasspath(jarFilePathnames));
-    assertEquals(expectedClasspath,
-        startMemberCommand.toClasspath(INCLUDE_SYSTEM_CLASSPATH, jarFilePathnames, userClasspaths));
-    expectedClasspath = StartMemberCommand.GEODE_JAR_PATHNAME.concat(File.pathSeparator)
-        .concat(System.getProperty("java.class.path"));
-    assertEquals(expectedClasspath,
-        startMemberCommand.toClasspath(INCLUDE_SYSTEM_CLASSPATH, null, (String[]) null));
-    assertEquals(StartMemberCommand.GEODE_JAR_PATHNAME,
-        startMemberCommand.toClasspath(EXCLUDE_SYSTEM_CLASSPATH, null, (String[]) null));
-    assertEquals(StartMemberCommand.GEODE_JAR_PATHNAME,
-        startMemberCommand.toClasspath(EXCLUDE_SYSTEM_CLASSPATH, new String[0], ""));
-  }
-
-  @Test
-  public void testToClassPathOrder() {
-    String userClasspathOne = "/path/to/user/lib/a.jar:/path/to/user/classes";
-    String userClasspathTwo =
-        "/path/to/user/lib/x.jar:/path/to/user/lib/y.jar:/path/to/user/lib/z.jar";
-
-    String expectedClasspath = startMemberCommand.getGemFireJarPath().concat(File.pathSeparator)
-        .concat(userClasspathOne).concat(File.pathSeparator).concat(userClasspathTwo)
-        .concat(File.pathSeparator).concat(System.getProperty("java.class.path"))
-        .concat(File.pathSeparator).concat(StartMemberCommand.CORE_DEPENDENCIES_JAR_PATHNAME)
-        .concat(File.pathSeparator).concat(StartMemberCommand.CORE_DEPENDENCIES_JAR_PATHNAME);
-
-    String actualClasspath =
-        startMemberCommand.toClasspath(true,
-            new String[] {StartMemberCommand.CORE_DEPENDENCIES_JAR_PATHNAME,
-                StartMemberCommand.CORE_DEPENDENCIES_JAR_PATHNAME},
-            userClasspathOne, userClasspathTwo);
-
-    assertEquals(expectedClasspath, actualClasspath);
-  }
-
-  @Test
-  public void workingDirDefaultsToMemberName() {
-    String workingDir = startMemberCommand.resolveWorkingDir(null, "server1");
-    assertThat(new File(workingDir)).exists();
-    assertThat(workingDir).endsWith("server1");
-  }
-
-  @Test
-  public void workingDirGetsCreatedIfNecessary() throws Exception {
-    File workingDir = temporaryFolder.newFolder("foo");
-    FileUtils.deleteQuietly(workingDir);
-    String workingDirString = workingDir.getAbsolutePath();
-    String resolvedWorkingDir = startMemberCommand.resolveWorkingDir(workingDirString, "server1");
-    assertThat(new File(resolvedWorkingDir)).exists();
-    assertThat(workingDirString).endsWith("foo");
-  }
-
-  @Test
-  public void testWorkingDirWithRelativePath() throws Exception {
-    Path relativePath = Paths.get("some").resolve("relative").resolve("path");
-    assertThat(relativePath.isAbsolute()).isFalse();
-    String resolvedWorkingDir =
-        startMemberCommand.resolveWorkingDir(relativePath.toString(), "server1");
-    assertThat(resolvedWorkingDir).isEqualTo(relativePath.toAbsolutePath().toString());
-  }
-
-
-  @Test
-  public void testReadPid() throws IOException {
-    final int expectedPid = 12345;
-    File folder = temporaryFolder.newFolder();
-    File pidFile =
-        new File(folder, getClass().getSimpleName() + "_" + testName.getMethodName() + ".pid");
-    assertTrue(pidFile.createNewFile());
-    pidFile.deleteOnExit();
-    writePid(pidFile, expectedPid);
-
-    final int actualPid = startMemberCommand.readPid(pidFile);
-
-    assertEquals(expectedPid, actualPid);
-  }
-
-  private String toClasspath(final String... jarFilePathnames) {
-    StringBuilder classpath = new StringBuilder(StringUtils.EMPTY);
-    if (jarFilePathnames != null) {
-      for (final String jarFilePathname : jarFilePathnames) {
-        classpath.append((classpath.length() == 0) ? StringUtils.EMPTY : File.pathSeparator);
-        classpath.append(jarFilePathname);
-      }
-    }
-    return classpath.toString();
-  }
-
-  private void writePid(final File pidFile, final int pid) throws IOException {
-    final FileWriter fileWriter = new FileWriter(pidFile, false);
-    fileWriter.write(String.valueOf(pid));
-    fileWriter.write("\n");
-    fileWriter.flush();
-    IOUtils.close(fileWriter);
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandUnitTest.java
deleted file mode 100644
index 41a6eb8..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandUnitTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.commands;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.result.CommandResult;
-import org.apache.geode.management.internal.cli.shell.Gfsh;
-import org.apache.geode.test.dunit.rules.GfshParserRule;
-import org.apache.geode.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class StartServerCommandUnitTest {
-  @Rule
-  public GfshParserRule gfshRule = new GfshParserRule();
-
-  private StartServerCommand command;
-  private CommandResult result;
-
-  @Before
-  public void before() throws Exception {
-    command = spy(StartServerCommand.class);
-    Gfsh gfsh = mock(Gfsh.class);
-    when(command.getGfsh()).thenReturn(gfsh);
-  }
-
-  @Test
-  public void failsFastOnMissingCacheXmlFile() throws Exception {
-    result = gfshRule.executeCommandWithInstance(command, "start server --cache-xml-file=notExist");
-    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
-    assertThat(result.toString()).contains("notExist could not be found.");
-  }
-
-  @Test
-  public void failsFastOnMissingGemFirePropertiesFile() throws Exception {
-    result =
-        gfshRule.executeCommandWithInstance(command, "start server --properties-file=notExist");
-    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
-    assertThat(result.toString()).contains("notExist could not be found.");
-  }
-
-  @Test
-  public void failsFastOnMissingGemFireSecurityPropertiesFile() throws Exception {
-    result = gfshRule.executeCommandWithInstance(command,
-        "start server --security-properties-file=notExist");
-    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
-    assertThat(result.toString()).contains("notExist could not be found.");
-  }
-
-  @Test
-  public void failsFastOnMissingPassword() throws Exception {
-    result = gfshRule.executeCommandWithInstance(command, "start server --user=test");
-    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
-    assertThat(result.toString()).contains("password must be specified.");
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StatusLocatorCommandUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StatusLocatorCommandUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StatusLocatorCommandUnitTest.java
deleted file mode 100644
index 4c2dbdb..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/StatusLocatorCommandUnitTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.commands;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.spy;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.commands.lifecycle.StatusLocatorCommand;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.CommandResult;
-import org.apache.geode.test.dunit.rules.GfshParserRule;
-import org.apache.geode.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class StatusLocatorCommandUnitTest {
-  @Rule
-  public GfshParserRule gfshRule = new GfshParserRule();
-
-  private StatusLocatorCommand command;
-
-  @Before
-  public void before() throws Exception {
-    command = spy(StatusLocatorCommand.class);
-  }
-
-  @Test
-  public void usesMemberNameIDWhenGfshIsNotConnected() {
-    CommandResult result =
-        gfshRule.executeCommandWithInstance(command, "status locator --name=myLocator");
-    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
-    assertThat(result.toString()).contains(
-        CliStrings.format(CliStrings.STATUS_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, "Locator"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopLocatorCommandUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopLocatorCommandUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopLocatorCommandUnitTest.java
deleted file mode 100644
index 8b79444..0000000
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopLocatorCommandUnitTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.commands.lifecycle;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.CommandResult;
-import org.apache.geode.management.internal.cli.shell.Gfsh;
-import org.apache.geode.test.dunit.rules.GfshParserRule;
-import org.apache.geode.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class StopLocatorCommandUnitTest {
-  @Rule
-  public GfshParserRule gfshRule = new GfshParserRule();
-
-  private StopLocatorCommand stopLocatorCommand;
-  private CommandResult result;
-  private Gfsh gfsh;
-
-  @Before
-  public void before() throws Exception {
-    stopLocatorCommand = spy(StopLocatorCommand.class);
-    gfsh = mock(Gfsh.class);
-  }
-
-  @Test
-  public void usesMemberNameIDWhenNotConnected() {
-    when(stopLocatorCommand.isConnectedAndReady()).thenReturn(false);
-    result =
-        gfshRule.executeCommandWithInstance(stopLocatorCommand, "stop locator --name=myLocator");
-    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
-    assertThat(result.toString()).contains(
-        CliStrings.format(CliStrings.STOP_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, "Locator"));
-  }
-
-  @Test
-  public void usesMemberNameIDWhenConnected() throws IOException {
-    when(stopLocatorCommand.isConnectedAndReady()).thenReturn(true);
-    when(gfsh.isConnectedAndReady()).thenReturn(true);
-    doReturn(null).when(stopLocatorCommand).getMemberMXBean(anyString());
-    result = gfshRule.executeCommandWithInstance(stopLocatorCommand,
-        "stop locator --name=invalidLocator");
-    assertThat(result.toString()).contains(CliStrings.format(
-        CliStrings.STOP_LOCATOR__NO_LOCATOR_FOUND_FOR_MEMBER_ERROR_MESSAGE, "invalidLocator"));
-  }
-}

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/test/java/org/apache/geode/management/internal/cli/help/HelperIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/help/HelperIntegrationTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/help/HelperIntegrationTest.java
index e44465f..48ad499 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/help/HelperIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/help/HelperIntegrationTest.java
@@ -15,22 +15,16 @@
 
 package org.apache.geode.management.internal.cli.help;
 
-import static org.apache.geode.management.internal.cli.i18n.CliStrings.HINT__MSG__TOPICS_AVAILABLE;
-import static org.apache.geode.management.internal.cli.i18n.CliStrings.HINT__MSG__UNKNOWN_TOPIC;
-import static org.apache.geode.management.internal.cli.i18n.CliStrings.TOPIC_CLIENT__DESC;
 import static org.assertj.core.api.Assertions.assertThat;
 
-import java.lang.reflect.Method;
-
+import org.apache.geode.management.internal.cli.commands.GfshHelpCommands;
+import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.springframework.shell.core.annotation.CliCommand;
 
-import org.apache.geode.management.internal.cli.commands.GfshHelpCommand;
-import org.apache.geode.management.internal.cli.commands.GfshHintCommand;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.test.junit.categories.IntegrationTest;
+import java.lang.reflect.Method;
 
 @Category(IntegrationTest.class)
 public class HelperIntegrationTest {
@@ -39,20 +33,8 @@ public class HelperIntegrationTest {
   @BeforeClass
   public static void beforeClass() {
     helper = new Helper();
-  }
-
-  private void getHelpCommand() {
-    Method[] methods = GfshHelpCommand.class.getMethods();
-    for (Method method : methods) {
-      CliCommand cliCommand = method.getDeclaredAnnotation(CliCommand.class);
-      if (cliCommand != null) {
-        helper.addCommand(cliCommand, method);
-      }
-    }
-  }
-
-  private void getHintCommand() {
-    Method[] methods = GfshHintCommand.class.getMethods();
+    // use GfshHelpCommand for testing
+    Method[] methods = GfshHelpCommands.class.getMethods();
     for (Method method : methods) {
       CliCommand cliCommand = method.getDeclaredAnnotation(CliCommand.class);
       if (cliCommand != null) {
@@ -63,52 +45,19 @@ public class HelperIntegrationTest {
 
   @Test
   public void testHelpWithNoInput() {
-    getHelpCommand();
-    String testNoInput = helper.getHelp(null, -1);
-    String[] helpLines = testNoInput.split("\n");
-    assertThat(helpLines).hasSize(2);
+    String test = helper.getHelp(null, -1);
+    String[] helpLines = test.split("\n");
+    assertThat(helpLines).hasSize(4);
     assertThat(helpLines[0]).isEqualTo("help (Available)");
-    assertThat(helpLines[1]).isEqualTo(CliStrings.HELP__HELP);
+    assertThat(helpLines[2]).isEqualTo("hint (Available)");
   }
 
   @Test
   public void testHelpWithInput() {
-    getHelpCommand();
-    String testInput = helper.getHelp("help", -1);
-    String[] helpLines = testInput.split("\n");
+    String test = helper.getHelp("help", -1);
+    String[] helpLines = test.split("\n");
     assertThat(helpLines).hasSize(12);
     assertThat(helpLines[0]).isEqualTo("NAME");
     assertThat(helpLines[1]).isEqualTo("help");
   }
-
-  @Test
-  public void testHelpWithInvalidInput() {
-    getHelpCommand();
-    String testInvalidInput = helper.getHelp("InvalidTopic", -1);
-    assertThat(testInvalidInput).isEqualTo("no help exists for this command.");
-  }
-
-  @Test
-  public void testHintWithNoInput() {
-    getHintCommand();
-    String testNoInput = helper.getHint(null);
-    String[] hintLines = testNoInput.split("\n");
-    assertThat(hintLines).hasSize(21);
-    assertThat(hintLines[0]).isEqualTo(HINT__MSG__TOPICS_AVAILABLE);
-  }
-
-  @Test
-  public void testHintWithInput() {
-    getHintCommand();
-    String testInput = helper.getHint("Client");
-    assertThat(testInput).contains(TOPIC_CLIENT__DESC);
-  }
-
-  @Test
-  public void testHintWithInvalidInput() {
-    getHintCommand();
-    String testInvalidInput = helper.getHint("InvalidTopic");
-    assertThat(testInvalidInput)
-        .isEqualTo(CliStrings.format(HINT__MSG__UNKNOWN_TOPIC, "InvalidTopic"));
-  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/test/java/org/apache/geode/management/internal/security/TestCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/TestCommand.java
b/geode-core/src/test/java/org/apache/geode/management/internal/security/TestCommand.java
index 3aca001..f380d88 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/TestCommand.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/TestCommand.java
@@ -123,12 +123,12 @@ public class TestCommand {
     createTestCommand("list clients", clusterRead);
     createTestCommand("describe client --clientID=172.16.196.144", clusterRead);
 
-    // AlterRuntimeConfigCommand, DescribeConfigCommand, ExportConfigCommand (config commands)
+    // ConfigCommands
     createTestCommand("alter runtime", clusterManage);
     createTestCommand("describe config --member=Member1", clusterRead);
     createTestCommand("export config --member=member1", clusterRead);
 
-    // CreateRegionCommand, AlterRegionCommand, DestroyRegionCommand
+    // CreateAlterDestroyRegionCommands
     createTestCommand("alter region --name=RegionA --eviction-max=5000", regionAManage);
     createTestCommand("create region --name=region12 --type=REPLICATE", dataManage);
     createTestCommand("create region --name=region123 --type=PARTITION_PERSISTENT", dataManage,
@@ -171,30 +171,28 @@ public class TestCommand {
     createTestCommand("alter disk-store --name=foo --region=xyz --disk-dirs=bar");
     createTestCommand("destroy disk-store --name=foo", clusterManageDisk);
 
-    // CloseDurableClientCommand, CloseDurableCQsCommand, CountDurableCQEventsCommand,
-    // ListDurableClientCQsCommand
+    // DurableClientCommands
     createTestCommand("close durable-client --durable-client-id=client1", clusterManageQuery);
     createTestCommand("close durable-cq --durable-client-id=client1 --durable-cq-name=cq1",
         clusterManageQuery);
     createTestCommand("show subscription-queue-size --durable-client-id=client1", clusterRead);
     createTestCommand("list durable-cqs --durable-client-id=client1", clusterRead);
 
-    // ExportImportSharedConfigurationCommands
+    // ExportIMportSharedConfigurationCommands
     createTestCommand("export cluster-configuration --zip-file-name=mySharedConfig.zip",
         clusterRead);
     createTestCommand("import cluster-configuration --zip-file-name=value.zip", clusterManage);
 
-    // DestroyFunctionCommand, ExecuteFunctionCommand, ListFunctionCommand
-    createTestCommand("destroy function --id=InterestCalculations", dataManage);
+    // FunctionCommands
+    // createTestCommand("destroy function --id=InterestCalculations", dataManage);
     createTestCommand("execute function --id=InterestCalculations --groups=Group1", dataWrite);
     createTestCommand("list functions", clusterRead);
 
-    // GfshHelpCommand, GfshHintCommand
+    // GfshHelpCommands
     createTestCommand("hint");
     createTestCommand("help");
 
-    // ClearDefinedIndexesCommand, CreateDefinedIndexesCommand, CreateIndexCommand,
-    // DefineIndexCommand, DestroyIndexCommand, ListIndexCommand
+    // IndexCommands
     createTestCommand("clear defined indexes", clusterManageQuery);
     createTestCommand("create defined indexes", clusterManageQuery);
     createTestCommand(
@@ -218,7 +216,7 @@ public class TestCommand {
     // createTestCommand("stop locator --name=locator1", clusterManage);
     // createTestCommand("stop server --name=server1", clusterManage);
 
-    // DescribeMemberCommand, ListMemberCommand
+    // MemberCommands
     createTestCommand("describe member --name=server1", clusterRead);
     createTestCommand("list members", clusterRead);
 
@@ -247,11 +245,11 @@ public class TestCommand {
 
     createTestCommand("list async-event-queues", clusterRead);
 
-    // DescribeRegionCommand, ListRegionCommand
+    // RegionCommands
     createTestCommand("describe region --name=value", clusterRead);
     createTestCommand("list regions", clusterRead);
 
-    // StatusClusterConfigServiceCommand
+    // StatusCommands
     createTestCommand("status cluster-config-service", clusterRead);
 
     // Shell Commands
@@ -280,5 +278,8 @@ public class TestCommand {
 
     // ShellCommand
     createTestCommand("disconnect");
+
+    // Misc commands
+    // createTestCommand("shutdown", clusterManage);
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
index 2122570..aaa7724 100755
--- a/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/redis/SetsJUnitTest.java
@@ -20,23 +20,22 @@ import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Random;
-import java.util.Set;
-
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.GemFireCache;
+import org.apache.geode.internal.AvailablePortHelper;
+import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-import redis.clients.jedis.Jedis;
 
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.GemFireCache;
-import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.test.junit.categories.IntegrationTest;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+import redis.clients.jedis.Jedis;
 
 @Category(IntegrationTest.class)
 public class SetsJUnitTest {

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-core/src/test/java/org/apache/geode/redis/SortedSetsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/redis/SortedSetsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/redis/SortedSetsJUnitTest.java
index d88bc15..633cb3d 100755
--- a/geode-core/src/test/java/org/apache/geode/redis/SortedSetsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/redis/SortedSetsJUnitTest.java
@@ -14,26 +14,12 @@
  */
 package org.apache.geode.redis;
 
-import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Random;
-import java.util.Set;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.GemFireCache;
+import org.apache.geode.internal.AvailablePortHelper;
+import org.apache.geode.test.junit.categories.IntegrationTest;
 
+import org.apache.geode.redis.GeodeRedisServer;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -42,10 +28,12 @@ import org.junit.experimental.categories.Category;
 import redis.clients.jedis.Jedis;
 import redis.clients.jedis.Tuple;
 
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.GemFireCache;
-import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.test.junit.categories.IntegrationTest;
+import java.io.IOException;
+import java.util.*;
+import java.util.Map.Entry;
+
+import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.junit.Assert.*;
 
 @Category(IntegrationTest.class)
 public class SortedSetsJUnitTest {

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-cq/src/test/java/org/apache/geode/management/internal/cli/commands/DurableClientCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/org/apache/geode/management/internal/cli/commands/DurableClientCommandsDUnitTest.java
b/geode-cq/src/test/java/org/apache/geode/management/internal/cli/commands/DurableClientCommandsDUnitTest.java
index 877f7e7..e15d2cc 100644
--- a/geode-cq/src/test/java/org/apache/geode/management/internal/cli/commands/DurableClientCommandsDUnitTest.java
+++ b/geode-cq/src/test/java/org/apache/geode/management/internal/cli/commands/DurableClientCommandsDUnitTest.java
@@ -233,7 +233,7 @@ public class DurableClientCommandsDUnitTest extends CliCommandTestBase
{
     writeToLog("Command Result :\n", resultAsString);
     assertTrue(Status.ERROR.equals(commandResult.getStatus()));
     assertTrue(resultAsString
-        .contains(CliStrings.format(CliStrings.DURABLE_CQ_CLIENT_NOT_FOUND, clientName)));
+        .contains(CliStrings.format(CliStrings.NO_CLIENT_FOUND_WITH_CLIENT_ID, clientName)));
   }
 
   private void writeToLog(String text, String resultAsString) {
@@ -350,7 +350,7 @@ public class DurableClientCommandsDUnitTest extends CliCommandTestBase
{
         ccf.addPoolServer(getServerHostName(server.getHost()), port);
         ccf.setPoolSubscriptionEnabled(true);
 
-        ClientCache cache = getClientCache(ccf);
+        ClientCache cache = (ClientCache) getClientCache(ccf);
       }
     });
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/645a32d0/geode-junit/src/test/java/org/apache/geode/test/junit/rules/RetryRuleLocalWithErrorTest.java
----------------------------------------------------------------------
diff --git a/geode-junit/src/test/java/org/apache/geode/test/junit/rules/RetryRuleLocalWithErrorTest.java
b/geode-junit/src/test/java/org/apache/geode/test/junit/rules/RetryRuleLocalWithErrorTest.java
index cd18695..b04a6e0 100755
--- a/geode-junit/src/test/java/org/apache/geode/test/junit/rules/RetryRuleLocalWithErrorTest.java
+++ b/geode-junit/src/test/java/org/apache/geode/test/junit/rules/RetryRuleLocalWithErrorTest.java
@@ -14,7 +14,7 @@
  */
 package org.apache.geode.test.junit.rules;
 
-import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.*;
 import static org.junit.Assert.fail;
 
 import java.util.List;


Mime
View raw message