You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by pa...@apache.org on 2022/03/11 14:13:23 UTC
[sling-org-apache-sling-scripting-bundle-tracker-it] branch master updated: SLING-11155: add a test to make sure we bind proxy resource type registrations by full path only (#5)
This is an automated email from the ASF dual-hosted git repository.
pauls 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 88656cb SLING-11155: add a test to make sure we bind proxy resource type registrations by full path only (#5)
88656cb is described below
commit 88656cbe05116848ec1ca7c7efcd1f68b0898dca
Author: Karl Pauls <ka...@gmail.com>
AuthorDate: Fri Mar 11 15:13:18 2022 +0100
SLING-11155: add a test to make sure we bind proxy resource type registrations by full path only (#5)
---
.../src/main/scripts/apps/rt2/extends | 1 +
.../pom.xml | 53 ++++++++++++----------
.../main/resources/javax.script/libs/rt/rt.html | 19 ++++++++
it/pom.xml | 6 +++
.../it/ExampleBundlePrecompiledTeleportedIT.java | 15 ++++++
it/src/test/provisioning/it-model.txt | 1 +
pom.xml | 1 +
7 files changed, 73 insertions(+), 23 deletions(-)
diff --git a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/apps/rt2/extends b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/apps/rt2/extends
new file mode 100644
index 0000000..6ec52fa
--- /dev/null
+++ b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/apps/rt2/extends
@@ -0,0 +1 @@
+rt
\ No newline at end of file
diff --git a/pom.xml b/examples/org-apache-sling-scripting-examplebundle-static/pom.xml
similarity index 55%
copy from pom.xml
copy to examples/org-apache-sling-scripting-examplebundle-static/pom.xml
index 07de5d8..549f556 100644
--- a/pom.xml
+++ b/examples/org-apache-sling-scripting-examplebundle-static/pom.xml
@@ -20,44 +20,51 @@
<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>
+ <artifactId>sling-bundle-parent</artifactId>
+ <version>41</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>org.apache.sling.scripting.bundle.tracker.it.reactor</artifactId>
+ <artifactId>org.apache.sling.scripting.examplebundle.static</artifactId>
<version>0.1.1-SNAPSHOT</version>
- <packaging>pom</packaging>
-
- <modules>
- <module>examples/org-apache-sling-scripting-examplebundle</module>
- <module>examples/org-apache-sling-scripting-examplebundle-classic</module>
- <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>examples/org-apache-sling-scripting-content-package-with-bundle-attached</module>
- <module>it</module>
- </modules>
<build>
<plugins>
<plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
<configuration>
- <excludes combine.children="append">
- <exclude>**/*.md</exclude>
- <exclude>*/target/**</exclude>
- <exclude>**/*.iml</exclude>
- </excludes>
+ <skip>true</skip>
</configuration>
</plugin>
+<plugin>
+ <groupId>biz.aQute.bnd</groupId>
+ <artifactId>bnd-baseline-maven-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+<Provide-Capability>sling.servlet;sling.servlet.resourceTypes:List<String>="/libs/rt,rt";scriptEngine=htl;scriptExtension=html</Provide-Capability>
+<Require-Capability>osgi.extender;filter:="(&(osgi.extender=sling.scripting)(version>=1.0.0)(!(version>=2.0.0)))"</Require-Capability>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
</plugins>
</build>
+ <dependencies>
+ </dependencies>
+
</project>
diff --git a/examples/org-apache-sling-scripting-examplebundle-static/src/main/resources/javax.script/libs/rt/rt.html b/examples/org-apache-sling-scripting-examplebundle-static/src/main/resources/javax.script/libs/rt/rt.html
new file mode 100644
index 0000000..de3f066
--- /dev/null
+++ b/examples/org-apache-sling-scripting-examplebundle-static/src/main/resources/javax.script/libs/rt/rt.html
@@ -0,0 +1,19 @@
+<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
+/libs/rt
\ No newline at end of file
diff --git a/it/pom.xml b/it/pom.xml
index 5221057..c869f9f 100644
--- a/it/pom.xml
+++ b/it/pom.xml
@@ -271,6 +271,12 @@
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.scripting.examplebundle.static</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/ExampleBundlePrecompiledTeleportedIT.java b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledTeleportedIT.java
index 8a3d618..617b4bd 100644
--- a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledTeleportedIT.java
+++ b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledTeleportedIT.java
@@ -30,6 +30,7 @@ import org.junit.Test;
import static junit.framework.TestCase.assertNull;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -113,4 +114,18 @@ public class ExampleBundlePrecompiledTeleportedIT extends AbstractTeleportedTest
assertNull(main.getResourceSuperType());
}
}
+
+ @Test
+ public void testRt() throws LoginException {
+ final String expectedRT = "rt";
+ ResourceResolverFactory resourceResolverFactory = teleporter.getService(ResourceResolverFactory.class);
+ try (ResourceResolver resolver = resourceResolverFactory.getResourceResolver(AUTH_MAP)) {
+ Resource apps = resolver.resolve("/apps/" + expectedRT + "/rt.html");
+ assertTrue(Resource.RESOURCE_TYPE_NON_EXISTING.equals(apps.getResourceType()));
+
+ Resource libs = resolver.resolve("/libs/" + expectedRT + "/rt.html");
+ assertFalse(Resource.RESOURCE_TYPE_NON_EXISTING.equals(libs.getResourceType()));
+ assertEquals("BundledScriptServlet (/libs/rt/rt.html)", libs.getValueMap().get("servletName"));
+ }
+ }
}
diff --git a/it/src/test/provisioning/it-model.txt b/it/src/test/provisioning/it-model.txt
index 409b9ff..b5b8288 100644
--- a/it/src/test/provisioning/it-model.txt
+++ b/it/src/test/provisioning/it-model.txt
@@ -39,6 +39,7 @@
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.scripting.examplebundle.static
org.apache.sling/org.apache.sling.scripting.content-package-with-bundle-attached/0.1.1-SNAPSHOT/zip
org.apache.sling/org.apache.sling.scripting.content-package-with-bundle-attached/0.1.1-SNAPSHOT/jar/precompiled-scripts
org.apache.sling/org.apache.sling.junit.core
diff --git a/pom.xml b/pom.xml
index 07de5d8..6638299 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,6 +41,7 @@
<module>examples/org-apache-sling-scripting-examplebundle-precompiled-extend1</module>
<module>examples/org-apache-sling-scripting-examplebundle-precompiled-jsp</module>
<module>examples/org-apache-sling-scripting-content-package-with-bundle-attached</module>
+ <module>examples/org-apache-sling-scripting-examplebundle-static</module>
<module>it</module>
</modules>