You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ra...@apache.org on 2020/04/06 16:06:31 UTC
[sling-org-apache-sling-scripting-bundle-tracker-it] branch master
updated: SLING-9335 - Capabilities based on the extends file should be
merged with capabilities based on resource label scripts
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 a194e58 SLING-9335 - Capabilities based on the extends file should be merged with capabilities based on resource label scripts
a194e58 is described below
commit a194e580e89e85041d8fc2aa9924a7d9ab1d5923
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Mon Apr 6 18:00:51 2020 +0200
SLING-9335 - Capabilities based on the extends file should be merged with capabilities based on resource label scripts
* added a main script for org.apache.sling.scripting.examplebundle.extend2.two,
which also extends org.apache.sling.scripting.examplebundle.extend2.one
* adapted tests
---
.../examplebundle-classic/hello/hello.html | 2 +-
.../1.0.0/h.html | 19 --------------
.../1.0.0/two.html} | 2 +-
.../hello.jsp | 2 +-
.../1.0.0/hello.html | 2 +-
.../2.0.0/hello.html | 2 +-
.../pathcaller.html | 2 +-
.../sling/scripting/examplebundle/hello/hello.html | 2 +-
.../1.0.0/hello.html | 2 +-
.../2.0.0/hello.html | 2 +-
.../tracker/it/AbstractEndpointTestBase.java | 1 +
.../bundle/tracker/it/ExampleBundleExtend1IT.java | 11 ++++++--
.../bundle/tracker/it/ExampleBundleExtend2IT.java | 30 +++++++++++++++++-----
.../it/ExampleBundleExtend2TeleportedIT.java | 6 ++---
.../bundle/tracker/it/ExampleBundleIT.java | 21 ++++++++++++---
.../tracker/it/ExampleBundlePrecompiledIT.java | 23 ++++++++++++++---
.../tracker/it/ExampleBundlePrecompiledJSPIT.java | 6 ++++-
.../scripting/bundle/tracker/it/ITCustomizer.java | 2 --
18 files changed, 86 insertions(+), 51 deletions(-)
diff --git a/examples/org-apache-sling-scripting-examplebundle-classic/src/main/resources/SLING-INF/apps/sling/scripting/examplebundle-classic/hello/hello.html b/examples/org-apache-sling-scripting-examplebundle-classic/src/main/resources/SLING-INF/apps/sling/scripting/examplebundle-classic/hello/hello.html
index 3b17a42..ca61c06 100644
--- a/examples/org-apache-sling-scripting-examplebundle-classic/src/main/resources/SLING-INF/apps/sling/scripting/examplebundle-classic/hello/hello.html
+++ b/examples/org-apache-sling-scripting-examplebundle-classic/src/main/resources/SLING-INF/apps/sling/scripting/examplebundle-classic/hello/hello.html
@@ -16,5 +16,5 @@
~ specific language governing permissions and limitations
~ under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-<h2>${resource.resourceType}</h2>
+<h2 data-script="${javax_script_filename}">${resource.resourceType}</h2>
<sly data-sly-include="h.html"/> <sly data-sly-include="w.html"/>
diff --git a/examples/org-apache-sling-scripting-examplebundle-extend2/src/main/resources/javax.script/org.apache.sling.scripting.examplebundle.extend2.two/1.0.0/h.html b/examples/org-apache-sling-scripting-examplebundle-extend2/src/main/resources/javax.script/org.apache.sling.scripting.examplebundle.extend2.two/1.0.0/h.html
deleted file mode 100644
index d380823..0000000
--- a/examples/org-apache-sling-scripting-examplebundle-extend2/src/main/resources/javax.script/org.apache.sling.scripting.examplebundle.extend2.two/1.0.0/h.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ 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.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-<span id="h-extend2-two" data-rt="${resource.resourceType}">Hello</span>
diff --git a/examples/org-apache-sling-scripting-examplebundle-classic/src/main/resources/SLING-INF/apps/sling/scripting/examplebundle-classic/hello/hello.html b/examples/org-apache-sling-scripting-examplebundle-extend2/src/main/resources/javax.script/org.apache.sling.scripting.examplebundle.extend2.two/1.0.0/two.html
similarity index 93%
copy from examples/org-apache-sling-scripting-examplebundle-classic/src/main/resources/SLING-INF/apps/sling/scripting/examplebundle-classic/hello/hello.html
copy to examples/org-apache-sling-scripting-examplebundle-extend2/src/main/resources/javax.script/org.apache.sling.scripting.examplebundle.extend2.two/1.0.0/two.html
index 3b17a42..ca61c06 100644
--- a/examples/org-apache-sling-scripting-examplebundle-classic/src/main/resources/SLING-INF/apps/sling/scripting/examplebundle-classic/hello/hello.html
+++ b/examples/org-apache-sling-scripting-examplebundle-extend2/src/main/resources/javax.script/org.apache.sling.scripting.examplebundle.extend2.two/1.0.0/two.html
@@ -16,5 +16,5 @@
~ specific language governing permissions and limitations
~ under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-<h2>${resource.resourceType}</h2>
+<h2 data-script="${javax_script_filename}">${resource.resourceType}</h2>
<sly data-sly-include="h.html"/> <sly data-sly-include="w.html"/>
diff --git a/examples/org-apache-sling-scripting-examplebundle-precompiled-jsp/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.jsp.hello/hello.jsp b/examples/org-apache-sling-scripting-examplebundle-precompiled-jsp/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.jsp.hello/hello.jsp
index 3bb2653..6c5a969 100644
--- a/examples/org-apache-sling-scripting-examplebundle-precompiled-jsp/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.jsp.hello/hello.jsp
+++ b/examples/org-apache-sling-scripting-examplebundle-precompiled-jsp/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.jsp.hello/hello.jsp
@@ -18,5 +18,5 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
<%@page session="false" pageEncoding="utf-8"%>
<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.2"%>
-<h2>${resource.resourceType}</h2>
+<h2 data-script="${javax_script_filename}">${resource.resourceType}</h2>
<sling:call script="h.jsp"/><sling:call script="w.jsp"/>
diff --git a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0/hello.html b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0/hello.html
index 3b17a42..ca61c06 100644
--- a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0/hello.html
+++ b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0/hello.html
@@ -16,5 +16,5 @@
~ specific language governing permissions and limitations
~ under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-<h2>${resource.resourceType}</h2>
+<h2 data-script="${javax_script_filename}">${resource.resourceType}</h2>
<sly data-sly-include="h.html"/> <sly data-sly-include="w.html"/>
diff --git a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/2.0.0/hello.html b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/2.0.0/hello.html
index efc73e3..cd588dc 100644
--- a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/2.0.0/hello.html
+++ b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.hello/2.0.0/hello.html
@@ -16,7 +16,7 @@
~ specific language governing permissions and limitations
~ under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-<h2>${resource.resourceType}</h2>
+<h2 data-script="${javax_script_filename}">${resource.resourceType}</h2>
<sly data-sly-include="h.html"/> <sly data-sly-include="w.html"/>
<div data-sly-use.slingSettings="org.apache.sling.settings.SlingSettingsService"
data-sly-test.slingId="${slingSettings.slingId}"
diff --git a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.pathcaller/pathcaller.html b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.pathcaller/pathcaller.html
index 5216d5f..7b1cfeb 100644
--- a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.pathcaller/pathcaller.html
+++ b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/org.apache.sling.scripting.examplebundle.precompiled.pathcaller/pathcaller.html
@@ -16,5 +16,5 @@
~ specific language governing permissions and limitations
~ under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-<h2>${resource.resourceType}</h2>
+<h2 data-script="${javax_script_filename}">${resource.resourceType}</h2>
<div class="caller" data-sly-include="/apps/org.apache.sling.scripting.examplebundle.precompiled.path/path-script.html"></div>
diff --git a/examples/org-apache-sling-scripting-examplebundle/src/main/resources/javax.script/apps/sling/scripting/examplebundle/hello/hello.html b/examples/org-apache-sling-scripting-examplebundle/src/main/resources/javax.script/apps/sling/scripting/examplebundle/hello/hello.html
index 3b17a42..ca61c06 100644
--- a/examples/org-apache-sling-scripting-examplebundle/src/main/resources/javax.script/apps/sling/scripting/examplebundle/hello/hello.html
+++ b/examples/org-apache-sling-scripting-examplebundle/src/main/resources/javax.script/apps/sling/scripting/examplebundle/hello/hello.html
@@ -16,5 +16,5 @@
~ specific language governing permissions and limitations
~ under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-<h2>${resource.resourceType}</h2>
+<h2 data-script="${javax_script_filename}">${resource.resourceType}</h2>
<sly data-sly-include="h.html"/> <sly data-sly-include="w.html"/>
diff --git a/examples/org-apache-sling-scripting-examplebundle/src/main/resources/javax.script/org.apache.sling.scripting.examplebundle.hello/1.0.0/hello.html b/examples/org-apache-sling-scripting-examplebundle/src/main/resources/javax.script/org.apache.sling.scripting.examplebundle.hello/1.0.0/hello.html
index 3b17a42..ca61c06 100644
--- a/examples/org-apache-sling-scripting-examplebundle/src/main/resources/javax.script/org.apache.sling.scripting.examplebundle.hello/1.0.0/hello.html
+++ b/examples/org-apache-sling-scripting-examplebundle/src/main/resources/javax.script/org.apache.sling.scripting.examplebundle.hello/1.0.0/hello.html
@@ -16,5 +16,5 @@
~ specific language governing permissions and limitations
~ under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-<h2>${resource.resourceType}</h2>
+<h2 data-script="${javax_script_filename}">${resource.resourceType}</h2>
<sly data-sly-include="h.html"/> <sly data-sly-include="w.html"/>
diff --git a/examples/org-apache-sling-scripting-examplebundle/src/main/resources/javax.script/org.apache.sling.scripting.examplebundle.hello/2.0.0/hello.html b/examples/org-apache-sling-scripting-examplebundle/src/main/resources/javax.script/org.apache.sling.scripting.examplebundle.hello/2.0.0/hello.html
index 3b17a42..ca61c06 100644
--- a/examples/org-apache-sling-scripting-examplebundle/src/main/resources/javax.script/org.apache.sling.scripting.examplebundle.hello/2.0.0/hello.html
+++ b/examples/org-apache-sling-scripting-examplebundle/src/main/resources/javax.script/org.apache.sling.scripting.examplebundle.hello/2.0.0/hello.html
@@ -16,5 +16,5 @@
~ specific language governing permissions and limitations
~ under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-<h2>${resource.resourceType}</h2>
+<h2 data-script="${javax_script_filename}">${resource.resourceType}</h2>
<sly data-sly-include="h.html"/> <sly data-sly-include="w.html"/>
diff --git a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/AbstractEndpointTestBase.java b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/AbstractEndpointTestBase.java
index 1e60174..c8bef6b 100644
--- a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/AbstractEndpointTestBase.java
+++ b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/AbstractEndpointTestBase.java
@@ -52,6 +52,7 @@ public abstract class AbstractEndpointTestBase {
protected int contentFindRetryDelay = 1000;
protected static final String BASE = "/content/bundled-scripts";
protected static final String DATA_RT_ATTRIBUTE = "data-rt";
+ protected static final String DATA_SCRIPT = "data-script";
@ClassRule
public static final SlingInstanceRule SLING_INSTANCE_RULE = new SlingInstanceRule();
diff --git a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleExtend1IT.java b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleExtend1IT.java
index 45d9b98..350d52a 100644
--- a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleExtend1IT.java
+++ b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleExtend1IT.java
@@ -23,6 +23,7 @@ import org.jsoup.select.Elements;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
public class ExampleBundleExtend1IT extends AbstractEndpointTestBase {
@@ -33,7 +34,10 @@ public class ExampleBundleExtend1IT extends AbstractEndpointTestBase {
final String expectedRT = "org.apache.sling.scripting.examplebundle.extend1.hello/1.0.0";
Document document = getDocument(ROOT + "/hello.html");
- assertEquals(expectedRT, document.select("h2").html());
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver = "org__002e__apache__002e__sling__002e__scripting__002e__examplebundle__002e__precompiled__002e__hello.__0031____002e__0__002e__0.hello__002e__html";
+ assertTrue(h2.hasAttr(DATA_SCRIPT) && expectedScriptDriver.equals(h2.attr(DATA_SCRIPT)));
Elements h = document.select("#h-extend1");
assertEquals("Resource based servlet resolution failed.", 1, h.size());
@@ -52,7 +56,10 @@ public class ExampleBundleExtend1IT extends AbstractEndpointTestBase {
final String expectedRT = "org.apache.sling.scripting.examplebundle.extend1.hello/1.0.0";
Document document = getDocument(ROOT + "/hello-v1.html");
- assertEquals(expectedRT, document.select("h2").html());
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver = "org__002e__apache__002e__sling__002e__scripting__002e__examplebundle__002e__precompiled__002e__hello.__0031____002e__0__002e__0.hello__002e__html";
+ assertTrue(h2.hasAttr(DATA_SCRIPT) && expectedScriptDriver.equals(h2.attr(DATA_SCRIPT)));
Elements h = document.select("#h-extend1");
assertEquals("Resource based servlet resolution failed.", 1, h.size());
diff --git a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleExtend2IT.java b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleExtend2IT.java
index 4df7fe5..41f8c96 100644
--- a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleExtend2IT.java
+++ b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleExtend2IT.java
@@ -23,6 +23,7 @@ import org.jsoup.select.Elements;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
public class ExampleBundleExtend2IT extends AbstractEndpointTestBase {
@@ -33,7 +34,10 @@ public class ExampleBundleExtend2IT extends AbstractEndpointTestBase {
final String expectedRT = "org.apache.sling.scripting.examplebundle.extend2.one/1.0.0";
Document document = getDocument(ROOT + "/one.html");
- assertEquals(expectedRT, document.select("h2").html());
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver = "org__002e__apache__002e__sling__002e__scripting__002e__examplebundle__002e__precompiled__002e__hello.__0031____002e__0__002e__0.hello__002e__html";
+ assertTrue(h2.hasAttr(DATA_SCRIPT) && expectedScriptDriver.equals(h2.attr(DATA_SCRIPT)));
Elements h = document.select("#h-extend2-one");
assertEquals("Resource based servlet resolution failed.", 1, h.size());
@@ -52,7 +56,10 @@ public class ExampleBundleExtend2IT extends AbstractEndpointTestBase {
final String expectedRT = "org.apache.sling.scripting.examplebundle.extend2.one/1.0.0";
Document document = getDocument(ROOT + "/one-v1.html");
- assertEquals(expectedRT, document.select("h2").html());
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver = "org__002e__apache__002e__sling__002e__scripting__002e__examplebundle__002e__precompiled__002e__hello.__0031____002e__0__002e__0.hello__002e__html";
+ assertTrue(h2.hasAttr(DATA_SCRIPT) && expectedScriptDriver.equals(h2.attr(DATA_SCRIPT)));
Elements h = document.select("#h-extend2-one");
assertEquals("Resource based servlet resolution failed.", 1, h.size());
@@ -71,9 +78,12 @@ public class ExampleBundleExtend2IT extends AbstractEndpointTestBase {
final String expectedRT = "org.apache.sling.scripting.examplebundle.extend2.two/1.0.0";
Document document = getDocument(ROOT + "/two.html");
- assertEquals(expectedRT, document.select("h2").html());
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver = "/javax.script/org.apache.sling.scripting.examplebundle.extend2.two/1.0.0/two.html";
+ assertTrue(h2.hasAttr(DATA_SCRIPT) && expectedScriptDriver.equals(h2.attr(DATA_SCRIPT)));
- Elements h = document.select("#h-extend2-two");
+ Elements h = document.select("#h-extend2-one");
assertEquals("Resource based servlet resolution failed.", 1, h.size());
assertEquals("Hello", h.html());
assertEquals(expectedRT, h.attr(DATA_RT_ATTRIBUTE));
@@ -90,9 +100,12 @@ public class ExampleBundleExtend2IT extends AbstractEndpointTestBase {
final String expectedRT = "org.apache.sling.scripting.examplebundle.extend2.two/1.0.0";
Document document = getDocument(ROOT + "/two-v1.html");
- assertEquals(expectedRT, document.select("h2").html());
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver = "/javax.script/org.apache.sling.scripting.examplebundle.extend2.two/1.0.0/two.html";
+ assertTrue(h2.hasAttr(DATA_SCRIPT) && expectedScriptDriver.equals(h2.attr(DATA_SCRIPT)));
- Elements h = document.select("#h-extend2-two");
+ Elements h = document.select("#h-extend2-one");
assertEquals("Resource based servlet resolution failed.", 1, h.size());
assertEquals("Hello", h.html());
assertEquals(expectedRT, h.attr(DATA_RT_ATTRIBUTE));
@@ -109,7 +122,10 @@ public class ExampleBundleExtend2IT extends AbstractEndpointTestBase {
final String expectedRT = "org.apache.sling.scripting.examplebundle.extend2.three";
Document document = getDocument(ROOT + "/three.html");
- assertEquals(expectedRT, document.select("h2").html());
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver = "/javax.script/apps/sling/scripting/examplebundle/hello/hello.html";
+ assertTrue(h2.hasAttr(DATA_SCRIPT) && expectedScriptDriver.equals(h2.attr(DATA_SCRIPT)));
Elements h = document.select("#h-extend2-three");
assertEquals("Resource based servlet resolution failed.", 1, h.size());
diff --git a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleExtend2TeleportedIT.java b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleExtend2TeleportedIT.java
index 1feccbc..e71d5d2 100644
--- a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleExtend2TeleportedIT.java
+++ b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleExtend2TeleportedIT.java
@@ -69,9 +69,9 @@ public class ExampleBundleExtend2TeleportedIT extends AbstractTeleportedTestBase
Set<String> expectedChildren = getChildrenForServletResource(
"/apps/" + expectedRT,
- "h.html",
- "h.html.servlet",
- "html.servlet"
+ "html.servlet",
+ "two.html",
+ "two.html.servlet"
);
assertEquals(expectedChildren, children.keySet());
diff --git a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleIT.java b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleIT.java
index c5edfd0..330081c 100644
--- a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleIT.java
+++ b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleIT.java
@@ -23,6 +23,7 @@ import org.jsoup.select.Elements;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
public class ExampleBundleIT extends AbstractEndpointTestBase {
@@ -32,7 +33,10 @@ public class ExampleBundleIT extends AbstractEndpointTestBase {
public void testHello() throws Exception {
final String expectedRT = "org.apache.sling.scripting.examplebundle.hello/2.0.0";
Document document = getDocument(ROOT + "/hello.html");
- assertEquals(expectedRT, document.select("h2").html());
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver = "/javax.script/org.apache.sling.scripting.examplebundle.hello/2.0.0/hello.html";
+ assertTrue(h2.hasAttr(DATA_SCRIPT) && expectedScriptDriver.equals(h2.attr(DATA_SCRIPT)));
Elements h = document.select("#h-2");
assertEquals("Resource based servlet resolution failed.", 1, h.size());
@@ -49,7 +53,10 @@ public class ExampleBundleIT extends AbstractEndpointTestBase {
public void testHelloV2() throws Exception {
final String expectedRT = "org.apache.sling.scripting.examplebundle.hello/2.0.0";
Document document = getDocument(ROOT + "/hello-v2.html");
- assertEquals(expectedRT, document.select("h2").html());
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver = "/javax.script/org.apache.sling.scripting.examplebundle.hello/2.0.0/hello.html";
+ assertTrue(h2.hasAttr(DATA_SCRIPT) && expectedScriptDriver.equals(h2.attr(DATA_SCRIPT)));
Elements h = document.select("#h-2");
assertEquals("Resource based servlet resolution failed.", 1, h.size());
@@ -66,7 +73,10 @@ public class ExampleBundleIT extends AbstractEndpointTestBase {
public void testHelloV1() throws Exception {
final String expectedRT = "org.apache.sling.scripting.examplebundle.hello/1.0.0";
Document document = getDocument(ROOT + "/hello-v1.html");
- assertEquals(expectedRT, document.select("h2").html());
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver = "/javax.script/org.apache.sling.scripting.examplebundle.hello/1.0.0/hello.html";
+ assertTrue(h2.hasAttr(DATA_SCRIPT) && expectedScriptDriver.equals(h2.attr(DATA_SCRIPT)));
Elements h = document.select("#h-1");
assertEquals("Resource based servlet resolution failed.", 1, h.size());
@@ -83,7 +93,10 @@ public class ExampleBundleIT extends AbstractEndpointTestBase {
public void testAppsHello() throws Exception {
final String expectedRT = "sling/scripting/examplebundle/hello";
Document document = getDocument(ROOT + "/apps-hello.html");
- assertEquals(expectedRT, document.select("h2").html());
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver = "/javax.script/apps/sling/scripting/examplebundle/hello/hello.html";
+ assertTrue(h2.hasAttr(DATA_SCRIPT) && expectedScriptDriver.equals(h2.attr(DATA_SCRIPT)));
Elements h = document.select("#h-examplebundle-hello");
assertEquals("Resource based servlet resolution failed.", 1, h.size());
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 1b8e900..9332566 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
@@ -23,6 +23,7 @@ import org.jsoup.select.Elements;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
public class ExampleBundlePrecompiledIT extends AbstractEndpointTestBase {
@@ -32,7 +33,10 @@ public class ExampleBundlePrecompiledIT extends AbstractEndpointTestBase {
public void testHello() throws Exception {
final String expectedRT = "org.apache.sling.scripting.examplebundle.precompiled.hello/2.0.0";
Document document = getDocument(ROOT + "/hello.html");
- assertEquals(expectedRT, document.select("h2").html());
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver = "org__002e__apache__002e__sling__002e__scripting__002e__examplebundle__002e__precompiled__002e__hello.__0032____002e__0__002e__0.hello__002e__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());
@@ -49,7 +53,10 @@ public class ExampleBundlePrecompiledIT extends AbstractEndpointTestBase {
public void testHelloV2() throws Exception {
final String expectedRT = "org.apache.sling.scripting.examplebundle.precompiled.hello/2.0.0";
Document document = getDocument(ROOT + "/hello-v2.html");
- assertEquals(expectedRT, document.select("h2").html());
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver = "org__002e__apache__002e__sling__002e__scripting__002e__examplebundle__002e__precompiled__002e__hello.__0032____002e__0__002e__0.hello__002e__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());
@@ -66,7 +73,11 @@ public class ExampleBundlePrecompiledIT extends AbstractEndpointTestBase {
public void testHelloV1() throws Exception {
final String expectedRT = "org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0";
Document document = getDocument(ROOT + "/hello-v1.html");
- assertEquals(expectedRT, document.select("h2").html());
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver =
+ "org__002e__apache__002e__sling__002e__scripting__002e__examplebundle__002e__precompiled__002e__hello.__0031____002e__0__002e__0.hello__002e__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());
@@ -85,7 +96,11 @@ public class ExampleBundlePrecompiledIT extends AbstractEndpointTestBase {
final String callee = ("apps.org__002e__apache__002e__sling__002e__scripting__002e__examplebundle__002e__precompiled__002e__path" +
".path__002d__script__002e__html");
Document document = getDocument(ROOT + "/path-based-servlet.html");
- assertEquals(expectedRT, document.select("h2").html());
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver =
+ "org__002e__apache__002e__sling__002e__scripting__002e__examplebundle__002e__precompiled__002e__pathcaller.pathcaller__002e__html";
+ assertTrue(h2.hasAttr(DATA_SCRIPT) && expectedScriptDriver.equals(h2.attr(DATA_SCRIPT)));
assertEquals("Cannot detect callee script which is supposed to be a path based servlet.", callee,
document.select("div.caller > span.script").html());
}
diff --git a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledJSPIT.java b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledJSPIT.java
index be0a1e9..484d7f0 100644
--- a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledJSPIT.java
+++ b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledJSPIT.java
@@ -23,6 +23,7 @@ import org.jsoup.select.Elements;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
public class ExampleBundlePrecompiledJSPIT extends AbstractEndpointTestBase {
@@ -32,7 +33,10 @@ public class ExampleBundlePrecompiledJSPIT extends AbstractEndpointTestBase {
public void testHello() throws Exception {
final String expectedRT = "org.apache.sling.scripting.examplebundle.precompiled.jsp.hello";
Document document = getDocument(ROOT + "/hello.html");
- assertEquals(expectedRT, document.select("h2").html());
+ Elements h2 = document.select("h2");
+ assertEquals(expectedRT, h2.html());
+ final String expectedScriptDriver = "org__002e__apache__002e__sling__002e__scripting__002e__examplebundle__002e__precompiled__002e__jsp__002e__hello.hello__002e__jsp";
+ assertTrue(h2.hasAttr(DATA_SCRIPT) && expectedScriptDriver.equals(h2.attr(DATA_SCRIPT)));
Elements h = document.select("#h-precompiled-jsp");
assertEquals("Resource based servlet resolution failed.", 1, h.size());
diff --git a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ITCustomizer.java b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ITCustomizer.java
index 7b788f8..5e37a35 100644
--- a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ITCustomizer.java
+++ b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ITCustomizer.java
@@ -34,7 +34,5 @@ public class ITCustomizer implements TeleporterRule.Customizer {
cst.includeDependencyPrefix("org.ops4j.pax.tinybundles");
cst.includeDependencyPrefix("org.apache.sling.scripting.bundle.tracker.it");
cst.setTestReadyTimeoutSeconds(20);
- cst.setPreventToUninstallBundle(true);
- cst.setEnableLogging(true);
}
}