accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1477782 - in /accumulo/branches/1.5: proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
Date Tue, 30 Apr 2013 19:20:56 GMT
Author: ecn
Date: Tue Apr 30 19:20:55 2013
New Revision: 1477782

URL: http://svn.apache.org/r1477782
Log:
ACCUMULO-1365 use the MAC mechanism for finding a random port

Modified:
    accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
    accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java

Modified: accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java?rev=1477782&r1=1477781&r2=1477782&view=diff
==============================================================================
--- accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java (original)
+++ accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java Tue
Apr 30 19:20:55 2013
@@ -128,8 +128,7 @@ public class SimpleTest {
     protocolFactories.add(org.apache.thrift.protocol.TTupleProtocol.Factory.class);
     protocolFactories.add(org.apache.thrift.protocol.TCompactProtocol.Factory.class);
     
-    Random rand = new Random();
-    return protocolFactories.get(rand.nextInt(protocolFactories.size()));
+    return protocolFactories.get(random.nextInt(protocolFactories.size()));
   }
   
   @BeforeClass
@@ -146,7 +145,7 @@ public class SimpleTest {
     protocolClass = getRandomProtocol();
     System.out.println(protocolClass.getName());
     
-    proxyPort = 40000 + random.nextInt(20000);
+    proxyPort = MiniAccumuloCluster.getRandomFreePort();
     proxyServer = Proxy.createProxyServer(org.apache.accumulo.proxy.thrift.AccumuloProxy.class,
org.apache.accumulo.proxy.ProxyServer.class, proxyPort,
         protocolClass, props);
     thread = new Thread() {

Modified: accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java?rev=1477782&r1=1477781&r2=1477782&view=diff
==============================================================================
--- accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
(original)
+++ accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
Tue Apr 30 19:20:55 2013
@@ -121,7 +121,7 @@ public class MiniAccumuloCluster {
   private MiniAccumuloConfig config;
   private Process[] tabletServerProcesses;
   
-  private int getRandomFreePort() {
+  static public int getRandomFreePort() {
     Random r = new Random();
     int count = 0;
     



Mime
View raw message