SLING-11155: add a test to make sure we bind proxy resource type registrations by full path only
diff --git a/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/libs/rt/rt.html b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/libs/rt/rt.html
new file mode 100644
index 0000000..de3f066
--- /dev/null
+++ b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/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/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/examples/org-apache-sling-scripting-examplebundle-static/pom.xml b/examples/org-apache-sling-scripting-examplebundle-static/pom.xml
new file mode 100644
index 0000000..549f556
--- /dev/null
+++ b/examples/org-apache-sling-scripting-examplebundle-static/pom.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<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-bundle-parent</artifactId>
+ <version>41</version>
+ <relativePath/>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>org.apache.sling.scripting.examplebundle.static</artifactId>
+ <version>0.1.1-SNAPSHOT</version>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <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/ExampleBundleTeleportedIT.java b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleTeleportedIT.java
index f766fa5..e8e8dab 100644
--- a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleTeleportedIT.java
+++ b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundleTeleportedIT.java
@@ -28,6 +28,7 @@
import org.apache.sling.api.resource.ResourceResolverFactory;
import org.junit.Test;
+import static junit.framework.TestCase.assertFalse;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -114,4 +115,18 @@
}
}
}
+
+ @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>