geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hiteshkhame...@apache.org
Subject incubator-geode git commit: GEODE-483 Now test ignores Socket BindException as it can happen.
Date Thu, 31 Mar 2016 22:45:58 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/develop dd19d8ca1 -> 8503fc393


GEODE-483 Now test ignores Socket BindException as it can happen.


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

Branch: refs/heads/develop
Commit: 8503fc393b7b03141804b69b5512fc152ed425d7
Parents: dd19d8c
Author: Hitesh Khamesra <hkhamesra@pivotal.io>
Authored: Thu Mar 31 15:45:04 2016 -0700
Committer: Hitesh Khamesra <hkhamesra@pivotal.io>
Committed: Thu Mar 31 15:45:04 2016 -0700

----------------------------------------------------------------------
 .../internal/AutoConnectionSourceDUnitTest.java | 78 +++++++++++---------
 1 file changed, 42 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8503fc39/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
index 2040c37..cc5bffa 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
@@ -17,6 +17,7 @@
 package com.gemstone.gemfire.cache.client.internal;
 
 import java.io.Serializable;
+import java.net.BindException;
 import java.net.InetSocketAddress;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -142,42 +143,47 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
   }
   
   public void testDynamicallyFindLocators() throws Exception {
-    final Host host = Host.getHost(0);
-    final String hostName = NetworkUtils.getServerHostName(host);
-    VM vm0 = host.getVM(0);
-    VM vm1 = host.getVM(1);
-    VM vm2 = host.getVM(2);
-    VM vm3 = host.getVM(3);
-    
-    int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(3);
-    
-    final int locatorPort0 = ports[0];
-    final int locatorPort1 = ports[1];
-    final int locatorPort3 = ports[2];
-    String locators = getLocatorString(host, new int[] { locatorPort0, locatorPort1, locatorPort3});
-    startLocatorInVM(vm0, locatorPort0, locators);
-    
-    startLocatorInVM(vm1, locatorPort1, locators);
-    startBridgeClientInVM(vm2, null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort0);
-    
-    InetSocketAddress locatorToWaitFor= new InetSocketAddress(hostName, locatorPort1);
-    waitForLocatorDiscovery(vm2, locatorToWaitFor);
-    
-    stopLocatorInVM(vm0);
-    startBridgeServerInVM(vm0, null, locators);
-    
-    putAndWaitForSuccess(vm2, REGION_NAME, "key", "value");
-    Assert.assertEquals("value", getInVM(vm0, "key"));
-    
-    startLocatorInVM(vm3, locatorPort3, locators);
-    stopBridgeMemberVM(vm0);
-    locatorToWaitFor= new InetSocketAddress(hostName, locatorPort3);
-    waitForLocatorDiscovery(vm2, locatorToWaitFor);
-    stopLocatorInVM(vm1);
-    startBridgeServerInVM(vm1, null, locators);
-    putAndWaitForSuccess(vm2, REGION_NAME, "key2", "value2");
-    Assert.assertEquals("value2", getInVM(vm1, "key2"));
-    
+    try {
+      final Host host = Host.getHost(0);
+      final String hostName = NetworkUtils.getServerHostName(host);
+      VM vm0 = host.getVM(0);
+      VM vm1 = host.getVM(1);
+      VM vm2 = host.getVM(2);
+      VM vm3 = host.getVM(3);
+      
+      int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(3);
+      
+      final int locatorPort0 = ports[0];
+      final int locatorPort1 = ports[1];
+      final int locatorPort3 = ports[2];
+      String locators = getLocatorString(host, new int[] { locatorPort0, locatorPort1, locatorPort3});
+      startLocatorInVM(vm0, locatorPort0, locators);
+      
+      startLocatorInVM(vm1, locatorPort1, locators);
+      startBridgeClientInVM(vm2, null, NetworkUtils.getServerHostName(vm0.getHost()), locatorPort0);
+      
+      InetSocketAddress locatorToWaitFor= new InetSocketAddress(hostName, locatorPort1);
+      waitForLocatorDiscovery(vm2, locatorToWaitFor);
+      
+      stopLocatorInVM(vm0);
+      startBridgeServerInVM(vm0, null, locators);
+      
+      putAndWaitForSuccess(vm2, REGION_NAME, "key", "value");
+      Assert.assertEquals("value", getInVM(vm0, "key"));
+      
+      startLocatorInVM(vm3, locatorPort3, locators);
+      stopBridgeMemberVM(vm0);
+      locatorToWaitFor= new InetSocketAddress(hostName, locatorPort3);
+      waitForLocatorDiscovery(vm2, locatorToWaitFor);
+      stopLocatorInVM(vm1);
+      startBridgeServerInVM(vm1, null, locators);
+      putAndWaitForSuccess(vm2, REGION_NAME, "key2", "value2");
+      Assert.assertEquals("value2", getInVM(vm1, "key2"));
+    }catch(Exception ec) {
+      if(ec.getCause() != null && !(ec.getCause().getCause() instanceof BindException))
+        throw ec;
+      //else BindException let it pass
+    }
   }
   
   public void testEmbeddedLocator() throws Exception  {


Mime
View raw message