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 2016/06/16 16:08:00 UTC

svn commit: r1748750 [12/12] - in /sling/trunk/bundles/scripting/sightly: ./ compiler/ compiler/src/ compiler/src/main/ compiler/src/main/antlr4/ compiler/src/main/antlr4/org/ compiler/src/main/antlr4/org/apache/ compiler/src/main/antlr4/org/apache/sli...

Modified: sling/trunk/bundles/scripting/sightly/testing-content/src/main/resources/SLING-INF/sightly.json
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/testing-content/src/main/resources/SLING-INF/sightly.json?rev=1748750&r1=1748749&r2=1748750&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/sightly/testing-content/src/main/resources/SLING-INF/sightly.json (original)
+++ sling/trunk/bundles/scripting/sightly/testing-content/src/main/resources/SLING-INF/sightly.json Thu Jun 16 16:07:57 2016
@@ -36,5 +36,9 @@
     "crlf": {
         "jcr:primaryType": "nt:unstructured",
         "sling:resourceType": "/apps/sightly/scripts/crlf"
+    },
+    "update": {
+        "jcr:primaryType": "nt:unstructured",
+        "sling:resourceType": "/apps/sightly/scripts/update"
     }
 }

Modified: sling/trunk/bundles/scripting/sightly/testing/src/main/provisioning/model.txt
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/testing/src/main/provisioning/model.txt?rev=1748750&r1=1748749&r2=1748750&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/sightly/testing/src/main/provisioning/model.txt (original)
+++ sling/trunk/bundles/scripting/sightly/testing/src/main/provisioning/model.txt Thu Jun 16 16:07:57 2016
@@ -20,6 +20,8 @@
 # Dependencies
 [artifacts]
   org.apache.sling/org.apache.sling.launchpad/9-SNAPSHOT/slingstart
+  org.apache.sling/org.apache.sling.scripting.sightly.compiler/0.0.1-SNAPSHOT
+  org.apache.sling/org.apache.sling.scripting.sightly.compiler.java/0.0.1-SNAPSHOT
   org.apache.sling/org.apache.sling.scripting.sightly/1.0.19-SNAPSHOT
   org.apache.sling/org.apache.sling.scripting.sightly.js.provider/1.0.11-SNAPSHOT
   org.apache.sling/org.apache.sling.scripting.sightly.models.provider/1.0.1-SNAPSHOT

Modified: sling/trunk/bundles/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java?rev=1748750&r1=1748749&r2=1748750&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java (original)
+++ sling/trunk/bundles/scripting/sightly/testing/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java Thu Jun 16 16:07:57 2016
@@ -20,8 +20,6 @@ package org.apache.sling.scripting.sight
 
 import java.io.IOException;
 
-import javax.swing.text.html.HTML;
-
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.entity.ContentType;
@@ -56,6 +54,7 @@ public class SlingSpecificsSightlyIT {
     private static final String SLING_CRLF_NOPKG = SLING_CRLF + ".nopkg.html";
     private static final String SLING_CRLF_PKG = SLING_CRLF + ".pkg.html";
     private static final String SLING_CRLF_WRONGPKG = SLING_CRLF + ".wrongpkg.html";
+    private static final String SLING_SCRIPT_UPDATE = "/sightly/update.html";
 
 
     @BeforeClass
@@ -122,7 +121,8 @@ public class SlingSpecificsSightlyIT {
     public void testBadTemplateIdentifier() {
         String url = launchpadURL + SLING_TEMPLATE_BAD_IDENTIFIER;
         String pageContent = client.getStringContent(url, 500);
-        assertTrue(pageContent.contains("org.apache.sling.scripting.sightly.impl.compiler.SightlyParsingException"));
+        assertTrue(pageContent.contains(
+                "org.apache.sling.scripting.sightly.java.compiler.SightlyJavaCompilerException: Unsupported identifier name: bad-template-id"));
     }
 
     @Test
@@ -178,6 +178,19 @@ public class SlingSpecificsSightlyIT {
     }
 
     @Test
+    public void testScriptUpdate() throws Exception {
+        String url = launchpadURL + SLING_SCRIPT_UPDATE;
+        String pageContent = client.getStringContent(url, 200);
+        assertEquals("Hello world!", HTMLExtractor.innerHTML(url + System.currentTimeMillis(), pageContent, "#update"));
+        uploadFile("update.v2.html", "update.html", "/apps/sightly/scripts/update");
+        pageContent = client.getStringContent(url, 200);
+        assertEquals("Hello, John Doe!", HTMLExtractor.innerHTML(url + System.currentTimeMillis(), pageContent, "#update"));
+        uploadFile("update.html", "update.html", "/apps/sightly/scripts/update");
+        pageContent = client.getStringContent(url, 200);
+        assertEquals("Hello world!", HTMLExtractor.innerHTML(url + System.currentTimeMillis(), pageContent, "#update"));
+    }
+
+    @Test
     public void testRepositoryPojoNoPkg() {
         String url = launchpadURL + SLING_USE;
         String pageContent = client.getStringContent(url, 200);
@@ -212,7 +225,7 @@ public class SlingSpecificsSightlyIT {
     public void testCRLFWrongPkg() {
         String url = launchpadURL + SLING_CRLF_WRONGPKG;
         String pageContent = client.getStringContent(url, 500);
-        assertTrue(pageContent.contains("CompilerException"));
+        assertTrue(pageContent.contains("Compilation errors in apps/sightly/scripts/crlf/RepoPojoWrongPkgCRLF.java"));
     }
 
     private void uploadFile(String fileName, String serverFileName, String url) throws IOException {

Added: sling/trunk/bundles/scripting/sightly/testing/src/test/resources/update.html
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/testing/src/test/resources/update.html?rev=1748750&view=auto
==============================================================================
--- sling/trunk/bundles/scripting/sightly/testing/src/test/resources/update.html (added)
+++ sling/trunk/bundles/scripting/sightly/testing/src/test/resources/update.html Thu Jun 16 16:07:57 2016
@@ -0,0 +1,17 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ 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 id="update" data-sly-text="${'Hello world!'}">replace me!</div>

Added: sling/trunk/bundles/scripting/sightly/testing/src/test/resources/update.v2.html
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/sightly/testing/src/test/resources/update.v2.html?rev=1748750&view=auto
==============================================================================
--- sling/trunk/bundles/scripting/sightly/testing/src/test/resources/update.v2.html (added)
+++ sling/trunk/bundles/scripting/sightly/testing/src/test/resources/update.v2.html Thu Jun 16 16:07:57 2016
@@ -0,0 +1,17 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ 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 id="update" data-sly-text="${'Hello, John Doe!'}">replace me!</div>