You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by kr...@apache.org on 2010/07/20 09:11:57 UTC

svn commit: r965737 - in /db/derby/code/branches/10.6: ./ java/testing/org/apache/derbyTesting/junit/TestConfiguration.java

Author: kristwaa
Date: Tue Jul 20 07:11:56 2010
New Revision: 965737

URL: http://svn.apache.org/viewvc?rev=965737&view=rev
Log:
DERBY-4700: Add method to obtain a bogus port in TestConfiguration

Merged fix from trunk (revision 964115).

Modified:
    db/derby/code/branches/10.6/   (props changed)
    db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java

Propchange: db/derby/code/branches/10.6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 20 07:11:56 2010
@@ -1,2 +1,2 @@
-/db/derby/code/trunk:938547,938796,938959,939231,940462,940469,941627,942031,942286,942476,942480,942587,944152,946794,948045,948069,951346,951366,952138,952237,952581,954344,954421,954544,954748,955001,955540,955634,956075,956234,956445,956569,956659,957260,958163,958522,958618,958939,959550,962716,963705
+/db/derby/code/trunk:938547,938796,938959,939231,940462,940469,941627,942031,942286,942476,942480,942587,944152,946794,948045,948069,951346,951366,952138,952237,952581,954344,954421,954544,954748,955001,955540,955634,956075,956234,956445,956569,956659,957260,958163,958522,958618,958939,959550,962716,963705,964115
 /db/derby/docs/trunk:954344

Modified: db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java?rev=965737&r1=965736&r2=965737&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java (original)
+++ db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/junit/TestConfiguration.java Tue Jul 20 07:11:56 2010
@@ -76,13 +76,14 @@ public final class TestConfiguration {
      * page at  http://wiki.apache.org/db-derby/DerbyJUnitTesting
      * need to be updated. 
      */
-    private final static int MAX_PORTS_USED = 10;
+    private final static int MAX_PORTS_USED = 20;
     
     /** This is the base port. This does NOT change EVER during the run of a suite.
      *	It is set using the property derby.tests.basePort and it is set to default when
      *	a property isn't used. */
     private final static int basePort;
     private static int lastAssignedPort;
+    private static final int bogusPort;
     static {
     	String port = BaseTestCase.getSystemProperty("derby.tests.basePort");
         if (port == null) {
@@ -91,8 +92,9 @@ public final class TestConfiguration {
         	lastAssignedPort = Integer.parseInt(port);
         }
         basePort = lastAssignedPort;
+        bogusPort = ++lastAssignedPort;
     }
-    private static int assignedPortCount = 1;
+    private static int assignedPortCount = 2;
     
     public  final   static  String  TEST_DBO = "TEST_DBO";
 
@@ -1021,9 +1023,8 @@ public final class TestConfiguration {
         this.jdbcClient = JDBCClient.getDefaultEmbedded();
         this.ssl = null;
         this.jmxPort = getNextAvailablePort();
-        this.bogusPort = getNextAvailablePort();
-        println("basePort=" + basePort + ", jmxPort=" + jmxPort +
-                ", bogusPort=" + bogusPort);
+        println("basePort=" + basePort + ", bogusPort=" + bogusPort +
+                ", jmxPort=" + jmxPort);
         url = createJDBCUrlWithDatabaseName(defaultDbName);
         initConnector(null);
  
@@ -1044,7 +1045,6 @@ public final class TestConfiguration {
         this.doTrace = copy.doTrace;
         this.port = copy.port;
         this.jmxPort = copy.jmxPort;
-        this.bogusPort = copy.bogusPort;
         
         this.jdbcClient = copy.jdbcClient;
         this.hostName = copy.hostName;
@@ -1068,7 +1068,6 @@ public final class TestConfiguration {
         this.doTrace = copy.doTrace;
         this.port = port;
         this.jmxPort = copy.jmxPort;
-        this.bogusPort = copy.bogusPort;
         if (bogusPort == port) {
             throw new IllegalStateException(
                     "port cannot equal bogusPort: " + bogusPort);
@@ -1096,7 +1095,6 @@ public final class TestConfiguration {
         this.doTrace = copy.doTrace;
         this.port = port;
         this.jmxPort = copy.jmxPort;
-        this.bogusPort = copy.bogusPort;
         if (bogusPort == port) {
             throw new IllegalStateException(
                     "port cannot equal bogusPort: " + bogusPort);
@@ -1133,7 +1131,6 @@ public final class TestConfiguration {
         this.doTrace = copy.doTrace;
         this.port = copy.port;
         this.jmxPort = copy.jmxPort;
-        this.bogusPort = copy.bogusPort;
         
         this.jdbcClient = copy.jdbcClient;
         this.hostName = copy.hostName;
@@ -1197,7 +1194,6 @@ public final class TestConfiguration {
         this.doTrace = copy.doTrace;
         this.port = copy.port;
         this.jmxPort = copy.jmxPort;
-        this.bogusPort = copy.bogusPort;
         
         this.jdbcClient = copy.jdbcClient;
         this.hostName = copy.hostName;
@@ -1227,9 +1223,8 @@ public final class TestConfiguration {
         doTrace =  Boolean.valueOf(props.getProperty(KEY_TRACE)).booleanValue();
         port = basePort;
         jmxPort = getNextAvailablePort();
-        bogusPort = getNextAvailablePort();
-        println("basePort=" + basePort + ", jmxPort=" + jmxPort +
-                ", bogusPort=" + bogusPort);
+        println("basePort=" + basePort + ", bogusPort=" + bogusPort +
+                ", jmxPort=" + jmxPort);
 
         ssl = props.getProperty(KEY_SSL);
         
@@ -1748,7 +1743,6 @@ public final class TestConfiguration {
     private final String hostName;
     private final JDBCClient jdbcClient;
     private final int jmxPort;
-    private final int bogusPort;
     private boolean isVerbose;
     private boolean doTrace;
     private String ssl;