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 da...@apache.org on 2013/04/18 07:12:40 UTC

svn commit: r1469165 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java

Author: dag
Date: Thu Apr 18 05:12:40 2013
New Revision: 1469165

URL: http://svn.apache.org/r1469165
Log:
DERBY-6179  Insert some guarding code into the first replication test to check port availability

Add simplification suggested ny Knut; no functional change.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java?rev=1469165&r1=1469164&r2=1469165&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java Thu Apr 18 05:12:40 2013
@@ -240,7 +240,7 @@ final public class NetworkServerTestSetu
      */
     public static void waitForAvailablePort()
             throws InterruptedException, UnknownHostException {
-        waitForAvailablePort(-1);
+        waitForAvailablePort(TestConfiguration.getCurrent().getPort());
     }
 
 
@@ -249,8 +249,7 @@ final public class NetworkServerTestSetu
      * by earlier test cases, or until the timeout specified by
      * {@link #getWaitTime()} has elapsed.
      *
-     * @param port If -1, use default port for configuration, else use this
-     *             value.
+     * @param port value.
      * @throws AssertionFailedError if the port didn't become available before
      * the timeout
      * @throws InterruptedException if the thread was interrupted while waiting
@@ -260,12 +259,8 @@ final public class NetworkServerTestSetu
     public static void waitForAvailablePort(int port)
             throws InterruptedException, UnknownHostException {
 
-        TestConfiguration conf = TestConfiguration.getCurrent();
-        InetAddress serverAddress = InetAddress.getByName(conf.getHostName());
-
-        if (port == -1) {
-            port = conf.getPort();
-        }
+        InetAddress serverAddress = InetAddress.getByName(
+                TestConfiguration.getCurrent().getHostName());
 
         long giveUp = System.currentTimeMillis() + getWaitTime();
         BaseTestCase.println(