incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r628666 - in /incubator/sling/trunk/launchpad/launchpad-webapp/src/test: java/org/apache/sling/launchpad/webapp/integrationtest/ resources/integration-test/
Date Mon, 18 Feb 2008 09:38:08 GMT
Author: bdelacretaz
Date: Mon Feb 18 01:38:05 2008
New Revision: 628666

URL: http://svn.apache.org/viewvc?rev=628666&view=rev
Log:
SLING-252 - integration tests added for the new currentNode variable

Modified:
    incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
    incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBuiltinObjectsTest.java
    incubator/sling/trunk/launchpad/launchpad-webapp/src/test/resources/integration-test/builtin-objects.esp
    incubator/sling/trunk/launchpad/launchpad-webapp/src/test/resources/integration-test/rendering-test.jsp

Modified: incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java?rev=628666&r1=628665&r2=628666&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
(original)
+++ incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JspScriptingTest.java
Mon Feb 18 01:38:05 2008
@@ -59,10 +59,7 @@
     public void testRtJsp() throws Exception {
         final String toDelete = uploadTestScript(rtNode.scriptPath, "rendering-test.jsp",
"html.jsp");
         try {
-            final String content = getContent(rtNode.nodeUrl + ".html", CONTENT_TYPE_HTML);
-            assertTrue("JSP script executed as expected (" + content + ")", content.contains("JSP
rendering result"));
-            final String expected  = "JSP rendering result:" + rtNode.testText;
-            assertTrue("Content contains " + expected + "(" + content + ")", content.contains(expected));
+            checkContent(rtNode);
         } finally {
             if(toDelete != null) {
                 testClient.delete(toDelete);
@@ -73,14 +70,24 @@
     public void testUnstructuredJsp() throws Exception {
         final String toDelete = uploadTestScript(unstructuredNode.scriptPath, "rendering-test.jsp",
"html.jsp");
         try {
-            final String content = getContent(unstructuredNode.nodeUrl + ".html", CONTENT_TYPE_HTML);
-            assertTrue("JSP script executed as expected (" + content + ")", content.contains("JSP
rendering result"));
-            final String expected  = "JSP rendering result:" + unstructuredNode.testText;
-            assertTrue("Content contains " + expected + "(" + content + ")", content.contains(expected));
+            checkContent(unstructuredNode);
         } finally {
             if(toDelete != null) {
                 testClient.delete(toDelete);
             }
+        }
+    }
+    
+    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,
+        };
+        for(String exp : expected) {
+            assertTrue("Content contains " + exp + "(" + content + ")", content.contains(exp));
         }
     }
 }

Modified: incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBuiltinObjectsTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBuiltinObjectsTest.java?rev=628666&r1=628665&r2=628666&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBuiltinObjectsTest.java
(original)
+++ incubator/sling/trunk/launchpad/launchpad-webapp/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/ScriptBuiltinObjectsTest.java
Mon Feb 18 01:38:05 2008
@@ -34,10 +34,12 @@
         final String toDelete = uploadTestScript("builtin-objects.esp","html.esp");
         try {
             final String content = getContent(displayUrl + ".html", CONTENT_TYPE_HTML);
-            assertTrue("Content includes ESP marker",content.contains("ESP template"));
-            assertTrue("Content includes test text", content.contains(testText));
-            assertTrue("Content includes sc data",content.contains("sc:null"));
-            assertTrue("Content includes response data",content.contains("SlingHttpServletResponse:false"));
+            assertTrue("Content includes ESP marker (" + content + ")",content.contains("ESP
template"));
+            assertTrue("Content includes test text (" + content + ")", content.contains(testText));
+            assertTrue("Content includes resource.node text (" + content + ")", content.contains("resource.node.text:"
+ testText));
+            assertTrue("Content includes currentNode text (" + content + ")", content.contains("currentNode.text:"
+ testText));
+            assertTrue("Content includes sc data (" + content + ")",content.contains("sc:null"));
+            assertTrue("Content includes response data (" + content + ")",content.contains("SlingHttpServletResponse:false"));
         } finally {
             testClient.delete(toDelete);
         }

Modified: incubator/sling/trunk/launchpad/launchpad-webapp/src/test/resources/integration-test/builtin-objects.esp
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-webapp/src/test/resources/integration-test/builtin-objects.esp?rev=628666&r1=628665&r2=628666&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-webapp/src/test/resources/integration-test/builtin-objects.esp
(original)
+++ incubator/sling/trunk/launchpad/launchpad-webapp/src/test/resources/integration-test/builtin-objects.esp
Mon Feb 18 01:38:05 2008
@@ -1,8 +1,9 @@
 <%-- used by ScriptBuiltinObjectsTest --%>
 <html>
 	<body>
-		ESP template
-		<p><%= resource.node.text %></p>
+		<h1>ESP template</h1>
+		<p>resource.node.text:<%= resource.node.text %></p>
+		<p>currentNode.text:<%= currentNode.text %></p>
 	</body>
 	
 	<!-- 

Modified: incubator/sling/trunk/launchpad/launchpad-webapp/src/test/resources/integration-test/rendering-test.jsp
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/launchpad/launchpad-webapp/src/test/resources/integration-test/rendering-test.jsp?rev=628666&r1=628665&r2=628666&view=diff
==============================================================================
--- incubator/sling/trunk/launchpad/launchpad-webapp/src/test/resources/integration-test/rendering-test.jsp
(original)
+++ incubator/sling/trunk/launchpad/launchpad-webapp/src/test/resources/integration-test/rendering-test.jsp
Mon Feb 18 01:38:05 2008
@@ -2,4 +2,11 @@
 <%@page session="false"%>
 <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0"%>
 <sling:defineObjects/>
-JSP rendering result:<%= resource.adaptTo(javax.jcr.Node.class).getProperty("text").getValue().getString()
%>
\ No newline at end of file
+
+<h1>JSP rendering result</h1>
+<p>
+	text value using resource.adaptTo:<%= resource.adaptTo(javax.jcr.Node.class).getProperty("text").getValue().getString()
%>
+</p>
+<p>
+	text value using currentNode:<%= currentNode.getProperty("text").getValue().getString()
%>
+</p>



Mime
View raw message