Author: jvazquez
Date: Fri Mar 20 20:06:26 2009
New Revision: 756741

URL: http://svn.apache.org/viewvc?rev=756741&view=rev
Log:
SLING-893: Pipeline support 
https://issues.apache.org/jira/browse/SLING-893
Added integration test

Added:
    
incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/xproc/
    
incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/xproc/XsltTest.java
    
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/
    
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/
    
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/expected-dynamic.html
    
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/expected-static.html
    
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/html.xpl
    
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/pipelines.json
    
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/sample.xml.esp
    
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/static_xml.xml
    
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/test-content.xslt
    
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/test-html.xslt
Modified:
    incubator/sling/trunk/contrib/launchpad/testing/pom.xml
    
incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/RenderingTestBase.java

Modified: incubator/sling/trunk/contrib/launchpad/testing/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/launchpad/testing/pom.xml?rev=756741&r1=756740&r2=756741&view=diff
==============================================================================
--- incubator/sling/trunk/contrib/launchpad/testing/pom.xml (original)
+++ incubator/sling/trunk/contrib/launchpad/testing/pom.xml Fri Mar 20 20:06:26 
2009
@@ -235,7 +235,7 @@
                             </outputDirectory>
                             <excludeTransitive>true</excludeTransitive>
                             <includeArtifactIds>
-                                org.apache.sling.scripting.python
+                                
org.apache.sling.scripting.python,org.apache.sling.scripting.xproc
                             </includeArtifactIds>
                             <includeScope>
                                 provided
@@ -644,7 +644,15 @@
             <version>0.0.169</version>
             <scope>test</scope>
         </dependency>
-
+               
+               <!-- XML Processing bundle -->
+               <dependency>
+                       <groupId>org.apache.sling</groupId>
+                       
<artifactId>org.apache.sling.scripting.xproc</artifactId>
+               <version>2.0.0-incubator-SNAPSHOT</version>
+               <scope>provided</scope>
+               </dependency>
+               
         <!-- Dependencies for the Test Build and Run -->
         <dependency>
             <groupId>org.apache.sling</groupId>

Modified: 
incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/RenderingTestBase.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/RenderingTestBase.java?rev=756741&r1=756740&r2=756741&view=diff
==============================================================================
--- 
incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/RenderingTestBase.java
 (original)
+++ 
incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/RenderingTestBase.java
 Fri Mar 20 20:06:26 2009
@@ -22,7 +22,7 @@
 
 /** Base class for rendering tests
  */
-class RenderingTestBase extends HttpTestBase {
+public class RenderingTestBase extends HttpTestBase {
     protected String scriptPath;
     protected String testText;
     protected String displayUrl;

Added: 
incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/xproc/XsltTest.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/xproc/XsltTest.java?rev=756741&view=auto
==============================================================================
--- 
incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/xproc/XsltTest.java
 (added)
+++ 
incubator/sling/trunk/contrib/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/xproc/XsltTest.java
 Fri Mar 20 20:06:26 2009
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.launchpad.webapp.integrationtest.xproc;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.sling.launchpad.webapp.integrationtest.RenderingTestBase;
+
+/**
+ * Integration tests concerning XSLT transfomations
+ * over XProc pipelines.
+ * @see http://www.w3.org/TR/xproc/
+ */
+public class XsltTest extends RenderingTestBase {
+       
+       private final String random = getClass().getSimpleName() + 
String.valueOf(System.currentTimeMillis());
+       
+       /**
+        * Xpl (XProc) pipeline which XML source is a
+        * static XML file.
+        */
+       public void testStaticXml() throws IOException {
+               // Upload xpl pipeline
+               final String scriptPath = "/apps/" + random;
+               testClient.mkdirs(WEBDAV_BASE_URL, scriptPath);
+               urlsToDelete.add(WEBDAV_BASE_URL + scriptPath);
+               final String urlXplScript = uploadTestScript(scriptPath, 
"xproc/xslt/html.xpl", "html.xpl");
+               urlsToDelete.add(urlXplScript);
+               
+               // XSLT stylesheets
+               final String xsltsPath = "/xsl";
+               testClient.mkdirs(WEBDAV_BASE_URL, xsltsPath);
+               urlsToDelete.add(WEBDAV_BASE_URL + xsltsPath);
+               final String urlXslContent = uploadTestScript(xsltsPath, 
"xproc/xslt/test-content.xslt", "test-content.xslt");
+               urlsToDelete.add(urlXslContent);
+               final String urlXslHtml = uploadTestScript(xsltsPath, 
"xproc/xslt/test-html.xslt", "test-html.xslt");
+               urlsToDelete.add(urlXslHtml);
+               
+               // New "xpl" resource
+               final String mokeNodePath = HTTP_BASE_URL + "/sling-test/" + 
random + "/static_xml";
+               Map<String, String> mokeNodeProps = new HashMap<String, 
String>();
+               mokeNodeProps.put("sling:resourceType", random);
+               testClient.createNode(mokeNodePath, mokeNodeProps);
+               urlsToDelete.add(mokeNodePath);
+               
+               // The pipeline source: a static XML.
+               final String staticXmlPath = "/sling-test/" + random;
+               final String urlStaticXml = uploadTestScript(staticXmlPath, 
"xproc/xslt/static_xml.xml", "static_xml.xml");
+               urlsToDelete.add(urlStaticXml);
+               
+               // Render content and assertions
+               final String content = getContent(mokeNodePath + ".html", 
CONTENT_TYPE_HTML);
+               assertContains(content, "static content");
+       }
+       
+}

Added: 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/expected-dynamic.html
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/expected-dynamic.html?rev=756741&view=auto
==============================================================================
--- 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/expected-dynamic.html
 (added)
+++ 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/expected-dynamic.html
 Fri Mar 20 20:06:26 2009
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+       <head>
+               <meta http-equiv="Content-Type" content="text/html; 
charset=UTF-8" />
+               <title>Just a pretty simple pipeline.</title>
+       </head>
+       <body>
+              The pipeline contents: xpl-sample: content
+       </body>
+</html>

Added: 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/expected-static.html
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/expected-static.html?rev=756741&view=auto
==============================================================================
--- 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/expected-static.html
 (added)
+++ 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/expected-static.html
 Fri Mar 20 20:06:26 2009
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+       <head>
+               <meta http-equiv="Content-Type" content="text/html; 
charset=UTF-8" />
+               <title>Just a pretty simple pipeline.</title>
+       </head>
+       <body>
+              The pipeline contents: xpl-sample: static content
+       </body>
+</html>

Added: 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/html.xpl
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/html.xpl?rev=756741&view=auto
==============================================================================
--- 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/html.xpl
 (added)
+++ 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/html.xpl
 Fri Mar 20 20:06:26 2009
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<p:pipeline xmlns:p="http://www.w3.org/ns/xproc";>
+
+  <p:xslt>
+    <p:input port="stylesheet">
+      <p:document href="/xsl/test-content.xslt"/>
+    </p:input>
+  </p:xslt>
+  
+  <p:xslt>
+    <p:input port="stylesheet">
+      <p:document href="/xsl/test-html.xslt"/>
+    </p:input>
+  </p:xslt>
+  
+</p:pipeline>
\ No newline at end of file

Added: 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/pipelines.json
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/pipelines.json?rev=756741&view=auto
==============================================================================
--- 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/pipelines.json
 (added)
+++ 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/pipelines.json
 Fri Mar 20 20:06:26 2009
@@ -0,0 +1,16 @@
+{      
+       "title": "pipelines",
+       "jcr:primaryType":"nt:unstructured",
+       "dynamic_xml": {
+               "title": "dynamic_xml",
+               "sling:resourceType": "sling/xpl/sample",
+               "sling:resourceSuperType": "sling/xpl"
+       },
+       "static_xml": {
+               "sling:resourceType": "sling/xpl"
+       },
+       "no_xml": {
+               "title": "no_xml",
+               "sling:resourceType": "sling/xpl"
+       }
+}
\ No newline at end of file

Added: 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/sample.xml.esp
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/sample.xml.esp?rev=756741&view=auto
==============================================================================
--- 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/sample.xml.esp
 (added)
+++ 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/sample.xml.esp
 Fri Mar 20 20:06:26 2009
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<test>
+       <content>
+               xpl-sample: content
+       </content>
+</test>
+

Added: 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/static_xml.xml
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/static_xml.xml?rev=756741&view=auto
==============================================================================
--- 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/static_xml.xml
 (added)
+++ 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/static_xml.xml
 Fri Mar 20 20:06:26 2009
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<test>
+       <content>
+               xpl-sample: static content
+       </content>
+</test>
\ No newline at end of file

Added: 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/test-content.xslt
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/test-content.xslt?rev=756741&view=auto
==============================================================================
--- 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/test-content.xslt
 (added)
+++ 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/test-content.xslt
 Fri Mar 20 20:06:26 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
+  <xsl:template match="/test">
+       <result>
+       <xsl:value-of select="content"/>
+    </result>
+  </xsl:template>
+</xsl:stylesheet>

Added: 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/test-html.xslt
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/test-html.xslt?rev=756741&view=auto
==============================================================================
--- 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/test-html.xslt
 (added)
+++ 
incubator/sling/trunk/contrib/launchpad/testing/src/test/resources/integration-test/xproc/xslt/test-html.xslt
 Fri Mar 20 20:06:26 2009
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
+  <xsl:template match="/">
+    <html>
+      <head>
+        <title>Just a pretty simple pipeline.</title>
+      </head>
+      <body>
+        The pipeline contents:
+        <xsl:value-of select="/result"/>
+      </body>
+    </html>
+  </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file


Reply via email to