You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by mn...@apache.org on 2010/12/24 11:45:21 UTC

svn commit: r1052478 - /incubator/aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java

Author: mnuttall
Date: Fri Dec 24 10:45:21 2010
New Revision: 1052478

URL: http://svn.apache.org/viewvc?rev=1052478&view=rev
Log:
ARIES-527: Prevent intermittent test failures on Hudson. 

Modified:
    incubator/aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java

Modified: incubator/aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java?rev=1052478&r1=1052477&r2=1052478&view=diff
==============================================================================
--- incubator/aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java (original)
+++ incubator/aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java Fri Dec 24 10:45:21 2010
@@ -26,6 +26,7 @@ import static org.ops4j.pax.exam.CoreOpt
 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
 import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
 
+import java.io.IOException;
 import java.net.HttpURLConnection;
 
 import org.junit.Test;
@@ -55,17 +56,23 @@ public class JndiUrlIntegrationTest exte
     assertNotNull(bweb);
     bweb.start();
 
-    // Short wait in order to give the blueprint and web containers a chance
-    // to initialise
+    // We've had intermittent problems in which Jetty only seems to start after a bundle
+    // receives an HTTP request. This next block is here to prevent Hudson failures. 
     try { 
-      Thread.sleep(5000);
+      Thread.sleep(2000);
+      getTestServletResponse();
+      Thread.sleep(3000);
     } catch (InterruptedException ix) {}
     
     System.out.println("In test and trying to get connection....");
+    String response = getTestServletResponse();
+    assertEquals("ITest servlet response wrong", "Mark.2.0.three", response);
+  }
+  
+  private String getTestServletResponse() throws IOException { 
     HttpURLConnection conn = makeConnection("http://localhost:8080/org.apache.aries.jndi.url.itest.web/ITestServlet");
     String response = getHTTPResponse(conn).trim();
-    
-    assertEquals("ITest servlet response wrong", "Mark.2.0.three", response);
+    return response;
   }
   
   @org.ops4j.pax.exam.junit.Configuration