You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/03/18 17:28:31 UTC

[8/8] incubator-geode git commit: Merge remote-tracking branch 'origin/develop' into feature/GEODE-1050

Merge remote-tracking branch 'origin/develop' into feature/GEODE-1050


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

Branch: refs/heads/feature/GEODE-1050
Commit: 8f280aae41d829929866b34d96b3eb2ccf56c9f9
Parents: abb26af 8c690ac
Author: Kirk Lund <kl...@apache.org>
Authored: Fri Mar 18 09:28:14 2016 -0700
Committer: Kirk Lund <kl...@apache.org>
Committed: Fri Mar 18 09:28:14 2016 -0700

----------------------------------------------------------------------
 .../membership/gms/membership/GMSJoinLeave.java | 14 ++++--
 .../gms/messages/InstallViewMessage.java        |  7 ---
 .../gms/messenger/JGroupsMessenger.java         |  1 +
 .../internal/cache/GemFireCacheImpl.java        |  4 ++
 .../internal/i18n/ParentLocalizedStrings.java   |  2 +-
 .../internal/logging/LogWriterFactory.java      |  5 +--
 .../logging/log4j/LogWriterAppenders.java       |  4 +-
 .../distributed/DistributedSystemDUnitTest.java | 45 ++++++++++++++++----
 .../internal/DistributionManagerDUnitTest.java  |  2 +-
 .../gms/membership/GMSJoinLeaveJUnitTest.java   | 40 +++++++++--------
 .../internal/logging/TestLogWriterFactory.java  |  3 --
 .../sockets/DurableClientSimpleDUnitTest.java   | 15 ++++---
 12 files changed, 90 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8f280aae/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java
index 26cdf85,610be11..a0ee443
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java
@@@ -314,27 -316,54 +314,56 @@@ public class DistributedSystemDUnitTes
      assertTrue(unicastPort <= idm.getPort() && idm.getPort() <= unicastPort+2);
      assertTrue(unicastPort <= idm.getPort() && idm.getDirectChannelPort() <= unicastPort+2);
    }
+   
+   /***
+    * this will return starting port, from it "range" of port will available
+    * @param range
+    * @return
+    */
+   private int getPortRange(int range) {
+     int port = DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[0] + 10000;
+     int startPort = port;
+     int found = 0;
+     while (port <= DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[1]) {
+       if (AvailablePort.isPortAvailable(port, AvailablePort.SOCKET)) {
+         found++;
+         if (found == range) {
+           break;
+         }
+         port++;
+       } else {
+         port++;
+         startPort = port;
+         found = 0;
+       }
+     }
+     if (port > DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[1]) {
+       fail("Unable to find port range " + range);
+     }
+     return startPort;
+   }
  
 +  @Test
    public void testMembershipPortRangeWithExactThreeValues() throws Exception {
      Properties config = new Properties();
-     config.setProperty("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
-     config.setProperty(DistributionConfig.MEMBERSHIP_PORT_RANGE_NAME, ""
-         + (DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[1] - 2) + "-"
-         + (DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[1]));
+     config.setProperty("locators", "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
+     int portRange = 3;
+     int portStartRange = getPortRange(portRange);
+     int portEndRange = portStartRange + portRange - 1;
+     config.setProperty(DistributionConfig.MEMBERSHIP_PORT_RANGE_NAME, "" + (portStartRange) + "-" + (portEndRange));
 -    system = (InternalDistributedSystem) DistributedSystem.connect(config);
 +    InternalDistributedSystem system = getSystem(config);
      Cache cache = CacheFactory.create(system);
      cache.addCacheServer();
      DistributionManager dm = (DistributionManager) system.getDistributionManager();
      InternalDistributedMember idm = dm.getDistributionManagerId();
      system.disconnect();
-     assertTrue(idm.getPort() <= DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[1]);
-     assertTrue(idm.getPort() >= DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[0]);
-     assertTrue(idm.getDirectChannelPort() <= DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[1]);
-     assertTrue(idm.getDirectChannelPort() >= DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[0]);
+     assertTrue(idm.getPort() <= portEndRange);
+     assertTrue(idm.getPort() >= portStartRange);
+     assertTrue(idm.getDirectChannelPort() <= portEndRange);
+     assertTrue(idm.getDirectChannelPort() >= portStartRange);
    }
  
 +  @Test
    public void testConflictingUDPPort() throws Exception {
      final Properties config = new Properties();
      final int mcastPort = AvailablePort.getRandomAvailablePort(AvailablePort.MULTICAST);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8f280aae/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java
----------------------------------------------------------------------