You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by go...@apache.org on 2018/08/01 23:36:22 UTC

[geode] branch develop updated: GEODE-5479 - Fix usage of AvailablePortHelper (#2206)

This is an automated email from the ASF dual-hosted git repository.

gosullivan pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new dcf6b8c  GEODE-5479 - Fix usage of AvailablePortHelper (#2206)
dcf6b8c is described below

commit dcf6b8cf0cd0f506ac708bf04cab74dbeb8844c2
Author: pivotal-amurmann <am...@pivotal.io>
AuthorDate: Wed Aug 1 16:36:17 2018 -0700

    GEODE-5479 - Fix usage of AvailablePortHelper (#2206)
    
    We were getting two separate random ports and not validating that the
    ports are actually distinct. This change gets both ports at the same time
    and thus ensures uniqueness.
---
 .../rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java      | 5 +++--
 .../RegionChangesPersistThroughClusterConfigurationDUnitTest.java    | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/geode-assembly/src/distributedTest/java/org/apache/geode/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java b/geode-assembly/src/distributedTest/java/org/apache/geode/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
index a89aa55..662db12 100644
--- a/geode-assembly/src/distributedTest/java/org/apache/geode/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
+++ b/geode-assembly/src/distributedTest/java/org/apache/geode/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
@@ -404,8 +404,9 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
             ids.disconnect();
           }
           // try a different port
-          int httpServicePort = AvailablePortHelper.getRandomAvailableTCPPort();
-          int jmxManagerPort = AvailablePortHelper.getRandomAvailableTCPPort();
+          int[] randomPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+          int httpServicePort = randomPorts[0];
+          int jmxManagerPort = randomPorts[1];
           props.setProperty(HTTP_SERVICE_PORT, Integer.toString(httpServicePort));
           props.setProperty(JMX_MANAGER_PORT, Integer.toString(jmxManagerPort));
           System.out.println("Try a different http-service-port " + httpServicePort);
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/RegionChangesPersistThroughClusterConfigurationDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/RegionChangesPersistThroughClusterConfigurationDUnitTest.java
index 316fb89..28fc4a1 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/RegionChangesPersistThroughClusterConfigurationDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/RegionChangesPersistThroughClusterConfigurationDUnitTest.java
@@ -59,8 +59,9 @@ public class RegionChangesPersistThroughClusterConfigurationDUnitTest {
 
   @Before
   public void setup() throws Exception {
-    int jmxPort = AvailablePortHelper.getRandomAvailableTCPPort();
-    int httpPort = AvailablePortHelper.getRandomAvailableTCPPort();
+    int[] randomPorts = AvailablePortHelper.getRandomAvailableTCPPorts(2);
+    int jmxPort = randomPorts[0];
+    int httpPort = randomPorts[1];
     Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOG_LEVEL, "fine");