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.git


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

commit f266d23003495dc41ec718725b419e7185247fa1
Author: Radu Cotescu <[email protected]>
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
---
 .../sling/scripting/sightly/it/SlingSpecificsSightlyIT.java  | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git 
a/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java
 
b/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java
index 0bb7b89..e00e1bf 100644
--- 
a/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java
+++ 
b/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java
@@ -47,6 +47,7 @@ public class SlingSpecificsSightlyIT {
     private static final String SLING_JAVA_USE_NPE = 
"/sightly/use.javaerror.html";
     private static final String SLING_JAVA_USE_INTERFACE = 
"/sightly/use.interface.html";
     private static final String SLING_JAVA_USE_ABSTRACT = 
"/sightly/use.abstractClass.html";
+    private static final String SLING_JAVA_USE_SLING_MODEL_ERROR = 
"/sightly/use.slingmodel-error.html";
     private static final String SLING_RESOURCE = "/sightly/resource.html";
     private static final String SLING_RESOURCE_ACTUAL = 
"/sightly/actualresource.html";
     private static final String SLING_TEMPLATE = "/sightly/template.html";
@@ -421,6 +422,17 @@ public class SlingSpecificsSightlyIT {
         assertEquals("precompiled - 
org/apache/sling/scripting/sightly/testing/precompiled", 
HTMLExtractor.innerHTML(url, pageContent, "div.precompiled > 
span.provided-jsuse-script"));
     }
 
+    @Test
+    public void testSlingModelError() {
+        String url = launchpadURL + SLING_JAVA_USE_SLING_MODEL_ERROR;
+        String pageContent = client.getStringContent(url, 500);
+        assertTrue("Expected that the Sling Model would be instantiated 
directly via the ModelFactory.",
+            pageContent.contains(
+                "Could not inject private java.lang.String 
org.apache.sling.scripting.sightly.testing.models.ResourceResolverModel.userID"
+            )
+        );
+    }
+
     private void restartSightlyEngineBundle() throws InterruptedException, 
IOException {
         HttpClient httpClient = HttpClientBuilder.create().build();
         HttpPost post = new HttpPost(launchpadURL + 
"/system/console/bundles/org.apache.sling.scripting.sightly");

Reply via email to