cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1149598 - /cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
Date Fri, 22 Jul 2011 13:18:54 GMT
Author: sergeyb
Date: Fri Jul 22 13:18:54 2011
New Revision: 1149598

URL: http://svn.apache.org/viewvc?rev=1149598&view=rev
Log:
Adding some timeout to EngineLifecycleTests

Modified:
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java?rev=1149598&r1=1149597&r2=1149598&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
(original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/EngineLifecycleTest.java
Fri Jul 22 13:18:54 2011
@@ -127,15 +127,25 @@ public class EngineLifecycleTest extends
     }
     
     private void getTestHtml() throws Exception {
-        HttpURLConnection httpConnection = 
-            getHttpConnection("http://localhost:" + PORT2 + "/test.html");    
-        httpConnection.connect();
-        InputStream in = httpConnection.getInputStream();        
-        assertNotNull(in);
-        CachedOutputStream response = new CachedOutputStream();
-        IOUtils.copy(in, response);
-        in.close();
-        response.close();
+        CachedOutputStream response = null;
+        for (int i = 0; i < 10; i++) {
+            try {
+                HttpURLConnection httpConnection = 
+                    getHttpConnection("http://localhost:" + PORT2 + "/test.html");    
+                httpConnection.connect();
+                InputStream in = httpConnection.getInputStream();        
+                assertNotNull(in);
+                response = new CachedOutputStream();
+                IOUtils.copy(in, response);
+                in.close();
+                response.close();
+                break;
+            } catch (Exception ex) {
+                response = null;
+                Thread.sleep(1000);
+            }
+        }
+        assertNotNull("Test doc can not be read", response);
               
         FileInputStream htmlFile = 
             new FileInputStream("target/test-classes/org/apache/cxf/systest/http_jetty/test.html");
   



Mime
View raw message