SLING-11508 - Make dependency resolution use ResourceResolver#getResource instead of ResourceResolver#resolve

* added a test for script resolution
diff --git a/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/resources/SLING-INF/content/examplebundle-precompiled-extend1.xml b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/resources/SLING-INF/content/examplebundle-precompiled-extend1.xml
index 5dd1980..b4eb79b 100644
--- a/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/resources/SLING-INF/content/examplebundle-precompiled-extend1.xml
+++ b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/resources/SLING-INF/content/examplebundle-precompiled-extend1.xml
@@ -35,3 +35,21 @@
     <type>String</type>
 </property>
 </node>
+<node>
+    <name>sling-11508-level-2</name>
+    <primaryNodeType>nt:unstructured</primaryNodeType>
+    <property>
+        <name>sling:resourceType</name>
+        <value>level-2/components/page</value>
+        <type>String</type>
+    </property>
+</node>
+<node>
+    <name>sling-11508-level-3</name>
+    <primaryNodeType>nt:unstructured</primaryNodeType>
+    <property>
+        <name>sling:resourceType</name>
+        <value>level-3/components/page</value>
+        <type>String</type>
+    </property>
+</node>
diff --git a/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/apps/level-2/components/page/extends b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/apps/level-2/components/page/extends
new file mode 100644
index 0000000..030e35a
--- /dev/null
+++ b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/apps/level-2/components/page/extends
@@ -0,0 +1 @@
+level-1/components/page
diff --git a/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/apps/level-3/components/page/extends b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/apps/level-3/components/page/extends
new file mode 100644
index 0000000..b932eb3
--- /dev/null
+++ b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/apps/level-3/components/page/extends
@@ -0,0 +1 @@
+level-2/components/page
diff --git a/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/apps/level-3/components/page/head.html b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/apps/level-3/components/page/head.html
new file mode 100644
index 0000000..9ad3370
--- /dev/null
+++ b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/apps/level-3/components/page/head.html
@@ -0,0 +1,21 @@
+<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ 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.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
+<template data-sly-template.template data-sly-use.headResources="head.resources.html">
+    <sly data-sly-call="${headResources.template}"></sly>
+</template>
\ No newline at end of file
diff --git a/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/apps/level-3/components/page/head/dummy.html b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/apps/level-3/components/page/head/dummy.html
new file mode 100644
index 0000000..af63652
--- /dev/null
+++ b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/apps/level-3/components/page/head/dummy.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.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
+  dummy.html
\ No newline at end of file
diff --git a/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/apps/level-3/components/page/page.html b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/apps/level-3/components/page/page.html
new file mode 100644
index 0000000..8e98303
--- /dev/null
+++ b/examples/org-apache-sling-scripting-examplebundle-precompiled-extend1/src/main/scripts/apps/level-3/components/page/page.html
@@ -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.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
+<!doctype html>
+<html data-sly-use.head="head.html">
+  <head data-sly-call="${head.template}"></head>
+  <body>It works!</body>
+</html>
\ No newline at end of file
diff --git a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/resources/SLING-INF/content/examplebundle-precompiled.xml b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/resources/SLING-INF/content/examplebundle-precompiled.xml
index 373872f..0a6e54c 100644
--- a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/resources/SLING-INF/content/examplebundle-precompiled.xml
+++ b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/resources/SLING-INF/content/examplebundle-precompiled.xml
@@ -53,3 +53,13 @@
         <type>String</type>
     </property>
 </node>
+
+<node>
+    <name>sling-11508-level-1</name>
+    <primaryNodeType>nt:unstructured</primaryNodeType>
+    <property>
+        <name>sling:resourceType</name>
+        <value>level-1/components/page</value>
+        <type>String</type>
+    </property>
+</node>
diff --git a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/libs/level-1/components/page/head.html b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/libs/level-1/components/page/head.html
new file mode 100644
index 0000000..b898350
--- /dev/null
+++ b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/libs/level-1/components/page/head.html
@@ -0,0 +1,21 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ 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.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<template data-sly-template.template data-sly-use.headResources="head.resources.html">
+    <sly data-sly-call="${headResources.template}"></sly>
+</template>
diff --git a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/libs/level-1/components/page/head.resources.html b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/libs/level-1/components/page/head.resources.html
new file mode 100644
index 0000000..f9dcd33
--- /dev/null
+++ b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/libs/level-1/components/page/head.resources.html
@@ -0,0 +1,21 @@
+<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ 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.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
+<template data-sly-template.template>
+   <title>Main Head Resources</title>
+</template>
\ No newline at end of file
diff --git a/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/libs/level-1/components/page/page.html b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/libs/level-1/components/page/page.html
new file mode 100644
index 0000000..8e98303
--- /dev/null
+++ b/examples/org-apache-sling-scripting-examplebundle-precompiled/src/main/scripts/libs/level-1/components/page/page.html
@@ -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.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
+<!doctype html>
+<html data-sly-use.head="head.html">
+  <head data-sly-call="${head.template}"></head>
+  <body>It works!</body>
+</html>
\ No newline at end of file
diff --git a/it/pom.xml b/it/pom.xml
index c869f9f..4cfa48e 100644
--- a/it/pom.xml
+++ b/it/pom.xml
@@ -188,7 +188,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.servlets.resolver</artifactId>
-            <version>2.9.3-SNAPSHOT</version>
+            <version>2.9.7-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -206,7 +206,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.scripting.sightly</artifactId>
-            <version>1.4.14-1.4.0</version>
+            <version>1.4.19-1.4.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -230,7 +230,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.scripting.sightly.js.provider</artifactId>
-            <version>1.2.6</version>
+            <version>1.2.7-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
         <dependency>
diff --git a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledExtend1IT.java b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledExtend1IT.java
index a0f7030..52bb0cd 100644
--- a/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledExtend1IT.java
+++ b/it/src/test/java/org/apache/sling/scripting/bundle/tracker/it/ExampleBundlePrecompiledExtend1IT.java
@@ -77,4 +77,11 @@
         assertEquals("World", w.html());
         assertEquals(expectedRT, w.attr(DATA_RT_ATTRIBUTE));
     }
+
+    @Test
+    public void testSling11508Level3() throws Exception {
+        Document document = getDocument(ROOT + "/sling-11508-level-3.html");
+        Elements body = document.select("body");
+        assertEquals("It works!", body.html());
+    }
 }
diff --git a/it/src/test/provisioning/it-model.txt b/it/src/test/provisioning/it-model.txt
index b5b8288..cfa07c5 100644
--- a/it/src/test/provisioning/it-model.txt
+++ b/it/src/test/provisioning/it-model.txt
@@ -48,5 +48,3 @@
   org.apache.sling.engine.impl.SlingMainServlet
     sling.trace.allow=B"true"
 
-  org.apache.sling.servlets.resolver.SlingServletResolver
-    servletresolver.mountProviders=B"false"
diff --git a/it/src/test/provisioning/repoinit.txt b/it/src/test/provisioning/repoinit.txt
index b268d80..294a796 100644
--- a/it/src/test/provisioning/repoinit.txt
+++ b/it/src/test/provisioning/repoinit.txt
@@ -30,6 +30,13 @@
         allow   jcr:read	on /content
     end
 
+# SLING-9735 - Define service user and ACLs for jcr.contentloader >>>
+#<<< SLING-9809 - Define service user and ACLs for jcr.usermanager
+create service user sling-jcr-usermanager
+set ACL for sling-jcr-usermanager
+    allow jcr:read,jcr:readAccessControl,jcr:modifyAccessControl,rep:write,rep:userManagement on /home
+end
+
     # sling-mapping
     create service user sling-mapping
 
diff --git a/it/src/test/provisioning/sling.txt b/it/src/test/provisioning/sling.txt
index 5ebbbb0..63e8b76 100644
--- a/it/src/test/provisioning/sling.txt
+++ b/it/src/test/provisioning/sling.txt
@@ -46,7 +46,7 @@
     commons-io/commons-io/2.6
     commons-fileupload/commons-fileupload/1.4
     org.apache.sling/org.apache.sling.commons.log.webconsole/1.0.0
-    org.apache.sling/org.apache.sling.api/2.24.0
+    org.apache.sling/org.apache.sling.api/2.26.0-SNAPSHOT
     org.apache.sling/org.apache.sling.auth.core/1.4.6
     
 [artifacts startLevel=10]
@@ -70,7 +70,7 @@
     org.apache.jackrabbit/jackrabbit-data/${jackrabbit.version}
     org.apache.sling/org.apache.sling.jcr.webdav/2.3.8
     org.apache.sling/org.apache.sling.jcr.davex/1.3.10
-    org.apache.sling/org.apache.sling.jcr.jackrabbit.usermanager/2.2.16
+    org.apache.sling/org.apache.sling.jcr.jackrabbit.usermanager/2.2.22
     org.apache.sling/org.apache.sling.jcr.jackrabbit.accessmanager/3.0.4
     org.apache.sling/org.apache.sling.jcr.webconsole/1.0.2
     io.dropwizard.metrics/metrics-core/3.2.6
@@ -98,7 +98,7 @@
     org.apache.sling/org.apache.sling.commons.mime/2.2.2
     org.apache.sling/org.apache.sling.commons.scheduler/2.7.6
     org.apache.sling/org.apache.sling.commons.threads/3.2.20
-    org.apache.sling/org.apache.sling.engine/2.8.0
+    org.apache.sling/org.apache.sling.engine/2.9.0
     org.apache.sling/org.apache.sling.fsresource/2.1.16
     org.apache.sling/org.apache.sling.i18n/2.5.14
     org.apache.sling/org.apache.sling.installer.console/1.1.0
@@ -110,7 +110,7 @@
     org.apache.sling/org.apache.sling.jcr.resource/3.1.0
     org.apache.sling/org.apache.sling.models.api/1.3.8
     org.apache.sling/org.apache.sling.models.impl/1.4.12
-    org.apache.sling/org.apache.sling.resourceresolver/1.8.0
+    org.apache.sling/org.apache.sling.resourceresolver/1.10.0-SNAPSHOT
     org.apache.sling/org.apache.sling.serviceusermapper/1.4.4
     org.apache.sling/org.apache.sling.serviceuser.webconsole/1.0.2
     org.apache.sling/org.apache.sling.servlets.get/2.1.40
@@ -217,8 +217,16 @@
       "org.apache.sling.jcr.resource:validation\=sling-readall"
     ]
 
+  org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-jcr-usermanager
+     user.mapping=[
+                "org.apache.sling.jcr.jackrabbit.usermanager\=sling-jcr-usermanager"
+            ]
+        
+
   org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-installer-factories
     user.mapping=[
       "org.apache.sling.installer.factory.packages\=sling-package-install"
     ]
 
+  org.apache.sling.servlets.resolver.SlingServletResolver
+    servletresolver.mountPathProviders=B"true"