You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by hi...@apache.org on 2016/08/24 17:27:35 UTC

[1/2] incubator-geode git commit: GEODE-1198 Now test make sure ports are available for port range

Repository: incubator-geode
Updated Branches:
  refs/heads/develop fb39f889a -> 8c85ef959


GEODE-1198 Now test make sure ports are available for port range


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

Branch: refs/heads/develop
Commit: 8c85ef959458aaa91a925132a68e3ce06ec95f89
Parents: 7454c3f
Author: Hitesh Khamesra <hi...@yahoo.com>
Authored: Wed Aug 24 10:24:44 2016 -0700
Committer: Hitesh Khamesra <hi...@yahoo.com>
Committed: Wed Aug 24 10:26:51 2016 -0700

----------------------------------------------------------------------
 .../gemfire/distributed/DistributedSystemDUnitTest.java        | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8c85ef95/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java
index 1be3b9f..c6fa5a2 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java
@@ -361,10 +361,10 @@ public class DistributedSystemDUnitTest extends JUnit4DistributedTestCase {
   public void testConflictingUDPPort() throws Exception {
     final Properties config = new Properties();
     final int mcastPort = AvailablePort.getRandomAvailablePort(AvailablePort.MULTICAST);
-    final int[] socketPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2, true);
-    final int unicastPort = socketPorts[0];
+    final int[] socketPorts = AvailablePortHelper.getRandomAvailableTCPPorts(1, true);
+    final int unicastPort = getPortRange(3);
     config.setProperty(MCAST_PORT, String.valueOf(mcastPort));
-    config.setProperty(START_LOCATOR, "localhost[" + socketPorts[1] + "]");
+    config.setProperty(START_LOCATOR, "localhost[" + socketPorts[0] + "]");
     config.setProperty(MEMBERSHIP_PORT_RANGE,
         ""+unicastPort+"-"+(unicastPort+2));
     InternalDistributedSystem system = (InternalDistributedSystem)DistributedSystem.connect(config);


[2/2] incubator-geode git commit: GEODE-838 Test now uses port 0 for cacheServer

Posted by hi...@apache.org.
GEODE-838 Test now uses port 0 for cacheServer


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

Branch: refs/heads/develop
Commit: 7454c3fd35d4e818ca3a83e5b8def8503ea30717
Parents: fb39f88
Author: Hitesh Khamesra <hi...@yahoo.com>
Authored: Wed Aug 24 10:22:44 2016 -0700
Committer: Hitesh Khamesra <hi...@yahoo.com>
Committed: Wed Aug 24 10:26:51 2016 -0700

----------------------------------------------------------------------
 .../security/ClientAuthenticationTestCase.java  | 33 ++++++++++----------
 1 file changed, 16 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7454c3fd/geode-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationTestCase.java
index d7c75c7..7e6d022 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/ClientAuthenticationTestCase.java
@@ -453,17 +453,16 @@ public abstract class ClientAuthenticationTestCase extends JUnit4DistributedTest
 
     // Try to connect client1 with no credentials
     // Verify that the creation of region throws security exception
-    server1.invoke(() -> createCacheServer(locPort1, locString, port1, authenticator, extraProps, javaProps));
-
+    final int p = server1.invoke(() -> createCacheServer(locPort1, locString, 0, authenticator, extraProps, javaProps));
     if (gen.classCode().equals(CredentialGenerator.ClassCode.SSL)) {
       // For SSL the exception may not come since the server can close socket
       // before handshake message is sent from client. However exception
       // should come in any region operations.
-      client1.invoke(() -> createCacheClient(null, null, null, port1, port2, zeroConns, multiUser, NOFORCE_AUTHREQ_EXCEPTION));
+      client1.invoke(() -> createCacheClient(null, null, null, p, port2, zeroConns, multiUser, NOFORCE_AUTHREQ_EXCEPTION));
       client1.invoke(() -> doPuts(2, OTHER_EXCEPTION));
 
     } else {
-      client1.invoke(() -> createCacheClient(null, null, null, port1, port2, zeroConns, multiUser, AUTHREQ_EXCEPTION));
+      client1.invoke(() -> createCacheClient(null, null, null, p, port2, zeroConns, multiUser, AUTHREQ_EXCEPTION));
     }
 
     // Now try to connect client2 with invalid credentials
@@ -472,23 +471,23 @@ public abstract class ClientAuthenticationTestCase extends JUnit4DistributedTest
     javaProps2 = gen.getJavaProperties();
     getLogWriter().info("testCredentialsForNotifications: For second client invalid credentials: " + credentials2 + " : " + javaProps2);
 
-    createClient2WithException(multiUser, authInit, port1, port2, credentials2, javaProps2, zeroConns);
+    createClient2WithException(multiUser, authInit, p, port2, credentials2, javaProps2, zeroConns);
 
     // Now try to connect client2 with invalid auth-init method
     // Trying to create the region on client with valid credentials should
     // throw a security exception
-    client2.invoke(() -> createCacheClient("com.gemstone.none", credentials1, javaProps1, port1, port2, zeroConns, multiUser, SECURITY_EXCEPTION));
+    client2.invoke(() -> createCacheClient("com.gemstone.none", credentials1, javaProps1, p, port2, zeroConns, multiUser, SECURITY_EXCEPTION));
 
     // Try connection with null auth-init on clients.
     // Skip this test for a scheme which does not have an authInit in the
     // first place (e.g. SSL).
     if (authInit != null && authInit.length() > 0) {
-      server1.invoke(() -> createCacheServer(locPort1, locString, port1, authenticator, extraProps, javaProps));
-      server2.invoke(() -> createCacheServer(locPort2, locString, port2, authenticator, extraProps, javaProps));
-      client1.invoke(() -> createCacheClient(null, credentials1, javaProps1, port1, port2, 0, multiUser, AUTHREQ_EXCEPTION));
+      final int p1 = server1.invoke(() -> createCacheServer(locPort1, locString, 0, authenticator, extraProps, javaProps));
+      final int p2 = server2.invoke(() -> createCacheServer(locPort2, locString, 0, authenticator, extraProps, javaProps));
+      client1.invoke(() -> createCacheClient(null, credentials1, javaProps1, p1, p2, 0, multiUser, AUTHREQ_EXCEPTION));
 
-      createClient2AuthReqException(multiUser, port1, port2, credentials2, javaProps2, zeroConns);
-      createClient2AuthReqException(multiUser, port1, port2, credentials2, javaProps2, zeroConns);
+      createClient2AuthReqException(multiUser, p1, p2, credentials2, javaProps2, zeroConns);
+      createClient2AuthReqException(multiUser, p1, p2, credentials2, javaProps2, zeroConns);
 
     } else {
       getLogWriter().info("testCredentialsForNotifications: Skipping null authInit for scheme [" + gen.classCode() + "] which has no authInit");
@@ -499,11 +498,11 @@ public abstract class ClientAuthenticationTestCase extends JUnit4DistributedTest
     // If the scheme does not have an authenticator in the first place (e.g.
     // SSL) then skip it since this test is useless.
     if (authenticator != null && authenticator.length() > 0) {
-      server1.invoke(() -> createCacheServer(locPort1, locString, port1, null, extraProps, javaProps));
-      server2.invoke(() -> createCacheServer(locPort2, locString, port2, null, extraProps, javaProps));
+      final int p1 = server1.invoke(() -> createCacheServer(locPort1, locString, 0, null, extraProps, javaProps));
+      final int p2 = server2.invoke(() -> createCacheServer(locPort2, locString, 0, null, extraProps, javaProps));
 
-      createClient1NoException(multiUser, authInit, port1, port2, credentials1, javaProps1);
-      createClient2NoException(multiUser, authInit, port1, port2, credentials2, javaProps2, zeroConns);
+      createClient1NoException(multiUser, authInit, p1, p2, credentials1, javaProps1);
+      createClient2NoException(multiUser, authInit, p1, p2, credentials2, javaProps2, zeroConns);
 
       // Register interest on all keys on second client
       client2.invoke(() -> registerAllInterest());
@@ -515,8 +514,8 @@ public abstract class ClientAuthenticationTestCase extends JUnit4DistributedTest
       client2.invoke(() -> doLocalGets(4));
 
       // Now also try with valid credentials on client2
-      createClient1NoException(multiUser, authInit, port1, port2, credentials2, javaProps2);
-      createClient2NoException(multiUser, authInit, port1, port2, credentials1, javaProps1, zeroConns);
+      createClient1NoException(multiUser, authInit, p1, p2, credentials2, javaProps2);
+      createClient2NoException(multiUser, authInit, p1, p2, credentials1, javaProps1, zeroConns);
 
       // Register interest on all keys on second client
       client2.invoke(() -> registerAllInterest());