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/20 17:07:43 UTC
[sling-org-apache-sling-scripting-bundle-tracker-it] branch master
updated: SLING-9320 - Allow precompiled units to access objects from the
same bundle through the Use API
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 c3df5af SLING-9320 - Allow precompiled units to access objects from the same bundle through the Use API
c3df5af is described below
commit c3df5afe355c83d7c0e1c7cb5708f0a414680976
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Mon Apr 20 19:07:02 2020 +0200
SLING-9320 - Allow precompiled units to access objects from the same bundle through the Use API
* extended the JsUseProvider to allow finding dependencies belonging to the same
resource type even if the dependencies are served by different providers
---
.../pom.xml | 3 ++-
.../1.0.0/use-script-repo.js | 23 ++++++++++++++++++++++
.../1.0.0/two.html | 1 +
.../bundle/tracker/it/ExampleBundleExtend2IT.java | 3 +++
.../it/ExampleBundleExtend2TeleportedIT.java | 5 +++--
5 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/examples/org-apache-sling-scripting-examplebundle-extend2/pom.xml b/examples/org-apache-sling-scripting-examplebundle-extend2/pom.xml
index 9338145..4f0c2e5 100644
--- a/examples/org-apache-sling-scripting-examplebundle-extend2/pom.xml
+++ b/examples/org-apache-sling-scripting-examplebundle-extend2/pom.xml
@@ -67,7 +67,8 @@
${org.apache.sling.scriptingbundle.maven.plugin.Require-Capability}
</Require-Capability>
<Sling-Initial-Content>
- SLING-INF/content;overwrite:=true;path:=/content/bundled-scripts/examplebundle-extend2
+ SLING-INF/content;overwrite:=true;path:=/content/bundled-scripts/examplebundle-extend2,
+ SLING-INF/apps/org.apache.sling.scripting.examplebundle.extend2.two/1.0.0;overwrite:=true;path:=/apps/org.apache.sling.scripting.examplebundle.extend2.two/1.0.0
</Sling-Initial-Content>
</instructions>
</configuration>
diff --git a/examples/org-apache-sling-scripting-examplebundle-extend2/src/main/resources/SLING-INF/apps/org.apache.sling.scripting.examplebundle.extend2.two/1.0.0/use-script-repo.js b/examples/org-apache-sling-scripting-examplebundle-extend2/src/main/resources/SLING-INF/apps/org.apache.sling.scripting.examplebundle.extend2.two/1.0.0/use-script-repo.js
new file mode 100644
index 0000000..b0252f7
--- /dev/null
+++ b/examples/org-apache-sling-scripting-examplebundle-extend2/src/main/resources/SLING-INF/apps/org.apache.sling.scripting.examplebundle.extend2.two/1.0.0/use-script-repo.js
@@ -0,0 +1,23 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/*global use*/
+use(function() {
+ 'use strict';
+ return 'use-script-repo.js says hello';
+});
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/two.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
index ad48b9c..63d3480 100644
--- a/examples/org-apache-sling-scripting-examplebundle-extend2/src/main/resources/javax.script/org.apache.sling.scripting.examplebundle.extend2.two/1.0.0/two.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
@@ -28,3 +28,4 @@
data-sly-use.absolutePathTemplates2="/apps/sling/scripting/examplebundle/hello/templates.html"
data-sly-call="${absolutePathTemplates2.exampledBundleAppsHello @ name = 'Jack Schitt'}"></div>
<div class="js-use" data-sly-use.js="use-script.js">${js}</div>
+<div class="js-use-resource-type-repository" data-sly-use.jsrepo="use-script-repo.js">${jsrepo}</div>
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 51e3f8c..b808c70 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
@@ -114,6 +114,9 @@ public class ExampleBundleExtend2IT extends AbstractEndpointTestBase {
Elements jsUse = document.select("div.js-use");
assertEquals("Expected a js-use script to have rendered content", "Hello, Jack Black!", jsUse.html());
+
+ Elements jsUseRepo = document.select("div.js-use-resource-type-repository");
+ assertEquals("Expected a js-use script to have rendered content", "use-script-repo.js says hello", jsUseRepo.html());
}
@Test
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 f475038..90a0c65 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
@@ -68,7 +68,7 @@ public class ExampleBundleExtend2TeleportedIT extends AbstractTeleportedTestBase
assertNotNull(main);
assertEquals("org.apache.sling.scripting.examplebundle.extend2.one/1.0.0", main.getResourceSuperType());
Map<String, Resource> children = collectResourceChildren(main);
- assertEquals(5, children.size());
+ assertEquals(6, children.size());
Set<String> expectedChildren = getChildrenForServletResource(
"/apps/" + expectedRT,
@@ -76,7 +76,8 @@ public class ExampleBundleExtend2TeleportedIT extends AbstractTeleportedTestBase
"two.html",
"two.html.servlet",
"two-templates.html",
- "two-templates.html.servlet"
+ "two-templates.html.servlet",
+ "use-script-repo.js"
);
assertEquals(expectedChildren, children.keySet());