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/09/03 16:56:59 UTC

[sling-org-apache-sling-scripting-bundle-tracker-it] 01/02: SLING-9718 - Relative paths for bundled HTL template files are not correctly handled

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

commit cef5f6a16b3b651ebf6ec16137cb3374669a7c78
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Thu Sep 3 18:49:04 2020 +0200

    SLING-9718 - Relative paths for bundled HTL template files are not correctly handled
    
    * if a servlet resource is found, work directly with its path to find the script class
    or bundle entry
    * corrected class name / file name when working with identifiers containing
    relative path segments
---
 .../1.0.0/two.html                                                     | 2 ++
 it/pom.xml                                                             | 2 +-
 .../sling/scripting/bundle/tracker/it/ExampleBundleExtend2IT.java      | 3 +++
 3 files changed, 6 insertions(+), 1 deletion(-)

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 63d3480..126d594 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
@@ -21,6 +21,8 @@
 <sly data-sly-use.twoTemplates="two-templates.html" data-sly-call="${twoTemplates.two}"></sly>
 <div class="inherited" data-sly-use.inheritedTemplates="templates.html"
        data-sly-call="${inheritedTemplates.precompiled1Template @ name ='John Doe'}"></div>
+<div class="inherited-relative" data-sly-use.inheritedTemplates="./templates.html"
+     data-sly-call="${inheritedTemplates.precompiled1Template @ name ='John Doe'}"></div>
 <div class="absolute-path-1"
      data-sly-use.absolutePathTemplates1="/org.apache.sling.scripting.examplebundle.precompiled.hello/1.0.0/templates.html"
      data-sly-call="${absolutePathTemplates1.precompiled1Template @ name ='John Doe'}"></div>
diff --git a/it/pom.xml b/it/pom.xml
index 01afbdf..09678fe 100644
--- a/it/pom.xml
+++ b/it/pom.xml
@@ -200,7 +200,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.scripting.sightly</artifactId>
-            <version>1.4.2-1.4.0</version>
+            <version>1.4.3-1.4.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
         <dependency>
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 063339d..22c947d 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
@@ -106,6 +106,9 @@ public class ExampleBundleExtend2IT extends AbstractEndpointTestBase {
         Elements inheritedTemplate = document.select("div.inherited > div.precompiled1Template > p");
         assertEquals("Hello, John Doe!", inheritedTemplate.html());
 
+        Elements inheritedTemplateViaRelativePath = document.select("div.inherited-relative > div.precompiled1Template > p");
+        assertEquals("Hello, John Doe!", inheritedTemplateViaRelativePath.html());
+
         Elements absoluteTemplate1 = document.select("div.absolute-path-1 > div.precompiled1Template > p");
         assertEquals("Hello, John Doe!", absoluteTemplate1.html());