This is an automated email from the ASF dual-hosted git repository.
radu pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-bundle-tracker-it.git
The following commit(s) were added to refs/heads/master by this push:
new 2abdce4 SLING-10188 - Reduce the number of service registrations for
inheriting BundledScriptServlets
2abdce4 is described below
commit 2abdce4511a8a0c7c165ab5d467403eec23cbd90
Author: Radu Cotescu <[email protected]>
AuthorDate: Fri Mar 12 18:19:18 2021 +0100
SLING-10188 - Reduce the number of service registrations for inheriting
BundledScriptServlets
* merge capabilities that provide only extend info with other capabilities
with the same
resource type
---
.../content/examplebundle-precompiled-extend1.xml | 9 ++++++++
.../0.9.0/extends | 1 +
.../it/ExampleBundlePrecompiledExtend1IT.java | 24 ++++++++++++++++++++++
3 files changed, 34 insertions(+)
diff --git
a/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/resources/SLING-INF/content/examplebundle-precompiled-extend1.xml
b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/resources/SLING-INF/content/examplebundle-precompiled-extend1.xml
index a85f2b1..5dd1980 100644
---
a/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/resources/SLING-INF/content/examplebundle-precompiled-extend1.xml
+++
b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/resources/SLING-INF/content/examplebundle-precompiled-extend1.xml
@@ -26,3 +26,12 @@
<type>String</type>
</property>
</node>
+<node>
+<name>hello-v0_9</name>
+<primaryNodeType>nt:unstructured</primaryNodeType>
+<property>
+ <name>sling:resourceType</name>
+
<value>org.apache.sling.scripting.examplebundle.precompiled.extend1.hello/0.9.0</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/0.9.0/extends
b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.extend1.hello/0.9.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/0.9.0/extends
@@ -0,0 +1 @@
+org.apache.sling.scripting.examplebundle.precompiled.hello;version=[1.0.0,2.0.0)
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
index 37269a6..a0f7030 100644
---
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
@@ -53,4 +53,28 @@ public class ExampleBundlePrecompiledExtend1IT extends
AbstractEndpointTestBase
assertEquals("World", w.html());
assertEquals(expectedRT, w.attr(DATA_RT_ATTRIBUTE));
}
+
+ @Test
+ public void testHello_0_9() throws Exception {
+ final String expectedRT =
"org.apache.sling.scripting.examplebundle.precompiled.extend1.hello/0.9.0";
+ Document document = getDocument(ROOT + "/hello-v0_9.html");
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver =
"org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0/hello.html";
+ assertTrue(h2.hasAttr(DATA_SCRIPT) &&
expectedScriptDriver.equals(h2.attr(DATA_SCRIPT)));
+
+ Elements h = document.select("#h-precompiled-1");
+ 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.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());
+ assertEquals(expectedRT, w.attr(DATA_RT_ATTRIBUTE));
+ }
}