cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r952734 - in /cxf/trunk: parent/pom.xml testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java
Date Tue, 08 Jun 2010 16:57:47 GMT
Author: dkulp
Date: Tue Jun  8 16:57:46 2010
New Revision: 952734

URL: http://svn.apache.org/viewvc?rev=952734&view=rev
Log:
Only use full dynamic ports within maven.  In Eclipse or other,
just start at 9000 and count up ot make it easier in wireshark
and such to find the data.

Modified:
    cxf/trunk/parent/pom.xml
    cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java

Modified: cxf/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/parent/pom.xml?rev=952734&r1=952733&r2=952734&view=diff
==============================================================================
--- cxf/trunk/parent/pom.xml (original)
+++ cxf/trunk/parent/pom.xml Tue Jun  8 16:57:46 2010
@@ -252,6 +252,7 @@
                         <argLine>${surefire.fork.vmargs}</argLine>
                         <parallel>${surefire.parallel.mode}</parallel>
                         <systemPropertyVariables>
+                                <useRandomPorts>true</useRandomPorts>
                                 <cxf.validateServiceSchemas>${cxf.validateServices}</cxf.validateServiceSchemas>
                                 <java.awt.headless>${java.awt.headless}</java.awt.headless>
                                 <java.util.logging.config.file>${basedir}/target/test-classes/logging.properties</java.util.logging.config.file>

Modified: cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java?rev=952734&r1=952733&r2=952734&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java (original)
+++ cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java Tue Jun
 8 16:57:46 2010
@@ -30,7 +30,9 @@ import java.util.Properties;
 
 
 public final class TestUtil {
-    static Properties ports = new Properties();
+    private static boolean useRandomPorts = Boolean.getBoolean("useRandomPorts");
+    private static int portNum = 9000;
+    private static Properties ports = new Properties();
     
     private TestUtil() {
         //Complete
@@ -96,15 +98,19 @@ public final class TestUtil {
             }
         }
         if (p == null) {
-            try {
-                ServerSocket sock = new ServerSocket(0);
-                p = Integer.toString(sock.getLocalPort());
-                ports.put("testutil.ports." + name, p);
-                System.setProperty("testutil.ports." + name, p);
-                sock.close();
-            } catch (IOException ex) {
-                //
+            if (useRandomPorts) {
+                try {
+                    ServerSocket sock = new ServerSocket(0);
+                    p = Integer.toString(sock.getLocalPort());
+                    sock.close();
+                } catch (IOException ex) {
+                    //
+                }
+            } else {
+                p = Integer.toString(portNum++);
             }
+            ports.put("testutil.ports." + name, p);
+            System.setProperty("testutil.ports." + name, p);
         }
         return p;
     }



Mime
View raw message