incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1496188 - in /sling/trunk/launchpad/integration-tests/src/main: java/org/apache/sling/launchpad/webapp/integrationtest/JspIncludeTest.java resources/integration-test/include-test.jsp
Date Mon, 24 Jun 2013 20:02:56 GMT
Author: dklco
Date: Mon Jun 24 20:02:56 2013
New Revision: 1496188

URL: http://svn.apache.org/r1496188
Log:
Added a Unit test for the new var option on the include tag

Modified:
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspIncludeTest.java
    sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/include-test.jsp

Modified: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspIncludeTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspIncludeTest.java?rev=1496188&r1=1496187&r2=1496188&view=diff
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspIncludeTest.java
(original)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/JspIncludeTest.java
Mon Jun 24 20:02:56 2013
@@ -24,11 +24,15 @@ import java.util.Set;
 
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.sling.servlets.post.SlingPostConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 
 /** Test the {link ScriptHelper#include) functionality */
  public class JspIncludeTest extends JspTestBase {
+	 
+	private static final Logger log = LoggerFactory.getLogger(JspIncludeTest.class);
 
     private String nodeUrlA;
     private String testTextA;
@@ -40,6 +44,7 @@ import org.apache.sling.servlets.post.Sl
     private String nodeUrlF;
     private String nodeUrlG;
     private String nodeUrlH;
+	private String nodeUrlI;
     private String forcedResourceType;
     private Set<String> toDelete = new HashSet<String>();
 
@@ -91,6 +96,14 @@ import org.apache.sling.servlets.post.Sl
         props.remove("pathToInclude");
         props.put("testCallScript", "called-test.jsp");
         nodeUrlG = testClient.createNode(url, props);
+        
+        // Node I is used for the "var" test
+        props.remove("forceResourceType");
+        props.remove("testCallScript");
+        props.put("testVarInclude","true"); 
+        props.put("pathToInclude", pathToInclude);
+        props.put("VAR_INCLUDE", "VALUE");
+        nodeUrlI = testClient.createNode(url, props);
 
         // Script for forced resource type
         scriptPath = "/apps/" + forcedResourceType;
@@ -203,4 +216,11 @@ import org.apache.sling.servlets.post.Sl
         assertTrue("Content includes JSP marker",content.contains("JSP template"));
         assertTrue("Call has been made",content.contains("called"));
     }
+    
+    public void testVarInclude() throws IOException{
+    	log.info("testVarInclude");
+        final String content = getContent(nodeUrlI + ".html", CONTENT_TYPE_HTML);
+    	log.info("Loaded content: "+content);
+        assertTrue("Content includes Loaded test content:",content.contains("Loaded test
content:"));
+    }
 }

Modified: sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/include-test.jsp
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/include-test.jsp?rev=1496188&r1=1496187&r2=1496188&view=diff
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/include-test.jsp
(original)
+++ sling/trunk/launchpad/integration-tests/src/main/resources/integration-test/include-test.jsp
Mon Jun 24 20:02:56 2013
@@ -17,7 +17,7 @@
  * specific language governing permissions and limitations
  * under the License.
 --%><%@page session="false"%><%
-%><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2"%><%
+%><%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling"%><%
 %><sling:defineObjects/><%
  
 // used by IncludeTest
@@ -42,6 +42,7 @@ String forceResourceType = getProperty(c
 String testInfiniteLoop = getProperty(currentNode, "testInfiniteLoop");
 String testMaxCalls = getProperty(currentNode, "testMaxCalls");
 String testCallScript = getProperty(currentNode, "testCallScript");
+String testVarInclude = getProperty(currentNode, "testVarInclude");
 
 %><html>
 	<body>
@@ -110,5 +111,27 @@ String testCallScript = getProperty(curr
 		<%
 			}
 		%>
+		
+		
+        <h2>Test 6</h2>
+        <%
+            if (testCallScript != null) {
+        %>
+                <p>Calling <%= testCallScript %></p>
+                <sling:call script="<%= testCallScript %>" />
+        <%
+            }
+        %>
+        
+        <h2>Test 7</h2>
+        <%
+            if (testVarInclude != null) {
+        %>
+                <p>Calling <%= testCallScript %></p>
+                <sling:include path="<%= pathToInclude %>" var="test" />
+                <p>Loaded test content:<br/>${test}</p>
+        <%
+            }
+        %>
 	</body>
 </html>



Mime
View raw message