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/08/24 09:38:40 UTC
svn commit: r1806016 - in /sling/trunk/contrib/extensions/sling-pipes:
pom.xml src/test/java/org/apache/sling/pipes/it/
src/test/java/org/apache/sling/pipes/it/PipesTestSupport.java
src/test/java/org/apache/sling/pipes/it/PlumberTestIT.java
Author: olli
Date: Thu Aug 24 09:38:39 2017
New Revision: 1806016
URL: http://svn.apache.org/viewvc?rev=1806016&view=rev
Log:
SLING-7012 Pipes miss some integration tests
adding IT support and initial IT from Nicolas
Added:
sling/trunk/contrib/extensions/sling-pipes/src/test/java/org/apache/sling/pipes/it/
sling/trunk/contrib/extensions/sling-pipes/src/test/java/org/apache/sling/pipes/it/PipesTestSupport.java
sling/trunk/contrib/extensions/sling-pipes/src/test/java/org/apache/sling/pipes/it/PlumberTestIT.java
Modified:
sling/trunk/contrib/extensions/sling-pipes/pom.xml
Modified: sling/trunk/contrib/extensions/sling-pipes/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-pipes/pom.xml?rev=1806016&r1=1806015&r2=1806016&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/sling-pipes/pom.xml (original)
+++ sling/trunk/contrib/extensions/sling-pipes/pom.xml Thu Aug 24 09:38:39 2017
@@ -37,6 +37,7 @@
<properties>
<sling.java.version>8</sling.java.version>
+ <org.ops4j.pax.exam.version>4.11.0</org.ops4j.pax.exam.version>
</properties>
<scm>
@@ -63,6 +64,38 @@
</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>
@@ -153,6 +186,25 @@
<version>2.7.4</version>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-json_1.0_spec</artifactId>
+ <version>1.0-alpha-1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.commons.johnzon</artifactId>
+ <version>1.0.0</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- Apache Felix -->
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>5.6.6</version>
+ <scope>test</scope>
+ </dependency>
<!-- testing -->
<dependency>
<groupId>junit</groupId>
@@ -172,15 +224,39 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-json_1.0_spec</artifactId>
- <version>1.0-alpha-1</version>
- <scope>provided</scope>
+ <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>
<dependency>
<groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.commons.johnzon</artifactId>
- <version>1.0.0</version>
+ <artifactId>org.apache.sling.testing.paxexam</artifactId>
+ <version>0.0.4</version>
<scope>test</scope>
</dependency>
</dependencies>
Added: sling/trunk/contrib/extensions/sling-pipes/src/test/java/org/apache/sling/pipes/it/PipesTestSupport.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-pipes/src/test/java/org/apache/sling/pipes/it/PipesTestSupport.java?rev=1806016&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/sling-pipes/src/test/java/org/apache/sling/pipes/it/PipesTestSupport.java (added)
+++ sling/trunk/contrib/extensions/sling-pipes/src/test/java/org/apache/sling/pipes/it/PipesTestSupport.java Thu Aug 24 09:38:39 2017
@@ -0,0 +1,90 @@
+/*
+ * 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.pipes.it;
+
+import javax.inject.Inject;
+
+import org.apache.sling.api.resource.LoginException;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceResolverFactory;
+import org.apache.sling.pipes.Plumber;
+import org.apache.sling.testing.paxexam.TestSupport;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.util.Filter;
+
+import static org.apache.sling.testing.paxexam.SlingOptions.slingExtensionDistribution;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingExtensionEvent;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingExtensionQuery;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingLaunchpadOakTar;
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.systemPackages;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
+
+public abstract class PipesTestSupport extends TestSupport {
+
+ @Inject
+ @Filter(timeout = 3000000)
+ protected Plumber plumber;
+
+ @Inject
+ private ResourceResolverFactory resourceResolverFactory;
+
+ @Configuration
+ public Option[] configuration() {
+ return new Option[]{
+ baseConfiguration(),
+ launchpad(),
+ // Sling Pipes
+ testBundle("bundle.filename"),
+ // testing
+ newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist")
+ .put("whitelist.bundles.regexp", "^PAXEXAM.*$")
+ .asOption(),
+ junitBundles()
+ };
+ }
+
+ protected Option launchpad() {
+ final int httpPort = findFreePort();
+ final String workingDirectory = workingDirectory();
+ return composite(
+ slingLaunchpadOakTar(workingDirectory, httpPort),
+ slingExtensionEvent(),
+ slingExtensionDistribution(),
+ slingExtensionQuery(),
+ // TODO remove johnzon bundle (should be part of sling in upcoming release of org.apache.sling.testing.paxexam)
+ mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.commons.johnzon").version("1.1.0"),
+ // TODO required by Jackrabbit Vault (Sling Distribution)
+ systemPackages(
+ "org.w3c.dom.css",
+ "org.w3c.dom.html",
+ "org.w3c.dom.ranges",
+ "org.w3c.dom.traversal"
+ )
+ );
+ }
+
+ ResourceResolver resolver() throws LoginException {
+ return resourceResolverFactory.getAdministrativeResourceResolver(null);
+ }
+
+}
Added: sling/trunk/contrib/extensions/sling-pipes/src/test/java/org/apache/sling/pipes/it/PlumberTestIT.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/sling-pipes/src/test/java/org/apache/sling/pipes/it/PlumberTestIT.java?rev=1806016&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/sling-pipes/src/test/java/org/apache/sling/pipes/it/PlumberTestIT.java (added)
+++ sling/trunk/contrib/extensions/sling-pipes/src/test/java/org/apache/sling/pipes/it/PlumberTestIT.java Thu Aug 24 09:38:39 2017
@@ -0,0 +1,49 @@
+/*
+ * 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.pipes.it;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+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.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class PlumberTestIT extends PipesTestSupport {
+
+ @Test
+ public void simpleTest() throws Exception {
+ try (ResourceResolver resolver = resolver()) {
+ plumber.getBuilder(resolver)
+ .mkdir("/content/my")
+ .write("test", true)
+ .run();
+ Resource test = resolver.getResource("/content/my/test");
+ assertNotNull("there should be a resource", test);
+ assertEquals("should be a boolean equals to true", true, test.adaptTo(Boolean.class));
+ }
+ }
+
+}