You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kh...@apache.org on 2017/10/02 14:38:16 UTC

[geode] 03/03: GEODE-3539: Additional test refactoring

This is an automated email from the ASF dual-hosted git repository.

khowe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git

commit b0348cd3d656848217ed6bb4e06d568203882ddb
Author: Ken Howe <kh...@pivotal.io>
AuthorDate: Thu Sep 28 14:36:27 2017 -0700

    GEODE-3539: Additional test refactoring
    
    Separated remaining tests from ConfigCommandDUnitTest into command specific classes.
---
 ...st.java => DescribeConfigCommandDUnitTest.java} | 66 +---------------------
 ...Test.java => ExportConfigCommandDUnitTest.java} | 46 +--------------
 2 files changed, 2 insertions(+), 110 deletions(-)

diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandDUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandDUnitTest.java
similarity index 59%
copy from geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandDUnitTest.java
copy to geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandDUnitTest.java
index 2b6feea..7ea68c7 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandDUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandDUnitTest.java
@@ -20,11 +20,7 @@ import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
 import static org.apache.geode.distributed.ConfigurationProperties.STATISTIC_SAMPLING_ENABLED;
 import static org.assertj.core.api.Assertions.assertThat;
 
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
 import java.util.Properties;
-import java.util.stream.Collectors;
 
 import junitparams.JUnitParamsRunner;
 import junitparams.Parameters;
@@ -44,7 +40,7 @@ import org.apache.geode.test.junit.categories.DistributedTest;
 
 @Category(DistributedTest.class)
 @RunWith(JUnitParamsRunner.class)
-public class ConfigCommandDUnitTest {
+public class DescribeConfigCommandDUnitTest {
   @Rule
   public LocatorServerStartupRule startupRule =
       new LocatorServerStartupRule().withTempWorkingDir().withLogFile();
@@ -92,64 +88,4 @@ public class ConfigCommandDUnitTest {
     result = gfsh.getGfshOutput();
     assertThat(result).contains("copy-on-read");
   }
-
-  @Test
-  @Parameters({"true", "false"})
-  public void testExportConfig(final boolean connectOverHttp) throws Exception {
-    Properties props = new Properties();
-    props.setProperty(GROUPS, "Group1");
-
-    MemberVM server0 = startupRule.startServerAsEmbededLocator(0, props);
-
-    if (connectOverHttp) {
-      gfsh.connectAndVerify(server0.getHttpPort(), GfshShellConnectionRule.PortType.http);
-    } else {
-      gfsh.connectAndVerify(server0.getJmxPort(), GfshShellConnectionRule.PortType.jmxManger);
-    }
-
-    // start server1 and server2 in group2
-    props.setProperty(GROUPS, "Group2");
-    startupRule.startServerVM(1, props, server0.getEmbeddedLocatorPort());
-    startupRule.startServerVM(2, props, server0.getEmbeddedLocatorPort());
-
-    // start server3 that has no group info
-    startupRule.startServerVM(3, server0.getEmbeddedLocatorPort());
-
-    // export all members' config into a folder
-    File tempDir = temporaryFolder.newFolder("all-members");
-    gfsh.executeAndVerifyCommand("export config --dir=" + tempDir.getAbsolutePath());
-
-    List<String> expectedFiles = Arrays.asList("server-0-cache.xml", "server-1-cache.xml",
-        "server-2-cache.xml", "server-3-cache.xml", "server-0-gf.properties",
-        "server-1-gf.properties", "server-2-gf.properties", "server-3-gf.properties");
-
-    List<String> actualFiles =
-        Arrays.stream(tempDir.listFiles()).map(File::getName).collect(Collectors.toList());
-    assertThat(actualFiles).hasSameElementsAs(expectedFiles);
-    tempDir.delete();
-
-    // export just one member's config
-    tempDir = temporaryFolder.newFolder("member0");
-    gfsh.executeAndVerifyCommand(
-        "export config --member=server-0 --dir=" + tempDir.getAbsolutePath());
-
-    expectedFiles = Arrays.asList("server-0-cache.xml", "server-0-gf.properties");
-
-    actualFiles =
-        Arrays.stream(tempDir.listFiles()).map(File::getName).collect(Collectors.toList());
-    assertThat(actualFiles).hasSameElementsAs(expectedFiles);
-    tempDir.delete();
-
-    // export group2 config into a folder
-    tempDir = temporaryFolder.newFolder("group2");
-    gfsh.executeAndVerifyCommand("export config --group=Group2 --dir=" + tempDir.getAbsolutePath());
-
-    expectedFiles = Arrays.asList("server-1-cache.xml", "server-2-cache.xml",
-        "server-1-gf.properties", "server-2-gf.properties");
-
-    actualFiles =
-        Arrays.stream(tempDir.listFiles()).map(File::getName).collect(Collectors.toList());
-    assertThat(actualFiles).hasSameElementsAs(expectedFiles);
-    tempDir.delete();
-  }
 }
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandDUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportConfigCommandDUnitTest.java
similarity index 68%
rename from geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandDUnitTest.java
rename to geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportConfigCommandDUnitTest.java
index 2b6feea..c66776f 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConfigCommandDUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportConfigCommandDUnitTest.java
@@ -15,9 +15,7 @@
 
 package org.apache.geode.management.internal.cli.commands;
 
-import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_TIME_STATISTICS;
 import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
-import static org.apache.geode.distributed.ConfigurationProperties.STATISTIC_SAMPLING_ENABLED;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.File;
@@ -33,10 +31,6 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.TemporaryFolder;
 import org.junit.runner.RunWith;
-
-import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
@@ -44,7 +38,7 @@ import org.apache.geode.test.junit.categories.DistributedTest;
 
 @Category(DistributedTest.class)
 @RunWith(JUnitParamsRunner.class)
-public class ConfigCommandDUnitTest {
+public class ExportConfigCommandDUnitTest {
   @Rule
   public LocatorServerStartupRule startupRule =
       new LocatorServerStartupRule().withTempWorkingDir().withLogFile();
@@ -57,44 +51,6 @@ public class ConfigCommandDUnitTest {
 
   @Test
   @Parameters({"true", "false"})
-  public void testDescribeConfig(final boolean connectOverHttp) throws Exception {
-    Properties localProps = new Properties();
-    localProps.setProperty(STATISTIC_SAMPLING_ENABLED, "true");
-    localProps.setProperty(ENABLE_TIME_STATISTICS, "true");
-    localProps.setProperty(GROUPS, "G1");
-    MemberVM server0 = startupRule.startServerAsJmxManager(0, localProps);
-
-    if (connectOverHttp) {
-      gfsh.connectAndVerify(server0.getHttpPort(), GfshShellConnectionRule.PortType.http);
-    } else {
-      gfsh.connectAndVerify(server0.getJmxPort(), GfshShellConnectionRule.PortType.jmxManger);
-    }
-
-    server0.invoke(() -> {
-      InternalCache cache = LocatorServerStartupRule.serverStarter.getCache();
-      InternalDistributedSystem system = cache.getInternalDistributedSystem();
-      DistributionConfig config = system.getConfig();
-      config.setArchiveFileSizeLimit(1000);
-    });
-
-    gfsh.executeAndVerifyCommand("describe config --member=" + server0.getName());
-    String result = gfsh.getGfshOutput();
-
-    assertThat(result).containsPattern("enable-time-statistics\\s+: true");
-    assertThat(result).containsPattern("groups\\s+: G1");
-    assertThat(result).containsPattern("archive-file-size-limit\\s+: 1000");
-    assertThat(result).containsPattern("name\\s+: server-0");
-    assertThat(result).containsPattern("is-server\\s+: true");
-    assertThat(result).doesNotContain("copy-on-read");
-
-    gfsh.executeAndVerifyCommand(
-        "describe config --member=" + server0.getName() + " --hide-defaults=false");
-    result = gfsh.getGfshOutput();
-    assertThat(result).contains("copy-on-read");
-  }
-
-  @Test
-  @Parameters({"true", "false"})
   public void testExportConfig(final boolean connectOverHttp) throws Exception {
     Properties props = new Properties();
     props.setProperty(GROUPS, "Group1");

-- 
To stop receiving notification emails like this one, please contact
"commits@geode.apache.org" <co...@geode.apache.org>.