incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1138415 - /sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
Date Wed, 22 Jun 2011 11:53:33 GMT
Author: bdelacretaz
Date: Wed Jun 22 11:53:32 2011
New Revision: 1138415

URL: http://svn.apache.org/viewvc?rev=1138415&view=rev
Log:
Make test more robust w.r.t. timing

Modified:
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java

Modified: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java?rev=1138415&r1=1138414&r2=1138415&view=diff
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
(original)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
Wed Jun 22 11:53:32 2011
@@ -78,7 +78,8 @@ public class JspScriptingTest extends Js
         }
     }
 
-    /* Verify that overwriting a JSP script changes the output immediately */
+    /* Verify that overwriting a JSP script changes the output within a reasonable time 
+     * (might not be immediate as there's some observation and caching involved) */
     public void testChangingJsp() throws Exception {
         String toDelete = null;
 
@@ -86,8 +87,16 @@ public class JspScriptingTest extends Js
             final String [] scripts = { "jsp1.jsp", "jsp2.jsp" };
             for(String script : scripts) {
                 toDelete = uploadTestScript(unstructuredNode.scriptPath, script, "html.jsp");
-                final String content = getContent(unstructuredNode.nodeUrl + ".html", CONTENT_TYPE_HTML);
+                String content = null;
                 final String expected = "text from " + script + ":" + unstructuredNode.testText;
+                final long timeout = System.currentTimeMillis() + 2000L;
+                while(System.currentTimeMillis() < timeout) {
+                    content = getContent(unstructuredNode.nodeUrl + ".html", CONTENT_TYPE_HTML);
+                    if(content.contains(expected)) {
+                        break;
+                    }
+                    Thread.sleep(100L);
+                }
                 assertTrue("Content contains '" + expected + "'(" + content + ")", content.contains(expected));
             }
         } finally {



Mime
View raw message