You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2009/08/05 17:03:25 UTC

svn commit: r801251 - in /sling/trunk/launchpad/testing/src/test: java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java resources/integration-test/jsp2.jsp

Author: cziegeler
Date: Wed Aug  5 15:03:25 2009
New Revision: 801251

URL: http://svn.apache.org/viewvc?rev=801251&view=rev
Log:
Fix the test case: correct jsp and wait some seconds before calling the new script.

Modified:
    sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
    sling/trunk/launchpad/testing/src/test/resources/integration-test/jsp2.jsp

Modified: sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java?rev=801251&r1=801250&r2=801251&view=diff
==============================================================================
--- sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java (original)
+++ sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java Wed Aug  5 15:03:25 2009
@@ -24,15 +24,15 @@
  *  that would help in testing all scripting engines.
  */
 public class JspScriptingTest extends HttpTestBase {
- 
+
     private String testRootUrl;
     private TestNode rtNode;
     private TestNode unstructuredNode;
-    
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();
-        
+
         final String testRootPath = HTTP_BASE_URL + "/" + getClass().getSimpleName() + "/" + System.currentTimeMillis();
         testRootUrl = testClient.createNode(testRootPath + SlingPostConstants.DEFAULT_CREATE_SUFFIX, null);
         rtNode = new TestNode(testRootPath + "/rt", null);
@@ -44,7 +44,7 @@
         testClient.delete(testRootUrl);
         super.tearDown();
     }
-    
+
     public void testRtNoScript() throws Exception {
         final String content = getContent(rtNode.nodeUrl + ".txt", CONTENT_TYPE_PLAIN);
         assertTrue(content.contains("PlainTextRendererServlet"));
@@ -56,7 +56,7 @@
         assertTrue(content.contains("PlainTextRendererServlet"));
         assertTrue("Content contains " + unstructuredNode.testText + " (" + content + ")", content.contains(unstructuredNode.testText));
     }
-    
+
     public void testRtJsp() throws Exception {
         final String toDelete = uploadTestScript(rtNode.scriptPath, "rendering-test.jsp", "html.jsp");
         try {
@@ -78,17 +78,19 @@
             }
         }
     }
-    
+
     /* Verify that overwriting a JSP script changes the output immediately */
     public void testChangingJsp() throws Exception {
         String toDelete = null;
-        
+
         try {
             final String [] scripts = { "jsp1.jsp", "jsp2.jsp" };
             for(String script : scripts) {
                 toDelete = uploadTestScript(unstructuredNode.scriptPath, script, "html.jsp");
+                // scripts are only checked every 4 seconds for a change (by default) - so we wait 5 seconds
+                Thread.sleep(5000);
                 final String content = getContent(unstructuredNode.nodeUrl + ".html", CONTENT_TYPE_HTML);
-                final String expected = "text from " + script + ":" + unstructuredNode.testText; 
+                final String expected = "text from " + script + ":" + unstructuredNode.testText;
                 assertTrue("Content contains '" + expected + "'(" + content + ")", content.contains(expected));
             }
         } finally {
@@ -101,7 +103,7 @@
     private void checkContent(TestNode tn) throws Exception {
         final String content = getContent(tn.nodeUrl + ".html", CONTENT_TYPE_HTML);
         assertTrue("JSP script executed as expected (" + content + ")", content.contains("<h1>JSP rendering result</h1>"));
-        
+
         final String [] expected = {
                 "using resource.adaptTo:" + tn.testText,
                 "using currentNode:" + tn.testText,

Modified: sling/trunk/launchpad/testing/src/test/resources/integration-test/jsp2.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/test/resources/integration-test/jsp2.jsp?rev=801251&r1=801250&r2=801251&view=diff
==============================================================================
--- sling/trunk/launchpad/testing/src/test/resources/integration-test/jsp2.jsp (original)
+++ sling/trunk/launchpad/testing/src/test/resources/integration-test/jsp2.jsp Wed Aug  5 15:03:25 2009
@@ -24,5 +24,5 @@
 
 <h1>jsp2.jsp</h1>
 <p>
-    text from jsp2.jsp:=<%= currentNode.getProperty("text").getValue().getString() %>
+    text from jsp2.jsp:<%= currentNode.getProperty("text").getValue().getString() %>
 </p>