Author: rajith
Date: Tue Aug 18 03:39:04 2009
New Revision: 805267

URL: http://svn.apache.org/viewvc?rev=805267&view=rev
Log:
This commit allows a limited number of failover tests to run under the SSL 
profile using SSL connections.
This commit should also fix the tests hanging under the SSL test profile due to 
port conflicts with SSL and failover ports.
FailoverBaseCase and FailoverTest is improved to handle the failover port 
without having to rely on port arithmetic.
The FailoverBaseCase is modified to use the failover.ssl connection factory 
when running under the SSL profile.
I have uncommented the FailoverTest from the cpp.ssl.excludes. However only a 
selected set of tests will run outside the cpp.clustered profile.

Modified:
    
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java
    
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/FailoverBaseCase.java
    qpid/trunk/qpid/java/test-profiles/cpp.ssl.excludes
    qpid/trunk/qpid/java/test-profiles/default.testprofile
    qpid/trunk/qpid/java/test-profiles/test-provider.properties

Modified: 
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java?rev=805267&r1=805266&r2=805267&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java
 (original)
+++ 
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java
 Tue Aug 18 03:39:04 2009
@@ -333,8 +333,9 @@
         }
         
         int iterations = Integer.getInteger("profile.failoverIterations",0);
-        boolean b = true;
-        int failingPort = getFailingPort();
+        boolean useAltPort = false;
+        int altPort = FAILING_PORT;
+        int stdPort = DEFAULT_PORT;
         init(false, Session.AUTO_ACKNOWLEDGE);
         for (int i=0; i < iterations; i++)
         {
@@ -343,25 +344,25 @@
             
_logger.debug("===================================================================");
             
             runP2PFailover(numMessages, false,false, false);
-            startBroker(failingPort);
-            if (b)
+            startBroker(getFailingPort());
+            if (useAltPort)
             {
-                failingPort = getFailingPort()-1;
-                b = false;
+               setFailingPort(altPort);
+                useAltPort = false;
             }
             else
             {
-                failingPort = getFailingPort()+1;
-                b = true;
+               setFailingPort(stdPort);
+               useAltPort = true;
             }
-            setFailingPort(failingPort);
+            
         }
-        //To prevent any failover logic being initiaed when we shutdown the 
brokers.
+        //To prevent any failover logic being initiated when we shutdown the 
brokers.
         connection.close();
         
         // Shutdown the brokers
-        stopBroker(getFailingPort());
-        stopBroker(b?getFailingPort()+1 : getFailingPort()-1);
+        stopBroker(altPort);
+        stopBroker(stdPort);
         
     }  
     

Modified: 
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/FailoverBaseCase.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/FailoverBaseCase.java?rev=805267&r1=805266&r2=805267&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/FailoverBaseCase.java
 (original)
+++ 
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/FailoverBaseCase.java
 Tue Aug 18 03:39:04 2009
@@ -28,7 +28,7 @@
 {
 
     public static int FAILING_VM_PORT = 2;
-    public static int FAILING_PORT = DEFAULT_PORT + 1;
+    public static int FAILING_PORT = DEFAULT_PORT + 100;
 
     protected int failingPort;
     
@@ -42,7 +42,7 @@
         }
         else
         {
-            failingPort = FAILING_PORT;
+               failingPort = FAILING_PORT;
         }
     }
     
@@ -55,7 +55,7 @@
     {
         super.setUp();
         setSystemProperty("QPID_WORK", 
System.getProperty("java.io.tmpdir")+"/"+getFailingPort());
-        startBroker(getFailingPort());
+        startBroker(FAILING_PORT);
     }
 
     /**
@@ -67,14 +67,16 @@
     public Connection getConnection() throws Exception
     {
         Connection conn =
-            getConnectionFactory("failover").createConnection("guest", 
"guest");
+               (Boolean.getBoolean("profile.use_ssl"))?
+                               
getConnectionFactory("failover.ssl").createConnection("guest", "guest"):        
        
+                               
getConnectionFactory("failover").createConnection("guest", "guest");
         _connections.add(conn);
         return conn;
     }
 
     public void tearDown() throws Exception
     {
-        stopBroker(getFailingPort());
+       stopBroker(FAILING_PORT);
         super.tearDown();
         
FileUtils.deleteDirectory(System.getProperty("java.io.tmpdir")+"/"+getFailingPort());
     }

Modified: qpid/trunk/qpid/java/test-profiles/cpp.ssl.excludes
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/cpp.ssl.excludes?rev=805267&r1=805266&r2=805267&view=diff
==============================================================================
--- qpid/trunk/qpid/java/test-profiles/cpp.ssl.excludes (original)
+++ qpid/trunk/qpid/java/test-profiles/cpp.ssl.excludes Tue Aug 18 03:39:04 2009
@@ -1 +1 @@
-org.apache.qpid.test.client.failover.FailoverTest#*
+#org.apache.qpid.test.client.failover.FailoverTest#*

Modified: qpid/trunk/qpid/java/test-profiles/default.testprofile
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/default.testprofile?rev=805267&r1=805266&r2=805267&view=diff
==============================================================================
--- qpid/trunk/qpid/java/test-profiles/default.testprofile (original)
+++ qpid/trunk/qpid/java/test-profiles/default.testprofile Tue Aug 18 03:39:04 
2009
@@ -19,7 +19,8 @@
 test.port=15672
 test.mport=18999
 test.port.ssl=15671
-test.port.alt=15673
+test.port.alt=15772
+test.port.alt.ssl=15771
 
 test.exclude=true
 profile.excludes=08TransientExcludes

Modified: qpid/trunk/qpid/java/test-profiles/test-provider.properties
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/test-profiles/test-provider.properties?rev=805267&r1=805266&r2=805267&view=diff
==============================================================================
--- qpid/trunk/qpid/java/test-profiles/test-provider.properties (original)
+++ qpid/trunk/qpid/java/test-profiles/test-provider.properties Tue Aug 18 
03:39:04 2009
@@ -21,13 +21,17 @@
 
 test.port=5672
 test.port.ssl=5671
-test.port.alt=5673
+test.port.alt=5772
+test.port.alt.ssl=5771
 
 connectionfactory.default = 
amqp://username:passw...@clientid/test?brokerlist='tcp://localhost:${test.port}'
 connectionfactory.default.vm = 
amqp://username:passw...@clientid/test?brokerlist='vm://:1'
 connectionfactory.ssl = 
amqp://username:passw...@clientid/test?brokerlist='tcp://localhost:${test.port.ssl}?ssl='true''
 
 connectionfactory.failover = 
amqp://username:passw...@clientid/test?brokerlist='tcp://localhost:${test.port.alt};tcp://localhost:${test.port}'&sync_ack='true'&sync_publish='all'&failover='roundrobin?cyclecount='20''
+
+connectionfactory.failover.ssl = 
amqp://username:passw...@clientid/test?brokerlist='tcp://localhost:${test.port.alt.ssl}?ssl='true';tcp://localhost:${test.port.ssl}?ssl='true''&sync_ack='true'&sync_publish='all'&failover='roundrobin?cyclecount='20''
+
 connectionfactory.failover.vm = 
amqp://username:passw...@clientid/test?brokerlist='vm://:2;vm://:1'
 connectionfactory.connection1 = 
amqp://username:passw...@clientid/test?brokerlist='tcp://localhost:${test.port}'
 connectionfactory.connection2 = 
amqp://username:passw...@clientid/test?brokerlist='tcp://localhost:${test.port.alt}'



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to