You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ol...@apache.org on 2017/12/28 16:53:12 UTC

[sling-org-apache-sling-scripting-groovy] branch master updated (3a59a91 -> 2e9cbd2)

This is an automated email from the ASF dual-hosted git repository.

olli pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-groovy.git.


    from 3a59a91  SLING-7213 - Add a default .gitignore file to every module
     new 1b0dfe0  use Sling Parent 32
     new 6223ec8  adjust name
     new d36dee0  use sling.java.version and set encoding
     new a8d0493  SLING-7335 Update Groovy to 2.4.13
     new 7c8b8ad  SLING-7336 Use OSGi R6 annotations
     new 2e9cbd2  SLING-7337 Add integration tests

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 README.md                                          |   2 +-
 pom.xml                                            | 206 +++++++++++++++++++--
 .../GspScriptEngine.java}                          |  38 ++--
 .../groovy/internal/GspScriptEngineFactory.java    |  96 ++++++++++
 .../GspScriptEngineFactoryConfiguration.java       |  59 ++++++
 .../JsonBuilderBindingsValuesProvider.java         |  40 ++--
 .../scripting/internal/GSPScriptEngineFactory.java |  71 -------
 .../scripting/groovy/it/GroovyTestSupport.java     |  99 ++++++++++
 .../apache/sling/scripting/groovy/it/app/Page.java |  52 ++++++
 .../scripting/groovy/it/tests/AdaptToModelIT.java  |  81 ++++++++
 .../groovy/it/tests/GspScriptEngineFactoryIT.java  |  72 +++++++
 .../sling/scripting/groovy/it/tests/SimpleIT.java  |  81 ++++++++
 .../resources/apps/groovy/page/adaptto/html.gsp    |  31 ++++
 .../resources/apps/groovy/page/simple/html.gsp     |  28 +++
 src/test/resources/content/groovy.json             |  18 ++
 15 files changed, 844 insertions(+), 130 deletions(-)
 rename src/main/java/org/apache/sling/scripting/groovy/{scripting/internal/GSPScriptEngine.java => internal/GspScriptEngine.java} (68%)
 create mode 100644 src/main/java/org/apache/sling/scripting/groovy/internal/GspScriptEngineFactory.java
 create mode 100644 src/main/java/org/apache/sling/scripting/groovy/internal/GspScriptEngineFactoryConfiguration.java
 rename src/main/java/org/apache/sling/scripting/groovy/{json => }/internal/JsonBuilderBindingsValuesProvider.java (53%)
 delete mode 100644 src/main/java/org/apache/sling/scripting/groovy/scripting/internal/GSPScriptEngineFactory.java
 create mode 100644 src/test/java/org/apache/sling/scripting/groovy/it/GroovyTestSupport.java
 create mode 100644 src/test/java/org/apache/sling/scripting/groovy/it/app/Page.java
 create mode 100644 src/test/java/org/apache/sling/scripting/groovy/it/tests/AdaptToModelIT.java
 create mode 100644 src/test/java/org/apache/sling/scripting/groovy/it/tests/GspScriptEngineFactoryIT.java
 create mode 100644 src/test/java/org/apache/sling/scripting/groovy/it/tests/SimpleIT.java
 create mode 100644 src/test/resources/apps/groovy/page/adaptto/html.gsp
 create mode 100644 src/test/resources/apps/groovy/page/simple/html.gsp
 create mode 100644 src/test/resources/content/groovy.json

-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].

[sling-org-apache-sling-scripting-groovy] 06/06: SLING-7337 Add integration tests

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-groovy.git

commit 2e9cbd25fac67d7b49e68fd82a4bcbef81167c25
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Thu Dec 28 17:52:42 2017 +0100

    SLING-7337 Add integration tests
---
 pom.xml                                            | 125 +++++++++++++++++++++
 .../scripting/groovy/it/GroovyTestSupport.java     |  99 ++++++++++++++++
 .../apache/sling/scripting/groovy/it/app/Page.java |  52 +++++++++
 .../scripting/groovy/it/tests/AdaptToModelIT.java  |  81 +++++++++++++
 .../groovy/it/tests/GspScriptEngineFactoryIT.java  |  72 ++++++++++++
 .../sling/scripting/groovy/it/tests/SimpleIT.java  |  81 +++++++++++++
 .../resources/apps/groovy/page/adaptto/html.gsp    |  31 +++++
 .../resources/apps/groovy/page/simple/html.gsp     |  28 +++++
 src/test/resources/content/groovy.json             |  18 +++
 9 files changed, 587 insertions(+)

diff --git a/pom.xml b/pom.xml
index a955284..45712b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,6 +38,7 @@
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
     <sling.java.version>8</sling.java.version>
+    <org.ops4j.pax.exam.version>4.11.0</org.ops4j.pax.exam.version>
     <groovy.version>2.4.13</groovy.version>
   </properties>
 
@@ -65,10 +66,48 @@
           </instructions>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>integration-test</goal>
+              <goal>verify</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <redirectTestOutputToFile>true</redirectTestOutputToFile>
+          <systemProperties>
+            <property>
+              <name>bundle.filename</name>
+              <value>${basedir}/target/${project.build.finalName}.jar</value>
+            </property>
+          </systemProperties>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.servicemix.tooling</groupId>
+        <artifactId>depends-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>generate-depends-file</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 
   <dependencies>
+    <!-- javax -->
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <scope>test</scope>
+    </dependency>
     <!-- OSGi -->
     <dependency>
       <groupId>org.osgi</groupId>
@@ -95,6 +134,13 @@
       <artifactId>org.osgi.service.metatype.annotations</artifactId>
       <scope>provided</scope>
     </dependency>
+    <!-- Apache Felix -->
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.framework</artifactId>
+      <version>5.6.10</version>
+      <scope>test</scope>
+    </dependency>
     <!-- Apache Sling -->
     <dependency>
       <groupId>org.apache.sling</groupId>
@@ -104,16 +150,46 @@
     </dependency>
     <dependency>
       <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.auth.core</artifactId>
+      <version>1.3.24</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.commons.classloader</artifactId>
       <version>1.0.0</version>
       <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.engine</artifactId>
+      <version>2.6.6</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.models.api</artifactId>
+      <version>1.3.6</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.resource.presence</artifactId>
+      <version>0.0.2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.scripting.api</artifactId>
       <version>2.1.0</version>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.testing.paxexam</artifactId>
+      <version>0.0.5-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
     <!-- Groovy -->
     <dependency>
       <groupId>org.codehaus.groovy</groupId>
@@ -133,12 +209,61 @@
       <version>${groovy.version}</version>
       <scope>provided</scope>
     </dependency>
+    <!-- jsoup -->
+    <dependency>
+      <groupId>org.jsoup</groupId>
+      <artifactId>jsoup</artifactId>
+      <version>1.10.2</version>
+      <scope>test</scope>
+    </dependency>
     <!-- logging -->
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
       <scope>provided</scope>
     </dependency>
+    <!-- testing -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicemix.bundles</groupId>
+      <artifactId>org.apache.servicemix.bundles.hamcrest</artifactId>
+      <version>1.3_1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam</artifactId>
+      <version>${org.ops4j.pax.exam.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-cm</artifactId>
+      <version>${org.ops4j.pax.exam.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-container-forked</artifactId>
+      <version>${org.ops4j.pax.exam.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-junit4</artifactId>
+      <version>${org.ops4j.pax.exam.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-link-mvn</artifactId>
+      <version>${org.ops4j.pax.exam.version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
 </project>
diff --git a/src/test/java/org/apache/sling/scripting/groovy/it/GroovyTestSupport.java b/src/test/java/org/apache/sling/scripting/groovy/it/GroovyTestSupport.java
new file mode 100644
index 0000000..8aad7f5
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/groovy/it/GroovyTestSupport.java
@@ -0,0 +1,99 @@
+/*
+ * 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.groovy.it;
+
+import javax.inject.Inject;
+import javax.script.ScriptEngineFactory;
+
+import aQute.bnd.osgi.Constants;
+import org.apache.sling.api.servlets.ServletResolver;
+import org.apache.sling.auth.core.AuthenticationSupport;
+import org.apache.sling.engine.SlingRequestProcessor;
+import org.apache.sling.testing.paxexam.TestSupport;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.ProbeBuilder;
+import org.ops4j.pax.exam.TestProbeBuilder;
+import org.ops4j.pax.exam.util.Filter;
+import org.osgi.service.http.HttpService;
+
+import static org.apache.sling.testing.paxexam.SlingOptions.slingModels;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingQuickstartOakTar;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingResourcePresence;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingScripting;
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+
+public class GroovyTestSupport extends TestSupport {
+
+    @Inject
+    protected ServletResolver servletResolver;
+
+    @Inject
+    protected SlingRequestProcessor slingRequestProcessor;
+
+    @Inject
+    protected AuthenticationSupport authenticationSupport;
+
+    @Inject
+    protected HttpService httpService;
+
+    @Inject
+    @Filter(value = "(names=gsp)")
+    protected ScriptEngineFactory scriptEngineFactory;
+
+    public Option baseConfiguration() {
+        return composite(
+            super.baseConfiguration(),
+            quickstart(),
+            // Sling Scripting Groovy
+            testBundle("bundle.filename"),
+            mavenBundle().groupId("org.codehaus.groovy").artifactId("groovy").versionAsInProject(),
+            mavenBundle().groupId("org.codehaus.groovy").artifactId("groovy-json").versionAsInProject(),
+            mavenBundle().groupId("org.codehaus.groovy").artifactId("groovy-templates").versionAsInProject(),
+            // testing
+            slingResourcePresence(),
+            mavenBundle().groupId("org.jsoup").artifactId("jsoup").versionAsInProject(),
+            mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
+            junitBundles()
+        );
+    }
+
+    @ProbeBuilder
+    public TestProbeBuilder probeConfiguration(final TestProbeBuilder testProbeBuilder) {
+        testProbeBuilder.setHeader(Constants.EXPORT_PACKAGE, "org.apache.sling.scripting.groovy.it.app");
+        testProbeBuilder.setHeader("Sling-Model-Packages", "org.apache.sling.scripting.groovy.it.app");
+        testProbeBuilder.setHeader("Sling-Initial-Content", String.join(",",
+            "apps/groovy;path:=/apps/groovy;overwrite:=true;uninstall:=true",
+            "content;path:=/content;overwrite:=true;uninstall:=true"
+        ));
+        return testProbeBuilder;
+    }
+
+    protected Option quickstart() {
+        final int httpPort = findFreePort();
+        final String workingDirectory = workingDirectory();
+        return composite(
+            slingQuickstartOakTar(workingDirectory, httpPort),
+            slingModels(),
+            slingScripting()
+        );
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/scripting/groovy/it/app/Page.java b/src/test/java/org/apache/sling/scripting/groovy/it/app/Page.java
new file mode 100644
index 0000000..03b03d5
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/groovy/it/app/Page.java
@@ -0,0 +1,52 @@
+/*
+ * 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.groovy.it.app;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.models.annotations.Model;
+import org.apache.sling.models.annotations.injectorspecific.SlingObject;
+
+import static org.apache.sling.models.annotations.injectorspecific.InjectionStrategy.OPTIONAL;
+
+@Model(adaptables = {Resource.class, SlingHttpServletRequest.class})
+public class Page {
+
+    @SlingObject
+    protected Resource resource;
+
+    @SlingObject(injectionStrategy = OPTIONAL)
+    protected SlingHttpServletRequest request;
+
+    public Page() {
+    }
+
+    public String getName() {
+        return resource.getName();
+    }
+
+    public String getPath() {
+        return resource.getPath();
+    }
+
+    public String getTitle() {
+        return resource.getValueMap().get("title", String.class);
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/scripting/groovy/it/tests/AdaptToModelIT.java b/src/test/java/org/apache/sling/scripting/groovy/it/tests/AdaptToModelIT.java
new file mode 100644
index 0000000..742bd23
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/groovy/it/tests/AdaptToModelIT.java
@@ -0,0 +1,81 @@
+/*
+ * 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.groovy.it.tests;
+
+import java.io.IOException;
+
+import javax.inject.Inject;
+
+import org.apache.sling.resource.presence.ResourcePresence;
+import org.apache.sling.scripting.groovy.it.GroovyTestSupport;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.ops4j.pax.exam.util.Filter;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class AdaptToModelIT extends GroovyTestSupport {
+
+    private Document document;
+
+    @Inject
+    @Filter(value = "(path=/apps/groovy/page/adaptto/html.gsp)")
+    private ResourcePresence resourcePresence;
+
+    @Configuration
+    public Option[] configuration() {
+        return new Option[]{
+            baseConfiguration(),
+            factoryConfiguration("org.apache.sling.resource.presence.internal.ResourcePresenter")
+                .put("path", "/apps/groovy/page/adaptto/html.gsp")
+                .asOption(),
+        };
+    }
+
+    @Before
+    public void setup() throws IOException {
+        final String url = String.format("http://localhost:%s/groovy/adaptto.html", httpPort());
+        document = Jsoup.connect(url).get();
+    }
+
+    @Test
+    public void testTitle() {
+        assertThat(document.title(), is("Sling Models adaptTo()"));
+    }
+
+    @Test
+    public void testPageName() {
+        final Element name = document.getElementById("name");
+        assertThat(name.text(), is("adaptto"));
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/scripting/groovy/it/tests/GspScriptEngineFactoryIT.java b/src/test/java/org/apache/sling/scripting/groovy/it/tests/GspScriptEngineFactoryIT.java
new file mode 100644
index 0000000..aff0db4
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/groovy/it/tests/GspScriptEngineFactoryIT.java
@@ -0,0 +1,72 @@
+/*
+ * 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.groovy.it.tests;
+
+import org.apache.sling.scripting.groovy.it.GroovyTestSupport;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.startsWith;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class GspScriptEngineFactoryIT extends GroovyTestSupport {
+
+    @Configuration
+    public Option[] configuration() {
+        return new Option[]{
+            baseConfiguration()
+        };
+    }
+
+    @Test
+    public void testScriptEngineFactory() {
+        assertNotNull(scriptEngineFactory);
+    }
+
+    @Test
+    public void testScriptEngineFactoryEngineName() {
+        assertThat(scriptEngineFactory.getEngineName(), is("Apache Sling Scripting Groovy"));
+    }
+
+    @Test
+    public void testScriptEngineFactoryLanguageName() {
+        assertThat(scriptEngineFactory.getLanguageName(), is("Groovy Server Pages"));
+    }
+
+    @Test
+    public void testScriptEngineFactoryLanguageVersion() {
+        assertThat(scriptEngineFactory.getLanguageVersion(), startsWith("2.4."));
+    }
+
+    @Test
+    public void testScriptEngineFactoryNames() {
+        assertThat(scriptEngineFactory.getNames(), hasItem("gsp"));
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/scripting/groovy/it/tests/SimpleIT.java b/src/test/java/org/apache/sling/scripting/groovy/it/tests/SimpleIT.java
new file mode 100644
index 0000000..9f7a6e8
--- /dev/null
+++ b/src/test/java/org/apache/sling/scripting/groovy/it/tests/SimpleIT.java
@@ -0,0 +1,81 @@
+/*
+ * 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.groovy.it.tests;
+
+import java.io.IOException;
+
+import javax.inject.Inject;
+
+import org.apache.sling.resource.presence.ResourcePresence;
+import org.apache.sling.scripting.groovy.it.GroovyTestSupport;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.ops4j.pax.exam.util.Filter;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class SimpleIT extends GroovyTestSupport {
+
+    private Document document;
+
+    @Inject
+    @Filter(value = "(path=/apps/groovy/page/simple/html.gsp)")
+    private ResourcePresence resourcePresence;
+
+    @Configuration
+    public Option[] configuration() {
+        return new Option[]{
+            baseConfiguration(),
+            factoryConfiguration("org.apache.sling.resource.presence.internal.ResourcePresenter")
+                .put("path", "/apps/groovy/page/simple/html.gsp")
+                .asOption(),
+        };
+    }
+
+    @Before
+    public void setup() throws IOException {
+        final String url = String.format("http://localhost:%s/groovy/simple.html", httpPort());
+        document = Jsoup.connect(url).get();
+    }
+
+    @Test
+    public void testTitle() {
+        assertThat(document.title(), is("groovy simple"));
+    }
+
+    @Test
+    public void testPageName() {
+        final Element name = document.getElementById("name");
+        assertThat(name.text(), is("simple"));
+    }
+
+}
diff --git a/src/test/resources/apps/groovy/page/adaptto/html.gsp b/src/test/resources/apps/groovy/page/adaptto/html.gsp
new file mode 100644
index 0000000..fb6eaea
--- /dev/null
+++ b/src/test/resources/apps/groovy/page/adaptto/html.gsp
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<!--
+    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.
+-->
+<%
+    def page = request.adaptTo(org.apache.sling.scripting.groovy.it.app.Page.class)
+%>
+<html>
+<head>
+  <meta charset="UTF-8"/>
+  <title>$page.title</title>
+</head>
+<body>
+<span id="name">$page.name</span>
+</body>
+</html>
diff --git a/src/test/resources/apps/groovy/page/simple/html.gsp b/src/test/resources/apps/groovy/page/simple/html.gsp
new file mode 100644
index 0000000..e0a612e
--- /dev/null
+++ b/src/test/resources/apps/groovy/page/simple/html.gsp
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<!--
+    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.
+-->
+<html>
+<head>
+  <meta charset="UTF-8"/>
+  <title>$resource.valueMap.title</title>
+</head>
+<body>
+<span id="name">$resource.name</span>
+</body>
+</html>
diff --git a/src/test/resources/content/groovy.json b/src/test/resources/content/groovy.json
new file mode 100644
index 0000000..6af671e
--- /dev/null
+++ b/src/test/resources/content/groovy.json
@@ -0,0 +1,18 @@
+{
+    "jcr:primaryType": "nt:unstructured",
+    "sling:resourceType": "groovy/page/main",
+    "sling:resourceSuperType": "groovy/page",
+    "title": "Apache Sling Scripting Groovy",
+    "simple": {
+        "jcr:primaryType": "nt:unstructured",
+        "sling:resourceType": "groovy/page/simple",
+        "sling:resourceSuperType": "groovy/page",
+        "title": "groovy simple"
+    },
+    "adaptto": {
+        "jcr:primaryType": "nt:unstructured",
+        "sling:resourceType": "groovy/page/adaptto",
+        "sling:resourceSuperType": "groovy/page",
+        "title": "Sling Models adaptTo()"
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-scripting-groovy] 05/06: SLING-7336 Use OSGi R6 annotations

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-groovy.git

commit 7c8b8ad84ec66500281e84875d38fa18054b58e1
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Thu Dec 28 17:46:29 2017 +0100

    SLING-7336 Use OSGi R6 annotations
---
 pom.xml                                            | 76 +++++++++++++----
 .../GspScriptEngine.java}                          | 38 ++++-----
 .../groovy/internal/GspScriptEngineFactory.java    | 96 ++++++++++++++++++++++
 .../GspScriptEngineFactoryConfiguration.java       | 59 +++++++++++++
 .../JsonBuilderBindingsValuesProvider.java         | 40 ++++-----
 .../scripting/internal/GSPScriptEngineFactory.java | 71 ----------------
 6 files changed, 252 insertions(+), 128 deletions(-)

diff --git a/pom.xml b/pom.xml
index 25f0455..a955284 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,44 +51,55 @@
     <plugins>
       <plugin>
         <groupId>org.apache.felix</groupId>
-        <artifactId>maven-scr-plugin</artifactId>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
         <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <ScriptEngine-Name>${project.name}</ScriptEngine-Name>
+            <ScriptEngine-Version>${project.version}</ScriptEngine-Version>
+            <_removeheaders>
+              Embed-Dependency,
+              Private-Package,
+              Include-Resource
+            </_removeheaders>
+          </instructions>
+        </configuration>
       </plugin>
     </plugins>
   </build>
 
   <dependencies>
+    <!-- OSGi -->
     <dependency>
-      <groupId>org.codehaus.groovy</groupId>
-      <artifactId>groovy</artifactId>
-      <version>${groovy.version}</version>
+      <groupId>org.osgi</groupId>
+      <artifactId>osgi.annotation</artifactId>
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>org.codehaus.groovy</groupId>
-      <artifactId>groovy-json</artifactId>
-      <version>${groovy.version}</version>
+      <groupId>org.osgi</groupId>
+      <artifactId>osgi.cmpn</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>osgi.core</artifactId>
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>org.codehaus.groovy</groupId>
-      <artifactId>groovy-templates</artifactId>
-      <version>${groovy.version}</version>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.service.component.annotations</artifactId>
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.scr.annotations</artifactId>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.service.metatype.annotations</artifactId>
       <scope>provided</scope>
     </dependency>
+    <!-- Apache Sling -->
     <dependency>
       <groupId>org.apache.sling</groupId>
-      <artifactId>org.apache.sling.scripting.api</artifactId>
-      <version>2.1.0</version>
+      <artifactId>org.apache.sling.api</artifactId>
+      <version>2.11.0</version>
       <scope>provided</scope>
     </dependency>
     <dependency>
@@ -97,6 +108,37 @@
       <version>1.0.0</version>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.scripting.api</artifactId>
+      <version>2.1.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <!-- Groovy -->
+    <dependency>
+      <groupId>org.codehaus.groovy</groupId>
+      <artifactId>groovy</artifactId>
+      <version>${groovy.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.groovy</groupId>
+      <artifactId>groovy-json</artifactId>
+      <version>${groovy.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.groovy</groupId>
+      <artifactId>groovy-templates</artifactId>
+      <version>${groovy.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <!-- logging -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <scope>provided</scope>
+    </dependency>
   </dependencies>
 
 </project>
diff --git a/src/main/java/org/apache/sling/scripting/groovy/scripting/internal/GSPScriptEngine.java b/src/main/java/org/apache/sling/scripting/groovy/internal/GspScriptEngine.java
similarity index 68%
rename from src/main/java/org/apache/sling/scripting/groovy/scripting/internal/GSPScriptEngine.java
rename to src/main/java/org/apache/sling/scripting/groovy/internal/GspScriptEngine.java
index f2fca41..b7ddf20 100644
--- a/src/main/java/org/apache/sling/scripting/groovy/scripting/internal/GSPScriptEngine.java
+++ b/src/main/java/org/apache/sling/scripting/groovy/internal/GspScriptEngine.java
@@ -14,51 +14,49 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.scripting.groovy.scripting.internal;
-
-import groovy.lang.Writable;
-import groovy.text.GStringTemplateEngine;
-import groovy.text.Template;
-import groovy.text.TemplateEngine;
+package org.apache.sling.scripting.groovy.internal;
 
 import java.io.IOException;
 import java.io.Reader;
+import java.io.Writer;
 
 import javax.script.Bindings;
 import javax.script.ScriptContext;
 import javax.script.ScriptEngineFactory;
 import javax.script.ScriptException;
 
+import groovy.lang.Writable;
+import groovy.text.GStringTemplateEngine;
+import groovy.text.Template;
+import groovy.text.TemplateEngine;
 import org.apache.sling.scripting.api.AbstractSlingScriptEngine;
 
 /**
- * The actual GSP Script Engine, which simply wraps Groovy's 
+ * The actual GSP Script Engine, which simply wraps Groovy's
  */
-public class GSPScriptEngine extends AbstractSlingScriptEngine {
+public class GspScriptEngine extends AbstractSlingScriptEngine {
 
-    private TemplateEngine templateEngine;
+    private final TemplateEngine templateEngine;
 
-    public GSPScriptEngine(ScriptEngineFactory scriptEngineFactory, ClassLoader classLoader) {
+    public GspScriptEngine(final ScriptEngineFactory scriptEngineFactory, final ClassLoader classLoader) {
         super(scriptEngineFactory);
         this.templateEngine = new GStringTemplateEngine(classLoader);
     }
-    
-    public Object eval(Reader reader, ScriptContext ctx) throws ScriptException {
-        Template template = null;
+
+    public Object eval(final Reader reader, final ScriptContext scriptContext) throws ScriptException {
+        Template template;
         try {
             template = templateEngine.createTemplate(reader);
-        } catch (IOException e) {
-            throw new ScriptException("Unable to compile GSP script: " + e.getMessage());
-        } catch (ClassNotFoundException e) {
+        } catch (IOException | ClassNotFoundException e) {
             throw new ScriptException("Unable to compile GSP script: " + e.getMessage());
         }
 
-        Bindings bindings = ctx.getBindings(ScriptContext.ENGINE_SCOPE);
-
-        Writable result = template.make(bindings);
+        final Bindings bindings = scriptContext.getBindings(ScriptContext.ENGINE_SCOPE);
+        final Writer writer = scriptContext.getWriter();
+        final Writable result = template.make(bindings);
 
         try {
-            result.writeTo(ctx.getWriter());
+            result.writeTo(writer);
         } catch (IOException e) {
             throw new ScriptException("Unable to write result of script execution: " + e.getMessage());
         }
diff --git a/src/main/java/org/apache/sling/scripting/groovy/internal/GspScriptEngineFactory.java b/src/main/java/org/apache/sling/scripting/groovy/internal/GspScriptEngineFactory.java
new file mode 100644
index 0000000..1d245c0
--- /dev/null
+++ b/src/main/java/org/apache/sling/scripting/groovy/internal/GspScriptEngineFactory.java
@@ -0,0 +1,96 @@
+/*
+ * 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.groovy.internal;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+
+import org.apache.sling.commons.classloader.DynamicClassLoaderManager;
+import org.apache.sling.scripting.api.AbstractScriptEngineFactory;
+import org.codehaus.groovy.util.ReleaseInfo;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Modified;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.metatype.annotations.Designate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Script engine for Groovy Server Pages.
+ */
+@Component(
+    service = ScriptEngineFactory.class,
+    property = {
+        "service.description=GSP Script Engine",
+        "service.vendor=The Apache Software Foundation"
+    }
+)
+@Designate(
+    ocd = GspScriptEngineFactoryConfiguration.class
+)
+public class GspScriptEngineFactory extends AbstractScriptEngineFactory {
+
+    @Reference
+    private DynamicClassLoaderManager dynamicClassLoaderManager;
+
+    private GspScriptEngineFactoryConfiguration configuration;
+
+    private final Logger logger = LoggerFactory.getLogger(GspScriptEngineFactory.class);
+
+    public GspScriptEngineFactory() {
+    }
+
+    @Activate
+    private void activate(final GspScriptEngineFactoryConfiguration configuration) {
+        logger.debug("activating");
+        this.configuration = configuration;
+        configure(configuration);
+    }
+
+    @Modified
+    private void modified(final GspScriptEngineFactoryConfiguration configuration) {
+        logger.debug("modifying");
+        this.configuration = configuration;
+        configure(configuration);
+    }
+
+    @Deactivate
+    private void deactivate() {
+        logger.debug("deactivating");
+    }
+
+    private void configure(final GspScriptEngineFactoryConfiguration configuration) {
+        setExtensions(configuration.extensions());
+        setMimeTypes(configuration.mimeTypes());
+        setNames(configuration.names());
+    }
+
+    public String getLanguageName() {
+        return "Groovy Server Pages";
+    }
+
+    public String getLanguageVersion() {
+        return ReleaseInfo.getVersion();
+    }
+
+    public ScriptEngine getScriptEngine() {
+        return new GspScriptEngine(this, dynamicClassLoaderManager.getDynamicClassLoader());
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/groovy/internal/GspScriptEngineFactoryConfiguration.java b/src/main/java/org/apache/sling/scripting/groovy/internal/GspScriptEngineFactoryConfiguration.java
new file mode 100644
index 0000000..d4cb8ff
--- /dev/null
+++ b/src/main/java/org/apache/sling/scripting/groovy/internal/GspScriptEngineFactoryConfiguration.java
@@ -0,0 +1,59 @@
+/*
+ * 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.groovy.internal;
+
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
+
+@ObjectClassDefinition(
+    name = "Apache Sling Scripting Groovy GSP “ScriptEngineFactory”",
+    description = "Script engine factory for Groovy's GString template engine."
+)
+@interface GspScriptEngineFactoryConfiguration {
+
+    @AttributeDefinition(
+        name = "service ranking",
+        description = "Service property for identifying the service's ranking number."
+    )
+    int service_ranking() default 0;
+
+    @AttributeDefinition(
+        name = "extensions",
+        description = "The extensions this script engine is registered for."
+    )
+    String[] extensions() default {
+        "gsp"
+    };
+
+    @AttributeDefinition(
+        name = "mime types",
+        description = "The MIME (content) types this script engine is registered for."
+    )
+    String[] mimeTypes() default {
+        "text/x-gsp"
+    };
+
+    @AttributeDefinition(
+        name = "names",
+        description = "The names under which this script engine is registered."
+    )
+    String[] names() default {
+        "GSP",
+        "gsp"
+    };
+
+}
diff --git a/src/main/java/org/apache/sling/scripting/groovy/json/internal/JsonBuilderBindingsValuesProvider.java b/src/main/java/org/apache/sling/scripting/groovy/internal/JsonBuilderBindingsValuesProvider.java
similarity index 53%
rename from src/main/java/org/apache/sling/scripting/groovy/json/internal/JsonBuilderBindingsValuesProvider.java
rename to src/main/java/org/apache/sling/scripting/groovy/internal/JsonBuilderBindingsValuesProvider.java
index 520f9ca..2b10d0b 100644
--- a/src/main/java/org/apache/sling/scripting/groovy/json/internal/JsonBuilderBindingsValuesProvider.java
+++ b/src/main/java/org/apache/sling/scripting/groovy/internal/JsonBuilderBindingsValuesProvider.java
@@ -14,33 +14,33 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.sling.scripting.groovy.json.internal;
+package org.apache.sling.scripting.groovy.internal;
 
-import groovy.json.JsonBuilder;
-
-import java.util.HashMap;
+import javax.script.Bindings;
 
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Properties;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Service;
+import groovy.json.JsonBuilder;
+import org.apache.sling.scripting.api.BindingsValuesProvider;
+import org.osgi.service.component.annotations.Component;
 
 /**
  * BindingsValuesProvider which binds an instance of JsonBuilder.
  */
-@SuppressWarnings("serial")
-@Component(immediate=true, metatype=false)
-@Service
-@Properties({
-    @Property(name="service.description", value="JSONGroovyBuilder BindingsValuesProvider"),
-    @Property(name="service.vendor", value="The Apache Software Foundation"),
-    @Property(name="javax.script.name", value="groovy")
-})
-public class JsonBuilderBindingsValuesProvider extends HashMap<String, Object> {
+@Component(
+    immediate = true,
+    service = BindingsValuesProvider.class,
+    property = {
+        "javax.script.name=gsp",
+        "service.description=Groovy JsonBuilder BindingsValuesProvider",
+        "service.vendor=The Apache Software Foundation"
+
+    }
+)
+public class JsonBuilderBindingsValuesProvider implements BindingsValuesProvider {
 
-    public JsonBuilderBindingsValuesProvider() {
-        super();
-        put("jsonBuilder", new JsonBuilder());
+    @Override
+    public void addBindings(final Bindings bindings) {
+        final JsonBuilder jsonBuilder = new JsonBuilder();
+        bindings.put("jsonBuilder", jsonBuilder);
     }
 
 }
diff --git a/src/main/java/org/apache/sling/scripting/groovy/scripting/internal/GSPScriptEngineFactory.java b/src/main/java/org/apache/sling/scripting/groovy/scripting/internal/GSPScriptEngineFactory.java
deleted file mode 100644
index bdef117..0000000
--- a/src/main/java/org/apache/sling/scripting/groovy/scripting/internal/GSPScriptEngineFactory.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.groovy.scripting.internal;
-
-import java.util.Collections;
-import java.util.List;
-
-import javax.script.ScriptEngine;
-
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Properties;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.commons.classloader.DynamicClassLoaderManager;
-import org.apache.sling.scripting.api.AbstractScriptEngineFactory;
-import org.codehaus.groovy.util.ReleaseInfo;
-
-/**
- * Script engine for Groovy Server Pages.
- */
-@Component
-@Service
-@Properties({
-    @Property(name="service.vendor", value="The Apache Software Foundation"),
-    @Property(name="service.description", value="GSP Script Engine"),
-    @Property(name="extensions", value = {"gsp"}),
-    @Property(name="names", value = {"gsp", "GSP"}),
-    @Property(name="compatible.javax.script.name", value="groovy")
-})
-public class GSPScriptEngineFactory extends AbstractScriptEngineFactory {
-    
-    public GSPScriptEngineFactory() {
-        setNames("gsp", "GSP");
-    }
-
-    @Reference
-    private DynamicClassLoaderManager dynamicClassLoaderManager;
-
-    public String getLanguageName() {
-        return "Groovy Server Pages";
-    }
-    
-    @Override
-    public List<String> getExtensions() {
-        return Collections.singletonList("gsp");
-    }
-
-    public String getLanguageVersion() {
-        return ReleaseInfo.getVersion();
-    }
-
-    public ScriptEngine getScriptEngine() {
-        return new GSPScriptEngine(this, dynamicClassLoaderManager.getDynamicClassLoader());
-    }
-
-}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-scripting-groovy] 02/06: adjust name

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-groovy.git

commit 6223ec8ec52923bf0504329e4855312ef05f4552
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Thu Dec 28 17:23:33 2017 +0100

    adjust name
---
 README.md | 2 +-
 pom.xml   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 1682688..1401f5c 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Apache Sling Scripting Groovy Support
+# Apache Sling Scripting Groovy
 
 This module is part of the [Apache Sling](https://sling.apache.org) project.
 
diff --git a/pom.xml b/pom.xml
index a2f52c7..e35e465 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,7 +31,7 @@
   <version>1.0.3-SNAPSHOT</version>
   <packaging>bundle</packaging>
 
-  <name>Apache Sling Scripting Groovy Support</name>
+  <name>Apache Sling Scripting Groovy</name>
   <description>Support for scripting with Groovy</description>
 
   <properties>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-scripting-groovy] 04/06: SLING-7335 Update Groovy to 2.4.13

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-groovy.git

commit a8d0493ce990544adedea00fe9d1ca54503d81e2
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Thu Dec 28 17:37:36 2017 +0100

    SLING-7335 Update Groovy to 2.4.13
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 924f774..25f0455 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,10 +35,10 @@
   <description>Support for scripting with Groovy</description>
 
   <properties>
-    <groovy.version>2.4.9</groovy.version>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
     <sling.java.version>8</sling.java.version>
+    <groovy.version>2.4.13</groovy.version>
   </properties>
 
   <scm>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-scripting-groovy] 03/06: use sling.java.version and set encoding

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-groovy.git

commit d36dee02559cb4825a361fe121ded799a12526cc
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Thu Dec 28 17:27:59 2017 +0100

    use sling.java.version and set encoding
---
 pom.xml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pom.xml b/pom.xml
index e35e465..924f774 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,6 +36,9 @@
 
   <properties>
     <groovy.version>2.4.9</groovy.version>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+    <sling.java.version>8</sling.java.version>
   </properties>
 
   <scm>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-scripting-groovy] 01/06: use Sling Parent 32

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-groovy.git

commit 1b0dfe064d74c601d281014ced9d9e5e48fa4ca4
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Thu Dec 28 17:21:33 2017 +0100

    use Sling Parent 32
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 129be82..a2f52c7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,8 +23,8 @@
   <parent>
     <artifactId>sling</artifactId>
     <groupId>org.apache.sling</groupId>
-    <version>26</version>
-    <relativePath />
+    <version>32</version>
+    <relativePath/>
   </parent>
 
   <artifactId>org.apache.sling.scripting.groovy</artifactId>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.