Author: kwall
Date: Tue May 20 14:39:53 2014
New Revision: 1596269

URL: http://svn.apache.org/r1596269
Log:
NO-JIRA: [Java Broker] Add extra assertions to PortRestTest to help investigate 
sporadic test failure on some CI environments

Modified:
    
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java

Modified: 
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java?rev=1596269&r1=1596268&r2=1596269&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java
 (original)
+++ 
qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java
 Tue May 20 14:39:53 2014
@@ -123,7 +123,8 @@ public class PortRestTest extends QpidRe
         String portNameJMX = "test-port-jmx";
         attributes = new HashMap<String, Object>();
         attributes.put(Port.NAME, portNameJMX);
-        attributes.put(Port.PORT, getNextAvailable(rmiPort + 1));
+        int jmxPort = getNextAvailable(rmiPort + 1);
+        attributes.put(Port.PORT, jmxPort);
         attributes.put(Port.PROTOCOLS, 
Collections.singleton(Protocol.JMX_RMI));
         attributes.put(JmxPort.AUTHENTICATION_PROVIDER, 
TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER);
 
@@ -144,9 +145,17 @@ public class PortRestTest extends QpidRe
         assertEquals("Unexpected response code", 201, responseCode);
 
 
-
         // make sure that port is there after broker restart
-        restartBroker();
+        stopBroker();
+
+        // Temporary code to investigate sporadic test failure.
+        boolean rmiIsFree = getNextAvailable(rmiPort) == rmiPort;
+        boolean jmxIsFree = getNextAvailable(jmxPort) == jmxPort;
+
+        assertTrue("Expecting rmiPort to be free after broker stop", 
rmiIsFree);
+        assertTrue("Expecting jmxPort to be free after broker stop", 
jmxIsFree);
+
+        startBroker();
 
         portDetails = getRestTestHelper().getJsonAsList("port/" + portNameRMI);
         assertNotNull("Port details cannot be null", portDetails);



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to