cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1381675 - /cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/TestUtil.java
Date Thu, 06 Sep 2012 16:40:52 GMT
Author: dkulp
Date: Thu Sep  6 16:40:52 2012
New Revision: 1381675

URL: http://svn.apache.org/viewvc?rev=1381675&view=rev
Log:
Allow resetting of a port to reuse later

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

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=1381675&r1=1381674&r2=1381675&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 Thu Sep
 6 16:40:52 2012
@@ -122,6 +122,24 @@ public final class TestUtil {
     public static String getPortNumber(String name) {
         return getPortNumber(name, name);
     }
+    
+    public static String getNewPortNumber(Class<?> cls) {
+        return getNewPortNumber(cls.getName(), cls.getSimpleName());
+    }
+    public static String getNewPortNumber(Class<?> cls, int count) {
+        return getNewPortNumber(cls.getName() + "." + count,
+                             cls.getSimpleName() + "." + count);
+    }
+    public static String getNewPortNumber(String name) {
+        return getNewPortNumber(name, name);
+    }
+    public static String getNewPortNumber(String fullName, String simpleName) {
+        ports.remove("testutil.ports." + fullName);
+        ports.remove("testutil.ports." + simpleName);
+        System.clearProperty("testutil.ports." + fullName);
+        System.clearProperty("testutil.ports." + simpleName);        
+        return getPortNumber(fullName, simpleName);
+    }    
     public static String getPortNumber(String fullName, String simpleName) {
         String p = ports.getProperty("testutil.ports." + fullName);
         if (p == null) {



Mime
View raw message