geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kh...@apache.org
Subject [1/2] geode git commit: GEODE-3277: revert changes to Launcher bind address and State constructors
Date Tue, 29 Aug 2017 17:39:29 GMT
Repository: geode
Updated Branches:
  refs/heads/develop 4c5593813 -> 4ac5e65f7


http://git-wip-us.apache.org/repos/asf/geode/blob/4ac5e65f/geode-core/src/test/java/org/apache/geode/distributed/LauncherIntegrationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/LauncherIntegrationTestCase.java
b/geode-core/src/test/java/org/apache/geode/distributed/LauncherIntegrationTestCase.java
index e2d40ec..409a96d 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/LauncherIntegrationTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/LauncherIntegrationTestCase.java
@@ -30,9 +30,7 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.io.UncheckedIOException;
 import java.lang.management.ManagementFactory;
-import java.net.InetAddress;
 import java.net.ServerSocket;
-import java.net.UnknownHostException;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -284,17 +282,9 @@ public abstract class LauncherIntegrationTestCase {
 
   private void givenPortInUse(final int port) {
     try {
-      givenPortInUse(port, InetAddress.getLocalHost());
-    } catch (UnknownHostException e) {
-      throw new UncheckedIOException(e);
-    }
-  }
-
-  private void givenPortInUse(final int port, InetAddress bindAddress) {
-    try {
       socket = SocketCreatorFactory
           .createNonDefaultInstance(false, false, null, null, System.getProperties())
-          .createServerSocket(port, 50, bindAddress, -1);
+          .createServerSocket(port, 50, null, -1);
       assertThat(socket.isBound()).isTrue();
       assertThat(socket.isClosed()).isFalse();
       assertThat(isPortAvailable(port, SOCKET)).isFalse();

http://git-wip-us.apache.org/repos/asf/geode/blob/4ac5e65f/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherRemoteIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherRemoteIntegrationTest.java
b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherRemoteIntegrationTest.java
index 085e4da..cc42a53 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherRemoteIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/LocatorLauncherRemoteIntegrationTest.java
@@ -185,8 +185,8 @@ public class LocatorLauncherRemoteIntegrationTest extends LocatorLauncherRemoteI
     assertThat(locatorState.getStatus()).isEqualTo(NOT_RESPONDING);
     assertThat(locatorState.getClasspath()).isNull();
     assertThat(locatorState.getGemFireVersion()).isEqualTo(GemFireVersion.getGemFireVersion());
-    assertThat(locatorState.getHost()).isEqualTo(InetAddress.getLocalHost().getCanonicalHostName());
-    assertThat(locatorState.getJavaVersion()).isEqualTo(System.getProperty("java.version"));
+    assertThat(locatorState.getHost()).isNull();
+    assertThat(locatorState.getJavaVersion()).isNull();
     assertThat(locatorState.getLogFile()).isNull();
     assertThat(locatorState.getMemberName()).isNull();
     assertThat(locatorState.getPid()).isNull();

http://git-wip-us.apache.org/repos/asf/geode/blob/4ac5e65f/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherRemoteIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherRemoteIntegrationTest.java
b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherRemoteIntegrationTest.java
index 025ad5d..733a108 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherRemoteIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherRemoteIntegrationTest.java
@@ -244,9 +244,9 @@ public class ServerLauncherRemoteIntegrationTest extends ServerLauncherRemoteInt
     assertThat(serverState.getWorkingDirectory()).isEqualTo(getWorkingDirectoryPath());
     assertThat(serverState.getClasspath()).isNull();
     assertThat(serverState.getGemFireVersion()).isEqualTo(GemFireVersion.getGemFireVersion());
-    assertThat(serverState.getJavaVersion()).isEqualTo(System.getProperty("java.version"));
+    assertThat(serverState.getJavaVersion()).isNull();
     assertThat(serverState.getLogFile()).isNull();
-    assertThat(serverState.getHost()).isEqualTo(InetAddress.getLocalHost().getCanonicalHostName());
+    assertThat(serverState.getHost()).isNull();
     assertThat(serverState.getMemberName()).isNull();
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/4ac5e65f/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
index 61d0596..2bcd994 100755
--- a/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/ServerLauncherTest.java
@@ -18,6 +18,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.isNull;
 import static org.mockito.Mockito.atLeast;
 import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
@@ -270,7 +271,7 @@ public class ServerLauncherTest {
 
     launcher.startCacheServer(cache);
 
-    verify(cacheServer, times(1)).setBindAddress(anyString());
+    verify(cacheServer, times(1)).setBindAddress(isNull());
     verify(cacheServer, times(1)).setPort(eq(11235));
     verify(cacheServer, times(1)).start();
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/4ac5e65f/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/GfshStatusCommandsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/GfshStatusCommandsIntegrationTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/GfshStatusCommandsIntegrationTest.java
index 8537777..dd5841f 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/GfshStatusCommandsIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/GfshStatusCommandsIntegrationTest.java
@@ -19,13 +19,13 @@ import static org.assertj.core.api.Assertions.assertThat;
 import java.io.File;
 
 import org.junit.Before;
+import org.junit.ClassRule;
 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.internal.DistributionLocator;
 import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.test.dunit.rules.GfshShellConnectionRule;
 import org.apache.geode.test.dunit.rules.LocatorStarterRule;
@@ -33,7 +33,8 @@ import org.apache.geode.test.junit.categories.IntegrationTest;
 
 @Category(IntegrationTest.class)
 public class GfshStatusCommandsIntegrationTest {
-  private static final String LOCATOR_NAME = "locator1";
+  final private static String LOCATOR_NAME = "locator1";
+  // private int port;
 
   @Rule
   public LocatorStarterRule locator =
@@ -51,48 +52,37 @@ public class GfshStatusCommandsIntegrationTest {
 
   @Before
   public void connect() throws Exception {
+    // port = getRandomAvailablePort(SOCKET);
     gfsh.connectAndVerify(locator);
   }
 
   @Test
-  public void statusLocatorWithBadPort_statusNotResponding() throws Exception {
-    String wrongPort = String.valueOf(locator.getLocator().getPort() - 1);
-    CommandResult result =
-        gfsh.executeCommand("status locator --host=localhost --port=" + wrongPort);
-    assertThat(result.getContent().getString("message")).doesNotContain("null");
+  public void statusLocatorWithBadPortReportsNotResponding() throws Exception {
+    CommandResult result = gfsh.executeCommand("status locator --host=localhost --port="
+        + String.valueOf(locator.getLocator().getPort() - 1));
     assertThat(result.getContent().getString("message")).contains("not responding");
-    assertThat(result.getContent().getString("message")).contains(wrongPort);
   }
 
   @Test
-  public void statusLocatorDefault_LocatorOnNonDefaultPort_statusNotResponding() throws Exception
{
-    CommandResult result = gfsh.executeCommand("status locator --host=localhost");
-    assertThat(result.getContent().getString("message")).doesNotContain("null");
-    assertThat(result.getContent().getString("message")).contains("not responding");
-    assertThat(result.getContent().getString("message"))
-        .contains(String.valueOf(DistributionLocator.DEFAULT_LOCATOR_PORT));
-  }
-
-  @Test
-  public void statusLocatorWithActivePort_statusOnline() throws Exception {
+  public void statusLocatorWithActivePortReportsOnline() throws Exception {
     CommandResult result = gfsh.executeCommand(
         "status locator --host=localhost --port=" + String.valueOf(locator.getLocator().getPort()));
     assertThat(result.getContent().getString("message")).contains("is currently online");
   }
 
   @Test
-  public void statusServerNoServer_statusNotResponding() throws Exception {
+  public void statusServerWithWithNoOptions() throws Exception {
+    File serverDir = new File(temporaryFolder.getRoot(), "serverDir");
+    serverDir.mkdirs();
     CommandResult result = gfsh.executeCommand("status server");
-    assertThat(result.getContent().getString("message")).doesNotContain("null");
     assertThat(result.getContent().getString("message")).contains("not responding");
   }
 
   @Test
-  public void statusServerWithEmptyDir_statusNotResponding() throws Exception {
+  public void statusServerWithInvalidDirReturnsMeangingfulMessage() throws Exception {
     File serverDir = new File(temporaryFolder.getRoot(), "serverDir");
     serverDir.mkdirs();
     CommandResult result = gfsh.executeCommand("status server --dir=" + serverDir.toString());
-    assertThat(result.getContent().getString("message")).doesNotContain("null");
     assertThat(result.getContent().getString("message")).contains("not responding");
   }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/4ac5e65f/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
index dc17d03..e7f17ef 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
@@ -44,12 +44,12 @@ import org.apache.geode.test.junit.rules.DescribedExternalResource;
  *
  * you can use this as Rule
  * 
- * @Rule GfshShellConnectionRule rule = new GfshShellConnectionRule(); then after you connect
to a
+ * @Rule GfshShellConnectionRule rule = new GfshSheelConnectionRule(); then after you connect
to a
  *       locator, you don't have to call disconnect() or close() at all, since the rule's
after
  *       takes care of it for you.
  *
  *       Or as a ClassRule
- * @ClassRule GfshShellConnectionRule rule = new GfshShellConnectionRule(); When using as
a
+ * @ClassRule GfshShellConnectionRule rule = new GfshSheelConnectionRule(); When using as
a
  *            ClassRule, if you call connect in a test, you will need to call disconnect
after the
  *            test as well. See NetstatDUnitTest for example.
  *


Mime
View raw message