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 2016/04/26 06:52:53 UTC

svn commit: r1740946 - in /sling/trunk/contrib: ./ scripting/org.apache.sling.scripting.freemarker.it/ scripting/org.apache.sling.scripting.freemarker.it/src/ scripting/org.apache.sling.scripting.freemarker.it/src/main/ scripting/org.apache.sling.scrip...

Author: olli
Date: Tue Apr 26 04:52:52 2016
New Revision: 1740946

URL: http://svn.apache.org/viewvc?rev=1740946&view=rev
Log:
SLING-5692 Add Integration Tests for Scripting FreeMarker

Added:
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/README.md
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/pom.xml
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/java/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/java/org/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/java/org/apache/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/java/org/apache/sling/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/java/org/apache/sling/scripting/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/java/org/apache/sling/scripting/freemarker/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/java/org/apache/sling/scripting/freemarker/it/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/java/org/apache/sling/scripting/freemarker/it/page/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/java/org/apache/sling/scripting/freemarker/it/page/Page.java
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/apps/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/apps/freemarker/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/apps/freemarker/page/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/apps/freemarker/page/adaptto/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/apps/freemarker/page/adaptto/html.ftl
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/apps/freemarker/page/simple/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/apps/freemarker/page/simple/html.ftl
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/content/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/content/freemarker.json
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/AdaptToModelIT.java
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/FreemarkerScriptEngineFactoryIT.java
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/FreemarkerTestSupport.java
    sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/SimpleIT.java
Modified:
    sling/trunk/contrib/pom.xml

Modified: sling/trunk/contrib/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/pom.xml?rev=1740946&r1=1740945&r2=1740946&view=diff
==============================================================================
--- sling/trunk/contrib/pom.xml (original)
+++ sling/trunk/contrib/pom.xml Tue Apr 26 04:52:52 2016
@@ -143,6 +143,7 @@
           <module>scripting/scala/config</module>
           <module>scripting/scala/samples/hello-world</module>
           <module>scripting/scala/samples/forum</module>
+          <module>scripting/org.apache.sling.scripting.freemarker.it</module>
           <module>scripting/org.apache.sling.scripting.thymeleaf</module>
           <module>scripting/org.apache.sling.scripting.thymeleaf.it</module>
           <module>scripting/velocity</module>

Added: sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/README.md
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/README.md?rev=1740946&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/README.md (added)
+++ sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/README.md Tue Apr 26 04:52:52 2016
@@ -0,0 +1,4 @@
+Apache Sling Scripting FreeMarker IT
+====================================
+
+Integration Tests for Apache Sling Scripting FreeMarker

Added: sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/pom.xml?rev=1740946&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/pom.xml (added)
+++ sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/pom.xml Tue Apr 26 04:52:52 2016
@@ -0,0 +1,256 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.sling</groupId>
+    <artifactId>sling</artifactId>
+    <version>26</version>
+    <relativePath/>
+  </parent>
+
+  <artifactId>org.apache.sling.scripting.freemarker.it</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+
+  <name>Apache Sling Scripting FreeMarker IT</name>
+  <description>Apache Sling Scripting FreeMarker IT</description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+    <sling.java.version>7</sling.java.version>
+    <org.apache.karaf.version>4.0.4</org.apache.karaf.version>
+    <org.ops4j.pax.exam.version>4.8.0</org.ops4j.pax.exam.version>
+  </properties>
+
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it</developerConnection>
+    <url>http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it</url>
+  </scm>
+
+  <dependencies>
+    <!-- javax -->
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <version>1</version>
+      <scope>provided</scope>
+    </dependency>
+    <!-- Apache Karaf -->
+    <dependency>
+      <groupId>org.apache.karaf</groupId>
+      <artifactId>apache-karaf</artifactId>
+      <type>tar.gz</type>
+      <version>${org.apache.karaf.version}</version>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.karaf</groupId>
+          <artifactId>org.apache.karaf.client</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <!-- Apache Sling -->
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.api</artifactId>
+      <version>2.11.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.auth.core</artifactId>
+      <version>1.3.12</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.engine</artifactId>
+      <version>2.4.6</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.jcr.api</artifactId>
+      <version>2.3.0</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.launchpad.karaf-features</artifactId>
+      <version>0.1.1-SNAPSHOT</version>
+      <type>xml</type>
+      <classifier>features</classifier>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.launchpad.karaf-integration-tests</artifactId>
+      <version>0.1.1-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.models.api</artifactId>
+      <version>1.2.2</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.scripting.freemarker</artifactId>
+      <version>2.0.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <!-- bnd -->
+    <dependency>
+      <groupId>biz.aQute.bnd</groupId>
+      <artifactId>biz.aQute.bndlib</artifactId>
+      <version>2.4.1</version>
+      <scope>test</scope>
+    </dependency>
+    <!-- javassist -->
+    <dependency>
+      <groupId>org.javassist</groupId>
+      <artifactId>javassist</artifactId>
+      <version>3.20.0-GA</version>
+      <scope>test</scope>
+    </dependency>
+    <!-- jsoup -->
+    <dependency>
+      <groupId>org.jsoup</groupId>
+      <artifactId>jsoup</artifactId>
+      <version>1.9.1</version>
+      <scope>test</scope>
+    </dependency>
+    <!-- logging -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>test</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-container-karaf</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>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.3</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Sling-Initial-Content>
+              apps/freemarker;path:=/apps/freemarker;overwrite:=true;uninstall:=true,
+              content;path:=/content;overwrite:=true;uninstall:=true
+            </Sling-Initial-Content>
+            <Sling-Model-Packages>
+              org.apache.sling.scripting.freemarker.it.page
+            </Sling-Model-Packages>
+          </instructions>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.servicemix.tooling</groupId>
+        <artifactId>depends-maven-plugin</artifactId>
+        <version>1.2</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>generate-depends-file</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>it</id>
+      <activation>
+        <jdk>[1.8,)</jdk>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-failsafe-plugin</artifactId>
+            <version>2.18.1</version>
+            <executions>
+              <execution>
+                <goals>
+                  <goal>integration-test</goal>
+                  <goal>verify</goal>
+                </goals>
+              </execution>
+            </executions>
+            <configuration>
+              <systemProperties>
+                <property>
+                  <name>bundle.filename</name>
+                  <value>${basedir}/target/${project.build.finalName}.jar</value>
+                </property>
+              </systemProperties>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
+</project>

Added: sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/java/org/apache/sling/scripting/freemarker/it/page/Page.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/java/org/apache/sling/scripting/freemarker/it/page/Page.java?rev=1740946&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/java/org/apache/sling/scripting/freemarker/it/page/Page.java (added)
+++ sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/java/org/apache/sling/scripting/freemarker/it/page/Page.java Tue Apr 26 04:52:52 2016
@@ -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.freemarker.it.page;
+
+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);
+    }
+
+}

Added: sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/apps/freemarker/page/adaptto/html.ftl
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/apps/freemarker/page/adaptto/html.ftl?rev=1740946&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/apps/freemarker/page/adaptto/html.ftl (added)
+++ sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/apps/freemarker/page/adaptto/html.ftl Tue Apr 26 04:52:52 2016
@@ -0,0 +1,29 @@
+<!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.
+-->
+<#assign page = request.adaptTo(statics["org.apache.sling.scripting.freemarker.it.page.Page"].class)>
+<html>
+<head>
+  <meta charset="UTF-8"/>
+  <title>${page.title!''?html}</title>
+</head>
+<body>
+<span id="name">${page.name!''?html}</span>
+</body>
+</html>

Added: sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/apps/freemarker/page/simple/html.ftl
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/apps/freemarker/page/simple/html.ftl?rev=1740946&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/apps/freemarker/page/simple/html.ftl (added)
+++ sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/apps/freemarker/page/simple/html.ftl Tue Apr 26 04:52:52 2016
@@ -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!''?html}</title>
+</head>
+<body>
+<span id="name">${resource.name!''?html}</span>
+</body>
+</html>

Added: sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/content/freemarker.json
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/content/freemarker.json?rev=1740946&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/content/freemarker.json (added)
+++ sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/main/resources/content/freemarker.json Tue Apr 26 04:52:52 2016
@@ -0,0 +1,18 @@
+{
+    "jcr:primaryType": "nt:unstructured",
+    "sling:resourceType": "freemarker/page/main",
+    "sling:resourceSuperType": "freemarker/page",
+    "title": "Apache Sling Scripting Freemarker",
+    "simple": {
+        "jcr:primaryType": "nt:unstructured",
+        "sling:resourceType": "freemarker/page/simple",
+        "sling:resourceSuperType": "freemarker/page",
+        "title": "freemarker simple"
+    },
+    "adaptto": {
+        "jcr:primaryType": "nt:unstructured",
+        "sling:resourceType": "freemarker/page/adaptto",
+        "sling:resourceSuperType": "freemarker/page",
+        "title": "Sling Models adaptTo()"
+    }
+}

Added: sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/AdaptToModelIT.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/AdaptToModelIT.java?rev=1740946&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/AdaptToModelIT.java (added)
+++ sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/AdaptToModelIT.java Tue Apr 26 04:52:52 2016
@@ -0,0 +1,62 @@
+/*
+ * 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.freemarker.it;
+
+import java.io.IOException;
+
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+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.is;
+import static org.junit.Assert.assertThat;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class AdaptToModelIT extends FreemarkerTestSupport {
+
+    private Document document;
+
+    @Before
+    public void setup() throws IOException {
+        final String url = String.format("http://localhost:%s/freemarker/adaptto.html", httpPort());
+        document = Jsoup.connect(url).get();
+    }
+
+    @Test
+    @Ignore
+    public void testTitle() {
+        assertThat(document.title(), is("Sling Models adaptTo()"));
+    }
+
+    @Test
+    @Ignore
+    public void testPageName() {
+        final Element name = document.getElementById("name");
+        assertThat("adaptto", is(name.text()));
+    }
+
+}

Added: sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/FreemarkerScriptEngineFactoryIT.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/FreemarkerScriptEngineFactoryIT.java?rev=1740946&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/FreemarkerScriptEngineFactoryIT.java (added)
+++ sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/FreemarkerScriptEngineFactoryIT.java Tue Apr 26 04:52:52 2016
@@ -0,0 +1,62 @@
+/*
+ * 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.freemarker.it;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+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 FreemarkerScriptEngineFactoryIT extends FreemarkerTestSupport {
+
+    @Test
+    public void testScriptEngineFactory() {
+        assertNotNull(scriptEngineFactory);
+    }
+
+    @Test
+    public void testScriptEngineFactoryEngineName() {
+        assertThat("Apache Sling Scripting FreeMarker", is(scriptEngineFactory.getEngineName()));
+    }
+
+    @Test
+    public void testScriptEngineFactoryLanguageName() {
+        assertThat("FreeMarker", is(scriptEngineFactory.getLanguageName()));
+    }
+
+    @Test
+    public void testScriptEngineFactoryLanguageVersion() {
+        assertThat(scriptEngineFactory.getLanguageVersion(), startsWith("2.3"));
+    }
+
+    @Test
+    public void testScriptEngineFactoryNames() {
+        assertThat(scriptEngineFactory.getNames(), hasItem("freemarker"));
+    }
+
+}

Added: sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/FreemarkerTestSupport.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/FreemarkerTestSupport.java?rev=1740946&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/FreemarkerTestSupport.java (added)
+++ sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/FreemarkerTestSupport.java Tue Apr 26 04:52:52 2016
@@ -0,0 +1,69 @@
+/*
+ * 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.freemarker.it;
+
+import java.io.File;
+
+import javax.inject.Inject;
+import javax.script.ScriptEngineFactory;
+
+import org.apache.sling.auth.core.AuthenticationSupport;
+import org.apache.sling.engine.SlingRequestProcessor;
+import org.apache.sling.launchpad.karaf.testing.KarafTestSupport;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.OptionUtils;
+import org.ops4j.pax.exam.util.Filter;
+
+import static org.ops4j.pax.exam.CoreOptions.bundle;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+
+public abstract class FreemarkerTestSupport extends KarafTestSupport {
+
+    @Inject
+    protected SlingRequestProcessor slingRequestProcessor;
+
+    @Inject
+    protected AuthenticationSupport authenticationSupport;
+
+    @Inject
+    @Filter(value = "(names=freemarker)")
+    protected ScriptEngineFactory scriptEngineFactory;
+
+    @Configuration
+    public Option[] configuration() {
+        final String filename = System.getProperty("bundle.filename");
+        final File file = new File(filename);
+        return OptionUtils.combine(baseConfiguration(),
+            editConfigurationFilePut("etc/org.ops4j.pax.logging.cfg", "log4j.rootLogger", "ERROR, out, sift, osgi:*"),
+            bundle(file.toURI().toString()),
+            addSlingFeatures(
+                "sling-launchpad-oak-tar",
+                "sling-scripting",
+                "sling-extension-models"
+            ),
+            mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.scripting.freemarker").versionAsInProject(),
+            mavenBundle().groupId("org.javassist").artifactId("javassist").versionAsInProject(),
+            mavenBundle().groupId("org.jsoup").artifactId("jsoup").versionAsInProject(),
+            mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject()
+        );
+    }
+
+}

Added: sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/SimpleIT.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/SimpleIT.java?rev=1740946&view=auto
==============================================================================
--- sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/SimpleIT.java (added)
+++ sling/trunk/contrib/scripting/org.apache.sling.scripting.freemarker.it/src/test/java/org/apache/sling/scripting/freemarker/it/SimpleIT.java Tue Apr 26 04:52:52 2016
@@ -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.freemarker.it;
+
+import java.io.IOException;
+
+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.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class SimpleIT extends FreemarkerTestSupport {
+
+    private Document document;
+
+    @Before
+    public void setup() throws IOException {
+        final String url = String.format("http://localhost:%s/freemarker/simple.html", httpPort());
+        document = Jsoup.connect(url).get();
+    }
+
+    @Test
+    public void testTitle() {
+        assertThat(document.title(), is("freemarker simple"));
+    }
+
+    @Test
+    public void testPageName() {
+        final Element name = document.getElementById("name");
+        assertThat("simple", is(name.text()));
+    }
+
+}