This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.resourcebuilder-1.0.0 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourcebuilder.git
commit a842d79b86fc7529edf9cad472759662c9779169 Author: Bertrand Delacretaz <[email protected]> AuthorDate: Fri Dec 11 10:25:02 2015 +0000 SLING-5356 - server-side tests setup (that's a lot of stuff in the pom...) git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/resourcebuilder@1719329 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 128 +++++++++++++++++++++ .../customizers/RBIT_TeleporterCustomizer.java | 45 ++++++++ .../resourcebuilder/it/ResourceBuilderIT.java | 44 +++++++ 3 files changed, 217 insertions(+) diff --git a/pom.xml b/pom.xml index 9d5ae53..93a9251 100644 --- a/pom.xml +++ b/pom.xml @@ -34,6 +34,18 @@ <name>Apache Sling Commons Resource Builder</name> <description>Utilities to create Sling content</description> + <properties> + <!-- Set this to run the server on a specific port + <http.port></http.port> + --> + + <!-- Set this to run tests against an existing server instance --> + <keepJarRunning>false</keepJarRunning> + + <!-- Options for the jar to execute. $JAREXEC_SERVER_PORT$ is replaced by the + selected port number --> + <jar.executor.jar.options>-p $JAREXEC_SERVER_PORT$</jar.executor.jar.options> + </properties> <scm> <connection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/resourcebuilder</connection> <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/resourcebuilder</developerConnection> @@ -57,9 +69,100 @@ <configuration> <excludes> <exclude>src/test/resources/**</exclude> + <exclude>sling/**</exclude> </excludes> </configuration> </plugin> + <plugin> + <!-- Find free ports to run our server --> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>reserve-server-port</id> + <goals> + <goal>reserve-network-port</goal> + </goals> + <phase>process-resources</phase> + <configuration> + <portNames> + <portName>http.port</portName> + </portNames> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <executions> + <execution> + <id>integration-test</id> + <goals> + <goal>integration-test</goal> + </goals> + </execution> + <execution> + <id>verify</id> + <goals> + <goal>verify</goal> + </goals> + </execution> + </executions> + <configuration> + <systemPropertyVariables> + <!-- these are the minimal options required for the jar executor, see bundle-with-it module for more --> + <keepJarRunning>${keepJarRunning}</keepJarRunning> + <jar.executor.jar.options>${jar.executor.jar.options}</jar.executor.jar.options> + <jar.executor.server.port>${http.port}</jar.executor.server.port> + <additional.bundles.path>${project.build.directory}</additional.bundles.path> + <server.ready.path.1>/:script src="system/sling.js"</server.ready.path.1> + <server.ready.path.2>/.explorer.html:href="/libs/sling/explorer/css/explorer.css"</server.ready.path.2> + <server.ready.path.3>/sling-test/sling/sling-test.html:Sling client library tests</server.ready.path.3> + + <!-- Additional bundles to install for testing --> + <sling.additional.bundle.1>org.apache.sling.junit.core</sling.additional.bundle.1> + <sling.additional.bundle.2>${maven.final.name}.jar</sling.additional.bundle.2> + </systemPropertyVariables> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-runnable-jar</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>process-resources</phase> + <configuration> + <includeArtifactIds>org.apache.sling.launchpad</includeArtifactIds> + <excludeTransitive>true</excludeTransitive> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>false</overWriteSnapshots> + </configuration> + </execution> + <execution> + <!-- + Consider all dependencies as candidates to be installed + as additional bundles. We use system properties to define + which bundles to install in which order. + --> + <id>copy-additional-bundles</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>process-resources</phase> + <configuration> + <outputDirectory>${project.build.directory}</outputDirectory> + <excludeTransitive>true</excludeTransitive> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>false</overWriteSnapshots> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> @@ -101,6 +204,31 @@ <version>1.6.0</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.junit.core</artifactId> + <version>1.0.14</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.testing.tools</artifactId> + <version>1.0.10</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.junit.teleporter</artifactId> + <!-- SNAPSHOT required due to SLING-5365 --> + <version>1.0.5-SNAPSHOT</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.launchpad</artifactId> + <version>8</version> + <scope>provided</scope> + </dependency> </dependencies> </project> diff --git a/src/test/java/org/apache/sling/junit/teleporter/customizers/RBIT_TeleporterCustomizer.java b/src/test/java/org/apache/sling/junit/teleporter/customizers/RBIT_TeleporterCustomizer.java new file mode 100644 index 0000000..6ba2f6f --- /dev/null +++ b/src/test/java/org/apache/sling/junit/teleporter/customizers/RBIT_TeleporterCustomizer.java @@ -0,0 +1,45 @@ +/* + * 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.junit.teleporter.customizers; + +import org.apache.sling.junit.rules.TeleporterRule; +import org.apache.sling.testing.teleporter.client.ClientSideTeleporter; +import org.apache.sling.testing.tools.sling.SlingTestBase; +import org.apache.sling.testing.tools.sling.TimeoutsProvider; + +import aQute.bnd.osgi.Constants; + +/** Setup the ClientSideTeleporter for our integration tests. + */ +public class RBIT_TeleporterCustomizer implements TeleporterRule.Customizer { + + private final static SlingTestBase S = new SlingTestBase(); + + @Override + public void customize(TeleporterRule t, String options) { + final ClientSideTeleporter cst = (ClientSideTeleporter)t; + cst.setBaseUrl(S.getServerBaseUrl()); + cst.setServerCredentials(S.getServerUsername(), S.getServerPassword()); + cst.setTestReadyTimeoutSeconds(TimeoutsProvider.getInstance().getTimeout(5)); + + // Make sure our bundle API is imported instead of embedded + final String apiPackage = "org.apache.sling.testing.samples.bundlewit.api"; + cst.includeDependencyPrefix("org.apache.sling.testing.samples.bundlewit"); + cst.excludeDependencyPrefix(apiPackage); + cst.getAdditionalBundleHeaders().put(Constants.IMPORT_PACKAGE, apiPackage); + } +} \ No newline at end of file diff --git a/src/test/java/org/apache/sling/resourcebuilder/it/ResourceBuilderIT.java b/src/test/java/org/apache/sling/resourcebuilder/it/ResourceBuilderIT.java new file mode 100644 index 0000000..3623f33 --- /dev/null +++ b/src/test/java/org/apache/sling/resourcebuilder/it/ResourceBuilderIT.java @@ -0,0 +1,44 @@ +/* + * 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.resourcebuilder.it; + +import org.apache.sling.junit.rules.TeleporterRule; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.osgi.service.cm.ConfigurationAdmin; + +/** Server-side integration test for the + * ResourceBuilder, acquired via the ResourceBuilderProvider + */ +public class ResourceBuilderIT { + + @Rule + public final TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "RBIT_Teleporter"); + + @Before + public void setup() { + teleporter.getService(ConfigurationAdmin.class); + } + + @Test + public void basicResource() { + } + +} -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
