Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 68132 invoked from network); 13 Jul 2010 13:24:23 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 Jul 2010 13:24:23 -0000 Received: (qmail 81856 invoked by uid 500); 13 Jul 2010 13:24:23 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 81793 invoked by uid 500); 13 Jul 2010 13:24:21 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 81786 invoked by uid 99); 13 Jul 2010 13:24:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Jul 2010 13:24:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Jul 2010 13:24:18 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C6B8523888D2; Tue, 13 Jul 2010 13:22:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r963706 - in /db/derby/code/branches/10.6: ./ java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetworkServerControlClientCommandTest.java java/testing/org/apache/derbyTesting/junit/TestConfiguration.java Date: Tue, 13 Jul 2010 13:22:54 -0000 To: derby-commits@db.apache.org From: kristwaa@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100713132254.C6B8523888D2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kristwaa Date: Tue Jul 13 13:22:54 2010 New Revision: 963706 URL: http://svn.apache.org/viewvc?rev=963706&view=rev Log: DERBY-4700: Add method to obtain a bogus port in TestConfiguration Merged fix from trunk (revision 963705). Modified: db/derby/code/branches/10.6/ (props changed) db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetworkServerControlClientCommandTest.java 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 13 13:22:54 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 +/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/docs/trunk:954344 Modified: db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetworkServerControlClientCommandTest.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetworkServerControlClientCommandTest.java?rev=963706&r1=963705&r2=963706&view=diff ============================================================================== --- db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetworkServerControlClientCommandTest.java (original) +++ db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetworkServerControlClientCommandTest.java Tue Jul 13 13:22:54 2010 @@ -50,7 +50,8 @@ public class NetworkServerControlClientC public void testPing() throws Exception { String currentHost = TestConfiguration.getCurrent().getHostName(); String currentPort = Integer.toString(TestConfiguration.getCurrent().getPort()); - String bogusPort = Integer.toString(TestConfiguration.getCurrent().getPort()-1); + String bogusPort = Integer.toString( + TestConfiguration.getCurrent().getBogusPort()); String[] pingCmd1 = new String[] { "org.apache.derby.drda.NetworkServerControl", "ping" }; 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=963706&r1=963705&r2=963706&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 13 13:22:54 2010 @@ -56,7 +56,7 @@ import junit.framework.TestSuite; * removed by DropDatabaseSetup. * */ -public class TestConfiguration { +public final class TestConfiguration { /** * Default values for configurations */ @@ -1021,6 +1021,9 @@ public class TestConfiguration { this.jdbcClient = JDBCClient.getDefaultEmbedded(); this.ssl = null; this.jmxPort = getNextAvailablePort(); + this.bogusPort = getNextAvailablePort(); + println("basePort=" + basePort + ", jmxPort=" + jmxPort + + ", bogusPort=" + bogusPort); url = createJDBCUrlWithDatabaseName(defaultDbName); initConnector(null); @@ -1041,6 +1044,7 @@ public 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; @@ -1064,6 +1068,11 @@ public 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); + } this.jdbcClient = client; this.hostName = hostName; @@ -1087,6 +1096,11 @@ public 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); + } this.jdbcClient = client; this.hostName = hostName; @@ -1119,6 +1133,7 @@ public 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; @@ -1182,6 +1197,7 @@ public 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; @@ -1211,6 +1227,9 @@ public class TestConfiguration { doTrace = Boolean.valueOf(props.getProperty(KEY_TRACE)).booleanValue(); port = basePort; jmxPort = getNextAvailablePort(); + bogusPort = getNextAvailablePort(); + println("basePort=" + basePort + ", jmxPort=" + jmxPort + + ", bogusPort=" + bogusPort); ssl = props.getProperty(KEY_SSL); @@ -1419,6 +1438,16 @@ public class TestConfiguration { } /** + * Returns a port number where no Derby network servers are supposed to + * be running. + * + * @return A port number where no Derby network servers are started. + */ + public int getBogusPort() { + return bogusPort; + } + + /** * Get ssl mode for network server * * @return ssl mode @@ -1600,6 +1629,20 @@ public class TestConfiguration { public boolean isVerbose() { return isVerbose; } + + /** + * Private method printing debug information to standard out if debugging + * is enabled. + *

+ * Note: This method may direct output to a different location + * than the println method in BaseJDBCTestCase. + */ + private void println(CharSequence msg) { + if (isVerbose) { + System.out.println("DEBUG: {TC@" + hashCode() + "} " + msg); + } + } + /** * Return JUnit test method trace flag. * @@ -1705,6 +1748,7 @@ public 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;