geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject [2/2] incubator-geode git commit: GEODE-1227: Replaced all port selections for server with '0' instead of getting the port from the AvailablePortHelper. Some refactoring introducing Lambdas. Some refactoring replacing Wait.wait with Awaitility.
Date Thu, 21 Apr 2016 18:25:32 GMT
GEODE-1227: Replaced all port selections for server with '0' instead of getting the port from
the AvailablePortHelper.
Some refactoring introducing Lambdas.
Some refactoring replacing Wait.wait with Awaitility.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/b5ff9742
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/b5ff9742
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/b5ff9742

Branch: refs/heads/develop
Commit: b5ff97423508837bd60c3b19d313f4a96764cedb
Parents: 0d0e706
Author: Udo Kohlmeyer <ukohlmeyer@pivotal.io>
Authored: Thu Apr 21 11:39:55 2016 +1000
Committer: Udo Kohlmeyer <ukohlmeyer@pivotal.io>
Committed: Fri Apr 22 04:24:57 2016 +1000

----------------------------------------------------------------------
 .../cli/commands/CliCommandTestBase.java        |   93 +-
 .../cli/commands/ClientCommandsDUnitTest.java   | 1757 +++++++-----------
 2 files changed, 753 insertions(+), 1097 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b5ff9742/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
index 4d651a2..acb07ca 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CliCommandTestBase.java
@@ -16,21 +16,6 @@
  */
 package com.gemstone.gemfire.management.internal.cli.commands;
 
-import static com.gemstone.gemfire.test.dunit.Assert.*;
-import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
-
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
@@ -43,10 +28,20 @@ import com.gemstone.gemfire.management.internal.cli.result.CommandResult;
 import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
 import com.gemstone.gemfire.management.internal.cli.util.CommandStringBuilder;
 import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.SerializableCallable;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
 
+import java.io.IOException;
+import java.io.PrintStream;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Map;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
+
 /**
  * Base class for all the CLI/gfsh command dunit tests.
  */
@@ -72,7 +67,7 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
     preTearDownCliCommandTestBase();
     destroyDefaultSetup();
   }
-  
+
   protected void preTearDownCliCommandTestBase() throws Exception {
   }
 
@@ -89,41 +84,38 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
    */
   @SuppressWarnings("serial")
   protected final HeadlessGfsh createDefaultSetup(final Properties props) {
-    Object[] result = (Object[]) Host.getHost(0).getVM(0).invoke(new SerializableCallable()
{
-      public Object call() {
-        final Object[] result = new Object[3];
-        final Properties localProps = (props != null ? props : new Properties());
-
-        try {
-          jmxHost = InetAddress.getLocalHost().getHostName();
-        } catch (UnknownHostException ignore) {
-          jmxHost = "localhost";
-        }
-
-        if (!localProps.containsKey(DistributionConfig.NAME_NAME)) {
-          localProps.setProperty(DistributionConfig.NAME_NAME, "Manager");
-        }
+    Object[] result = Host.getHost(0).getVM(0).invoke("create Default setup",() -> {
+      final Object[] returnValue = new Object[3];
+      final Properties localProps = (props != null ? props : new Properties());
+
+      try {
+        jmxHost = InetAddress.getLocalHost().getHostName();
+      } catch (UnknownHostException ignore) {
+        jmxHost = "localhost";
+      }
 
-        final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+      if (!localProps.containsKey(DistributionConfig.NAME_NAME)) {
+        localProps.setProperty(DistributionConfig.NAME_NAME, "Manager");
+      }
+      final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
 
-        jmxPort = ports[0];
-        httpPort = ports[1];
+      jmxPort = ports[0];
+      httpPort = ports[1];
 
-        localProps.setProperty(DistributionConfig.JMX_MANAGER_NAME, "true");
-        localProps.setProperty(DistributionConfig.JMX_MANAGER_START_NAME, "true");
-        localProps.setProperty(DistributionConfig.JMX_MANAGER_BIND_ADDRESS_NAME, String.valueOf(jmxHost));
-        localProps.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, String.valueOf(jmxPort));
-        localProps.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
+      localProps.setProperty(DistributionConfig.JMX_MANAGER_NAME, "true");
+      localProps.setProperty(DistributionConfig.JMX_MANAGER_START_NAME, "true");
+      localProps.setProperty(DistributionConfig.JMX_MANAGER_BIND_ADDRESS_NAME, String.valueOf(jmxHost));
+      localProps.setProperty(DistributionConfig.JMX_MANAGER_PORT_NAME, String.valueOf(jmxPort));
+      localProps.setProperty(DistributionConfig.HTTP_SERVICE_PORT_NAME, String.valueOf(httpPort));
 
-        getSystem(localProps);
-        verifyManagementServiceStarted(getCache());
+      getSystem(localProps);
+      verifyManagementServiceStarted(getCache());
 
-        result[0] = jmxHost;
-        result[1] = jmxPort;
-        result[2] = httpPort;
+      returnValue[0] = jmxHost;
+      returnValue[1] = jmxPort;
+      returnValue[2] = httpPort;
 
-        return result;
-      }
+      return returnValue;
     });
 
     this.jmxHost = (String) result[0];
@@ -150,11 +142,7 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase
{
 
     disconnectAllFromDS();
 
-    Host.getHost(0).getVM(0).invoke(new SerializableRunnable() {
-      public void run() {
-        verifyManagementServiceStopped();
-      }
-    });
+    Host.getHost(0).getVM(0).invoke("verify service stopped", () -> verifyManagementServiceStopped());
   }
 
   /**
@@ -176,7 +164,6 @@ public abstract class CliCommandTestBase extends JUnit4CacheTestCase {
     try {
       manager = CommandManager.getInstance();
       Map<String, CommandTarget> commands = manager.getCommands();
-      Set set = commands.keySet();
       if (commands.size() < 1) {
         return false;
       }


Mime
View raw message