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/01 12:51:34 UTC

[sling-org-apache-sling-scripting-sightly-testing-content] branch master updated: SLING-9715 - The JavaUseProvider does not properly handle the adaptable argument for Sling Model classes

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-sightly-testing-content.git


The following commit(s) were added to refs/heads/master by this push:
     new 20f1108  SLING-9715 - The JavaUseProvider does not properly handle the adaptable argument for Sling Model classes
20f1108 is described below

commit 20f1108c2db5c614ebb5d51bf5517a34fae9c648
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Tue Sep 1 14:46:22 2020 +0200

    SLING-9715 - The JavaUseProvider does not properly handle the adaptable argument for Sling Model classes
    
    * added IT
---
 pom.xml                                            | 18 +++++++++++
 .../testing/models/ResourceResolverModel.java      | 36 ++++++++++++++++++++++
 .../sightly/testing/models/package-info.java       |  2 +-
 .../apps/sightly/scripts/use/slingmodel-error.html | 22 +++++++++++++
 4 files changed, 77 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index fac6c99..019d368 100644
--- a/pom.xml
+++ b/pom.xml
@@ -153,6 +153,24 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>biz.aQute.bnd</groupId>
+                <artifactId>bnd-baseline-maven-plugin</artifactId>
+                <version>${bnd.version}</version>
+                <executions>
+                    <execution>
+                        <id>bnd-baseline</id>
+                        <goals>
+                            <goal>baseline</goal>
+                        </goals>
+                        <configuration>
+                            <diffignores>
+                                <diffignore>Bundle-Version</diffignore>
+                            </diffignores>
+                        </configuration>
+                    </execution>
+                </executions>
+        </plugin>
         </plugins>
     </build>
 
diff --git a/src/main/java/org/apache/sling/scripting/sightly/testing/models/ResourceResolverModel.java b/src/main/java/org/apache/sling/scripting/sightly/testing/models/ResourceResolverModel.java
new file mode 100644
index 0000000..b05799d
--- /dev/null
+++ b/src/main/java/org/apache/sling/scripting/sightly/testing/models/ResourceResolverModel.java
@@ -0,0 +1,36 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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 org.apache.sling.scripting.sightly.testing.models;
+
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.models.annotations.Model;
+import org.apache.sling.models.annotations.Via;
+import org.apache.sling.models.annotations.injectorspecific.Self;
+
+@Model(adaptables = ResourceResolver.class)
+public class ResourceResolverModel {
+
+    @Self @Via("user")
+    private String userID;
+
+    public String getUserID() {
+        return userID;
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/sightly/testing/models/package-info.java b/src/main/java/org/apache/sling/scripting/sightly/testing/models/package-info.java
index 51fcbdb..0f0d95b 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/testing/models/package-info.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/testing/models/package-info.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  ******************************************************************************/
 
-@Version("1.2.0")
+@Version("1.3.0")
 package org.apache.sling.scripting.sightly.testing.models;
 
 import org.osgi.annotation.versioning.Version;
diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/use/slingmodel-error.html b/src/main/resources/SLING-INF/apps/sightly/scripts/use/slingmodel-error.html
new file mode 100644
index 0000000..54ad18f
--- /dev/null
+++ b/src/main/resources/SLING-INF/apps/sightly/scripts/use/slingmodel-error.html
@@ -0,0 +1,22 @@
+<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ 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.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
+<div data-sly-use.rrmodel="${'org.apache.sling.scripting.sightly.testing.models.ResourceResolverModel' @ adaptable =
+request.resourceResolver}">
+    <div id="rrmodel">${rrmodel.userID}</div>
+</div>