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 2015/04/06 22:15:06 UTC

svn commit: r1671688 - in /sling/trunk/contrib/scripting/sightly: js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/ testing-content/src/main/resources/SLING-INF/ testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/...

Author: radu
Date: Mon Apr  6 20:15:05 2015
New Revision: 1671688

URL: http://svn.apache.org/r1671688
Log:
SLING-4578 - Incorrect Sightly JS Use-API script dependency resolution

* explicitly check component inheritance when resolving script dependencies
* provided tests for Use API dependency inheritance
* made sure IT are run in the same order on all platforms

Added:
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/component.html
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/dependency.js
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/dependency.js
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/script.js
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance.json
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/S.java
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/s.ecma
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/s.js
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/templates.html
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/S.java
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/grandparent.html
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/s.ecma
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/s.js
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/templates.html
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/S.java
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/s.ecma
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/s.js
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/templates.html
    sling/trunk/contrib/scripting/sightly/testing/src/test/java/LaunchpadReadyIT.java
Removed:
    sling/trunk/contrib/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/LaunchpadReadyIT.java
Modified:
    sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/JsEnvironment.java
    sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/sightly.json
    sling/trunk/contrib/scripting/sightly/testing/pom.xml
    sling/trunk/contrib/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java

Modified: sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/JsEnvironment.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/JsEnvironment.java?rev=1671688&r1=1671687&r2=1671688&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/JsEnvironment.java (original)
+++ sling/trunk/contrib/scripting/sightly/js-use-provider/src/main/java/org/apache/sling/scripting/sightly/js/impl/JsEnvironment.java Mon Apr  6 20:15:05 2015
@@ -30,7 +30,9 @@ import javax.script.SimpleBindings;
 import javax.script.SimpleScriptContext;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
 import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceUtil;
 import org.apache.sling.api.scripting.SlingBindings;
 import org.apache.sling.api.scripting.SlingScriptHelper;
 import org.apache.sling.scripting.sightly.ResourceResolution;
@@ -89,10 +91,11 @@ public class JsEnvironment {
         SlingScriptHelper scriptHelper = (SlingScriptHelper) globalBindings.get(SlingBindings.SLING);
         Resource componentCaller = ResourceResolution.getResourceForRequest(caller.getResourceResolver(), scriptHelper.getRequest());
         if (scriptResource == null) {
-            scriptResource = ResourceResolution.getResourceFromSearchPath(componentCaller, path);
-        }
-        if (scriptResource == null) {
-            scriptResource = ResourceResolution.getResourceFromSearchPath(caller, path);
+            if (isResourceOverlay(caller, componentCaller)) {
+                scriptResource = ResourceResolution.getResourceFromSearchPath(componentCaller, path);
+            } else {
+                scriptResource = ResourceResolution.getResourceFromSearchPath(caller, path);
+            }
         }
         if (scriptResource == null) {
             throw new SightlyException("Required script resource could not be located: " + path);
@@ -170,4 +173,35 @@ public class JsEnvironment {
             }
         });
     }
+
+    /**
+     * Using the inheritance chain created with the help of {@code sling:resourceSuperType} this method checks if {@code resourceB}
+     * inherits from {@code resourceA}. In case {@code resourceA} is a {@code nt:file}, its parent will be used for the inheritance check.
+     *
+     * @param resourceA the base resource
+     * @param resourceB the potentially overlaid resource
+     * @return {@code true} if {@code resourceB} overlays {@code resourceB}, {@code false} otherwise
+     */
+    private boolean isResourceOverlay(Resource resourceA, Resource resourceB) {
+        String resourceBSuperType = resourceB.getResourceSuperType();
+        if (StringUtils.isNotEmpty(resourceBSuperType)) {
+            String parentResourceType = resourceA.getResourceType();
+            if ("nt:file".equals(parentResourceType)) {
+                parentResourceType = ResourceUtil.getParent(resourceA.getPath());
+            }
+            if (resourceBSuperType.equals(parentResourceType)) {
+                return true;
+            }
+            Resource parentB = resourceB.getResourceResolver().getResource(resourceBSuperType);
+            resourceBSuperType = parentB.getResourceSuperType();
+            while (!"/".equals(parentB.getPath()) && StringUtils.isNotEmpty(resourceBSuperType)) {
+                if (resourceBSuperType.equals(parentResourceType)) {
+                    return true;
+                }
+                parentB = parentB.getParent();
+                resourceBSuperType = parentB.getResourceSuperType();
+            }
+        }
+        return false;
+    }
 }

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/component.html
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/component.html?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/component.html (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/component.html Mon Apr  6 20:15:05 2015
@@ -0,0 +1,27 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ 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>
+    <head>
+        <title>Sightly JS Use-API dependency resolution</title>
+    </head>
+    <body>
+        <div id="js-rep-res" data-sly-use.js="/apps/sightly/scripts/siblingdeps/script.js">${js.result}</div>
+    </body>
+</html>

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/dependency.js
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/dependency.js?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/dependency.js (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/component/dependency.js Mon Apr  6 20:15:05 2015
@@ -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.
+ ******************************************************************************/
+use(function () {
+    return {
+        result: '/apps/sightly/scripts/siblingdeps/component/dependency.js'
+    }
+});
\ No newline at end of file

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/dependency.js
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/dependency.js?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/dependency.js (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/dependency.js Mon Apr  6 20:15:05 2015
@@ -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.
+ ******************************************************************************/
+use(function () {
+    return {
+        result: '/apps/sightly/scripts/siblingdeps/dependency.js'
+    }
+});
\ No newline at end of file

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/script.js
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/script.js?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/script.js (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/siblingdeps/script.js Mon Apr  6 20:15:05 2015
@@ -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.
+ ******************************************************************************/
+use('dependency.js', function (dep) {
+    return {
+        result: dep.result
+    };
+});
\ No newline at end of file

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance.json?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance.json (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance.json Mon Apr  6 20:15:05 2015
@@ -0,0 +1,14 @@
+{
+    "jcr:primaryType": "sling:Folder",
+    "grandparent": {
+        "jcr:primaryType": "sling:Folder"
+    },
+    "parent": {
+        "jcr:primaryType": "sling:Folder",
+        "sling:resourceSuperType": "/apps/sightly/scripts/useinheritance/grandparent"
+    },
+    "child": {
+        "jcr:primaryType": "sling:Folder",
+        "sling:resourceSuperType": "/apps/sightly/scripts/useinheritance/parent"
+    }
+}
\ No newline at end of file

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/S.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/S.java?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/S.java (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/S.java Mon Apr  6 20:15:05 2015
@@ -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.
+ ******************************************************************************/
+package apps.sightly.scripts.useinheritance.child;
+
+public class S {
+    public static final String message = "child.javaobject";
+}

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/s.ecma
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/s.ecma?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/s.ecma (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/s.ecma Mon Apr  6 20:15:05 2015
@@ -0,0 +1 @@
+"child.ecmaobject";
\ No newline at end of file

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/s.js
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/s.js?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/s.js (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/s.js Mon Apr  6 20:15:05 2015
@@ -0,0 +1,5 @@
+use(function () {
+    return {
+        message : 'child.javascriptobject'
+    };
+});

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/templates.html
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/templates.html?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/templates.html (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/child/templates.html Mon Apr  6 20:15:05 2015
@@ -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.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<template data-sly-template.template>child.template</template>
\ No newline at end of file

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/S.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/S.java?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/S.java (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/S.java Mon Apr  6 20:15:05 2015
@@ -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.
+ ******************************************************************************/
+package apps.sightly.scripts.useinheritance.grandparent;
+
+public class S {
+    public static final String message = "grandparent.javaobject";
+}

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/grandparent.html
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/grandparent.html?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/grandparent.html (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/grandparent.html Mon Apr  6 20:15:05 2015
@@ -0,0 +1,30 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ 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>
+<head>
+    <title>Sightly Use-API - Inheritance</title>
+</head>
+<body>
+  <div id="javaobj" data-sly-use.javaobj="S">${javaobj.message}</div>
+  <div id="javascriptobj" data-sly-use.javascriptobj="s.js">${javascriptobj.message}</div>
+  <div id="ecmaobj" data-sly-use.ecmaobj="s.ecma">${ecmaobj}</div>
+  <div id="templateobj" data-sly-use.templateobj="templates.html" data-sly-call="${templateobj.template}"></div>
+</body>
+</html>
\ No newline at end of file

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/s.ecma
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/s.ecma?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/s.ecma (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/s.ecma Mon Apr  6 20:15:05 2015
@@ -0,0 +1 @@
+"grandparent.ecmaobject";
\ No newline at end of file

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/s.js
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/s.js?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/s.js (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/s.js Mon Apr  6 20:15:05 2015
@@ -0,0 +1,5 @@
+use(function () {
+    return {
+        message : 'grandparent.javascriptobject'
+    };
+});

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/templates.html
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/templates.html?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/templates.html (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/grandparent/templates.html Mon Apr  6 20:15:05 2015
@@ -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.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<template data-sly-template.template>grandparent.template</template>
\ No newline at end of file

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/S.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/S.java?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/S.java (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/S.java Mon Apr  6 20:15:05 2015
@@ -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.
+ ******************************************************************************/
+package apps.sightly.scripts.useinheritance.parent;
+
+public class S {
+    public static final String message = "parent.javaobject";
+}

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/s.ecma
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/s.ecma?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/s.ecma (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/s.ecma Mon Apr  6 20:15:05 2015
@@ -0,0 +1 @@
+"parent.ecmaobject";
\ No newline at end of file

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/s.js
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/s.js?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/s.js (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/s.js Mon Apr  6 20:15:05 2015
@@ -0,0 +1,5 @@
+use(function () {
+    return {
+        message : 'parent.javascriptobject'
+    };
+});

Added: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/templates.html
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/templates.html?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/templates.html (added)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/apps/sightly/scripts/useinheritance/parent/templates.html Mon Apr  6 20:15:05 2015
@@ -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.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<template data-sly-template.template>parent.template</template>
\ No newline at end of file

Modified: sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/sightly.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/sightly.json?rev=1671688&r1=1671687&r2=1671688&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/sightly.json (original)
+++ sling/trunk/contrib/scripting/sightly/testing-content/src/main/resources/SLING-INF/sightly.json Mon Apr  6 20:15:05 2015
@@ -20,5 +20,13 @@
     "text.txt": {
       "jcr:primaryType": "nt:unstructured",
       "sling:resourceType": "/apps/sightly/scripts/text"
+    },
+    "useinheritance": {
+        "jcr:primaryType": "nt:unstructured",
+        "sling:resourceType": "/apps/sightly/scripts/useinheritance/child"
+    },
+    "use-sibling-dependency-resolution": {
+        "jcr:primaryType": "nt:unstructured",
+        "sling:resourceType": "/apps/sightly/scripts/siblingdeps/component"
     }
 }

Modified: sling/trunk/contrib/scripting/sightly/testing/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing/pom.xml?rev=1671688&r1=1671687&r2=1671688&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing/pom.xml (original)
+++ sling/trunk/contrib/scripting/sightly/testing/pom.xml Mon Apr  6 20:15:05 2015
@@ -125,6 +125,7 @@
                     <dependenciesToScan>
                         <dependency>io.sightly:io.sightly.tck</dependency>
                     </dependenciesToScan>
+                    <runOrder>alphabetical</runOrder>
                     <excludes>
                         <exclude>${failsafe.exclude}</exclude>
                     </excludes>
@@ -235,7 +236,7 @@
                         <bundle>
                             <groupId>org.apache.sling</groupId>
                             <artifactId>org.apache.sling.scripting.sightly.js.provider</artifactId>
-                            <version>1.0.0</version>
+                            <version>1.0.1-SNAPSHOT</version>
                             <startLevel>20</startLevel>
                         </bundle>
                         <bundle>

Added: sling/trunk/contrib/scripting/sightly/testing/src/test/java/LaunchpadReadyIT.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing/src/test/java/LaunchpadReadyIT.java?rev=1671688&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing/src/test/java/LaunchpadReadyIT.java (added)
+++ sling/trunk/contrib/scripting/sightly/testing/src/test/java/LaunchpadReadyIT.java Mon Apr  6 20:15:05 2015
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+
+import java.io.IOException;
+
+import org.apache.sling.commons.testing.integration.HttpTestBase;
+import org.junit.Test;
+
+public class LaunchpadReadyIT extends HttpTestBase {
+
+    @Test
+    public void testLaunchpadReady() throws IOException {
+        assertHttpStatus(HTTP_URL + "/index.html", 200);
+    }
+
+}

Modified: sling/trunk/contrib/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java?rev=1671688&r1=1671687&r2=1671688&view=diff
==============================================================================
--- sling/trunk/contrib/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java (original)
+++ sling/trunk/contrib/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java Mon Apr  6 20:15:05 2015
@@ -37,6 +37,8 @@ public class SlingSpecificsSightlyIT {
     private static final String SLING_TEMPLATE = "/sightly/template.html";
     private static final String SLING_TEMPLATE_BAD_IDENTIFIER = "/sightly/template.bad-id.html";
     private static final String SLING_JS_USE = "/sightly/use.jsuse.html";
+    private static final String SLING_JS_DEPENDENCY_RESOLUTION = "/sightly/use-sibling-dependency-resolution.html";
+    private static final String SLING_USE_INHERITANCE = "/sightly/useinheritance.html";
 
     @BeforeClass
     public static void init() {
@@ -107,4 +109,21 @@ public class SlingSpecificsSightlyIT {
         assertEquals("/apps/sightly/scripts/use", HTMLExtractor.innerHTML(url, pageContent, "#resource-getResourceType"));
     }
 
+    @Test
+    public void testJSUseAPISiblingDependencies() {
+        String url = launchpadURL + SLING_JS_DEPENDENCY_RESOLUTION;
+        String pageContent = client.getStringContent(url, 200);
+        assertEquals("/apps/sightly/scripts/siblingdeps/dependency.js", HTMLExtractor.innerHTML(url, pageContent, "#js-rep-res"));
+    }
+
+    @Test
+    public void testUseAPIInheritance() {
+        String url = launchpadURL + SLING_USE_INHERITANCE;
+        String pageContent = client.getStringContent(url, 200);
+        assertEquals("child.javaobject", HTMLExtractor.innerHTML(url, pageContent, "#javaobj"));
+        assertEquals("child.javascriptobject", HTMLExtractor.innerHTML(url, pageContent, "#javascriptobj"));
+        assertEquals("child.ecmaobject", HTMLExtractor.innerHTML(url, pageContent, "#ecmaobj"));
+        assertEquals("child.template", HTMLExtractor.innerHTML(url, pageContent, "#templateobj"));
+    }
+
 }