This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/SLING-10012-precompiled-templates
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-bundle-tracker-it.git

commit 394d7b1ffd53db3e5bc538e393385b2dfdf57dd7
Author: Konrad Windszus <[email protected]>
AuthorDate: Mon Dec 21 13:19:16 2020 +0100

    SLING-10012 add failing IT for overriden precompiled template in
    separate bundle
---
 .../pom.xml                                        | 145 +++++++++++++++++++++
 .../content/examplebundle-precompiled-extend1.xml} |  15 ++-
 .../1.0.0/extends                                  |   1 +
 .../1.0.0/templates.html}                          |  10 +-
 .../1.0.0/h.html                                   |   3 +
 it/pom.xml                                         |   6 +
 .../it/ExampleBundlePrecompiledExtend1IT.java      |  56 ++++++++
 .../tracker/it/ExampleBundlePrecompiledIT.java     |   4 +
 it/src/test/provisioning/it-model.txt              |   1 +
 pom.xml                                            |   1 +
 10 files changed, 236 insertions(+), 6 deletions(-)

diff --git 
a/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/pom.xml 
b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/pom.xml
new file mode 100644
index 0000000..bcc42da
--- /dev/null
+++ 
b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/pom.xml
@@ -0,0 +1,145 @@
+<?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.
+  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>34</version>
+        <relativePath/>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    
<artifactId>org.apache.sling.scripting.examplebundle.precompiled.extend1</artifactId>
+    <version>0.1.1-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-deploy-plugin</artifactId>
+                <configuration>
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>scriptingbundle-maven-plugin</artifactId>
+                <version>0.2.2</version>
+                <executions>
+                    <execution>
+                        <phase>prepare-package</phase>
+                        <goals>
+                            <goal>metadata</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>!*</Export-Package>
+                        <Provide-Capability>
+                            
${org.apache.sling.scriptingbundle.maven.plugin.Provide-Capability}
+                        </Provide-Capability>
+                        <Require-Capability>
+                            
osgi.extender;filter:="(&amp;(osgi.extender=sling.scripting)(version>=1.0.0)(!(version>=2.0.0)))",
+                            
${org.apache.sling.scriptingbundle.maven.plugin.Require-Capability}
+                        </Require-Capability>
+                        <Sling-Initial-Content>
+                            
SLING-INF/content;overwrite:=true;path:=/content/bundled-scripts/examplebundle-precompiled-extend1
+                        </Sling-Initial-Content>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>htl-maven-plugin</artifactId>
+                <version>2.0.0-1.4.0</version>
+                <executions>
+                    <execution>
+                        <id>validate-htl-scripts</id>
+                        <goals>
+                            <goal>validate</goal>
+                        </goals>
+                        <phase>generate-sources</phase>
+                        <configuration>
+                            <generateJavaClasses>true</generateJavaClasses>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>**/extends</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <version>2.16.4</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.models.api</artifactId>
+            <version>1.3.6</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-atinject_1.0_spec</artifactId>
+            <version>1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.scripting.sightly.runtime</artifactId>
+            <version>1.2.2-1.4.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.settings</artifactId>
+            <version>1.3.10</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git 
a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0/h.html
 
b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/resources/SLING-INF/content/examplebundle-precompiled-extend1.xml
similarity index 69%
copy from 
examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0/h.html
copy to 
examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/resources/SLING-INF/content/examplebundle-precompiled-extend1.xml
index f862c0c..a85f2b1 100644
--- 
a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0/h.html
+++ 
b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/resources/SLING-INF/content/examplebundle-precompiled-extend1.xml
@@ -1,4 +1,5 @@
-<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+<?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
@@ -15,5 +16,13 @@
   ~ KIND, either express or implied.  See the License for the
   ~ specific language governing permissions and limitations
   ~ under the License.
-  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-<span id="h-precompiled-1" data-rt="${resource.resourceType}">Hello</span>
+  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<node>
+    <name>hello</name>
+    <primaryNodeType>nt:unstructured</primaryNodeType>
+    <property>
+        <name>sling:resourceType</name>
+        
<value>org.apache.sling.scripting.examplebundle.precompiled.extend1.hello</value>
+        <type>String</type>
+    </property>
+</node>
diff --git 
a/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.extend1.hello/1.0.0/extends
 
b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.extend1.hello/1.0.0/extends
new file mode 100644
index 0000000..e5a2d21
--- /dev/null
+++ 
b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.extend1.hello/1.0.0/extends
@@ -0,0 +1 @@
+org.apache.sling.scripting.examplebundle.precompiled.hello;version=[1.0.0,2.0.0)
diff --git 
a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0/h.html
 
b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.extend1.hello/1.0.0/templates.html
similarity index 76%
copy from 
examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0/h.html
copy to 
examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.extend1.hello/1.0.0/templates.html
index f862c0c..175ea4d 100644
--- 
a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0/h.html
+++ 
b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.extend1.hello/1.0.0/templates.html
@@ -1,4 +1,4 @@
-<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ~ 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
@@ -15,5 +15,9 @@
   ~ KIND, either express or implied.  See the License for the
   ~ specific language governing permissions and limitations
   ~ under the License.
-  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-<span id="h-precompiled-1" data-rt="${resource.resourceType}">Hello</span>
+  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<template data-sly-template.precompiled1Template="${ @ name='the name to 
display'}">
+    <div class="precompiled1TemplateExtend1">
+        <p>Hello, extended ${name}!</p>
+    </div>
+</template>
diff --git 
a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0/h.html
 
b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0/h.html
index f862c0c..84afed0 100644
--- 
a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0/h.html
+++ 
b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0/h.html
@@ -17,3 +17,6 @@
   ~ under the License.
   
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
 <span id="h-precompiled-1" data-rt="${resource.resourceType}">Hello</span>
+<div id="h-precompiled-template-wrapper1">
+<sly data-sly-use.templates="templates.html" 
data-sly-call="${templates.precompiled1Template @ name='World'}"></sly>
+</div>
\ No newline at end of file
diff --git a/it/pom.xml b/it/pom.xml
index 09678fe..ff4d280 100644
--- a/it/pom.xml
+++ b/it/pom.xml
@@ -259,6 +259,12 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
+            
<artifactId>org.apache.sling.scripting.examplebundle.precompiled.extend1</artifactId>
+            <version>0.1.1-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
             
<artifactId>org.apache.sling.scripting.examplebundle.precompiled.jsp</artifactId>
             <version>0.1.1-SNAPSHOT</version>
             <scope>test</scope>
diff --git 
a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledExtend1IT.java
 
b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledExtend1IT.java
new file mode 100644
index 0000000..185f9fa
--- /dev/null
+++ 
b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledExtend1IT.java
@@ -0,0 +1,56 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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.scripting.bundle.tracker.it;
+
+import org.jsoup.nodes.Document;
+import org.jsoup.select.Elements;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class ExampleBundlePrecompiledExtend1IT extends 
AbstractEndpointTestBase {
+
+    private static final String ROOT = BASE + 
"/examplebundle-precompiled-extend1";
+
+    // SLING-10015
+    @Test
+    public void testHello() throws Exception {
+        final String expectedRT = 
"org.apache.sling.scripting.examplebundle.precompiled.extend1.hello/1.0.0";
+        Document document = getDocument(ROOT + "/hello.html");
+        Elements h2 = document.select("h2");
+        assertEquals(expectedRT, h2.html());
+        final String expectedScriptDriver = 
"org.apache.sling.scripting.examplebundle.precompiled.hello/2.0.0/hello.html";
+        assertTrue(h2.hasAttr(DATA_SCRIPT) && 
expectedScriptDriver.equals(h2.attr(DATA_SCRIPT)));
+
+        Elements h = document.select("#h-precompiled-2");
+        assertEquals("Resource based servlet resolution failed.", 1, h.size());
+        assertEquals("Hello", h.html());
+        assertEquals(expectedRT, h.attr(DATA_RT_ATTRIBUTE));
+        
+        Elements template = document.select("#h-precompiled-template-wrapper1 
> div.precompiled1TemplateExtend1 > p");
+        assertEquals("Resource based servlet resolution failed.", 1, 
template.size());
+        assertEquals("Hello, overridden World!", template.html());
+
+        Elements w = document.select("#w-precompiled-2");
+        assertEquals("Resource based servlet resolution failed.", 1, w.size());
+        assertEquals("World", w.html());
+        assertEquals(expectedRT, w.attr(DATA_RT_ATTRIBUTE));
+    }
+}
diff --git 
a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledIT.java
 
b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledIT.java
index 09b7e4b..f2c2939 100644
--- 
a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledIT.java
+++ 
b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledIT.java
@@ -89,6 +89,10 @@ public class ExampleBundlePrecompiledIT extends 
AbstractEndpointTestBase {
         assertEquals("Hello", h.html());
         assertEquals(expectedRT, h.attr(DATA_RT_ATTRIBUTE));
 
+        Elements template = document.select("#h-precompiled-template-wrapper1 
> div.precompiled1Template > p");
+        assertEquals("Resource based servlet resolution failed.", 1, 
template.size());
+        assertEquals("Hello, World!", template.html());
+        
         Elements w = document.select("#w-precompiled-1");
         assertEquals("Resource based servlet resolution failed.", 1, w.size());
         assertEquals("World", w.html());
diff --git a/it/src/test/provisioning/it-model.txt 
b/it/src/test/provisioning/it-model.txt
index c69876a..8deb629 100644
--- a/it/src/test/provisioning/it-model.txt
+++ b/it/src/test/provisioning/it-model.txt
@@ -36,6 +36,7 @@
   org.apache.sling/org.apache.sling.scripting.examplebundle.extend1
   org.apache.sling/org.apache.sling.scripting.examplebundle.extend2
   org.apache.sling/org.apache.sling.scripting.examplebundle.precompiled
+  org.apache.sling/org.apache.sling.scripting.examplebundle.precompiled.extend1
   org.apache.sling/org.apache.sling.scripting.examplebundle.precompiled.jsp
   org.apache.sling/org.apache.sling.junit.core
 
diff --git a/pom.xml b/pom.xml
index 5971074..79a153e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,6 +38,7 @@
         
<module>examples/org-apache-sling-scripting-examplebundle-extend1</module>
         
<module>examples/org-apache-sling-scripting-examplebundle-extend2</module>
         
<module>examples/org-apache-sling-scripting-examplebundle-precompiled</module>
+        
<module>examples/org-apache-sling-scripting-examplebundle-precompiled-extend1</module>
         
<module>examples/org-apache-sling-scripting-examplebundle-precompiled-jsp</module>
         <module>it</module>
     </modules>

Reply via email to