You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:53:30 UTC
[sling-org-apache-sling-launchpad-testing-war] 01/16: creating
module to run integration tests against the war distribution
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.launchpad.testing-war-6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-launchpad-testing-war.git
commit 3930b637b489ee9e2948d25411b4f3d96f0dc9d4
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Dec 29 00:31:18 2010 +0000
creating module to run integration tests against the war distribution
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/launchpad/testing-war@1053491 13f79535-47bb-0310-9956-ffa450edef68
---
LICENSE | 202 +++++++++
NOTICE | 8 +
README.txt | 35 ++
pom.xml | 498 +++++++++++++++++++++
src/main/bundles/list.xml | 16 +
src/main/resources/META-INF/LICENSE | 202 +++++++++
src/main/resources/META-INF/NOTICE | 8 +
src/main/resources/repository.xml | 77 ++++
src/main/webapp/META-INF/MANIFEST.MF | 3 +
.../resources/config/integrationTestsConfig.cfg | 2 +
src/test/config/sling.properties | 17 +
.../sling/launchpad/testing/LoggingSuite.java | 92 ++++
.../apache/sling/launchpad/testing/TestAll.java | 166 +++++++
src/test/resources/logback-test.xml | 49 ++
src/test/resources/repository.xml | 77 ++++
src/test/rules/emma.drl | 35 ++
src/test/rules/reactor.drl | 56 +++
17 files changed, 1543 insertions(+)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..861d0ce
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,8 @@
+Apache Sling Launchpad Testing
+Copyright 2008-2009 The Apache Software Foundation
+
+Apache Sling is based on source code originally developed
+by Day Software (http://www.day.com/).
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..9f9a254
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,35 @@
+Apache Sling Launchpad Testing WAR module
+
+This module builds a Sling instance using bundles from the trunk, and
+runs integration tests against it, via HTTP.
+
+
+Getting Started
+===============
+
+This component uses a Maven 2 (http://maven.apache.org/) build
+environment. It requires a Java 5 JDK (or higher) and Maven (http://maven.apache.org/)
+2.0.7 or later. We recommend to use the latest Maven version.
+
+If you have Maven 2 installed, you can compile and
+package the jar using the following command:
+
+ mvn package
+
+See the Maven 2 documentation for other build features.
+
+The latest source code for this component is available in the
+Subversion (http://subversion.tigris.org/) source repository of
+the Apache Software Foundation. If you have Subversion installed,
+you can checkout the latest source using the following command:
+
+ svn checkout http://svn.apache.org/repos/asf/sling/trunk/launchpad/webapp
+
+See the Subversion documentation for other source control features.
+
+Integration tests
+-----------------
+This module runs number of integration tests provided by the sibling
+integration-tests module.
+
+To run individual tests, see the README.txt in that module.
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..a152448
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,498 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>sling</artifactId>
+ <version>10</version>
+ <relativePath>../../parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.apache.sling.launchpad.testing-war</artifactId>
+ <packaging>war</packaging>
+ <version>6-SNAPSHOT</version>
+
+ <name>Apache Sling Launchpad Testing WAR version</name>
+ <description>
+ Sling Launchpad Testing module, contains integration tests that
+ were previously in the launchpad webapp module.
+ </description>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/launchpad/testing-war</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/launchpad/testing-war</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/launchpad/testing-war</url>
+ </scm>
+
+ <properties>
+ <!-- HTTP port to use when running mvn jetty:run -->
+ <jetty.http.port>8888</jetty.http.port>
+
+ <!-- path suffix for HTTP access to Sling -->
+ <http.base.path />
+
+ <!-- path suffix for WebDAV access to the repository -->
+ <webdav.workspace.path />
+
+ <!-- hostname for integration tests -->
+ <test.host>localhost</test.host>
+
+ <!--
+ Disable Jetty webapp rescan (override with -D)
+ -->
+ <jetty.scan.interval.seconds>0</jetty.scan.interval.seconds>
+
+ <!--
+ Sling home directory when starting with jetty:run
+ -->
+ <jetty.sling.home>target/sling</jetty.sling.home>
+
+ <!--
+ Defines which tests are for the "integration-testing" phase
+ -->
+ <integration.test.code.path>
+ **/launchpad/webapp/integrationtest
+ </integration.test.code.path>
+
+ <!--
+ Set this to true to stop mvn once the integration test Jetty instance is
+ started. Useful to manually test the integration testing webapp.
+ -->
+ <integration.test.wait>false</integration.test.wait>
+
+ <resources.bundles.path>${project.build.directory}/launchpad-bundles/resources/bundles</resources.bundles.path>
+
+ <slf4j.version>1.5.11</slf4j.version>
+ <logback.version>0.9.20</logback.version>
+ </properties>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>${basedir}</directory>
+ <includes>
+ <include>derby.log</include>
+ <include>cachedir</include>
+ <include>sling</include>
+ <include>jackrabbit</include>
+ </includes>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>reserve-network-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-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>delete-sling-folder</id>
+ <phase>package</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <echo>SLING-845 - delete parent sling folder before integration tests</echo>
+ <delete dir="../../sling" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <configuration>
+ <contextPath>/</contextPath>
+ <scanIntervalSeconds>
+ ${jetty.scan.interval.seconds}
+ </scanIntervalSeconds>
+
+ <systemProperties>
+ <systemProperty>
+ <name>sling.home</name>
+ <value>${jetty.sling.home}</value>
+ </systemProperty>
+ </systemProperties>
+
+ <connectors>
+ <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <port>${jetty.http.port}</port>
+ <maxIdleTime>60000</maxIdleTime>
+ </connector>
+ </connectors>
+
+ <!--
+ Use target/... as the webapp source, as we unpack stuff there from the
+ Sling launcher modules
+ -->
+ <webAppSourceDirectory>
+ target/${project.artifactId}-${project.version}
+ </webAppSourceDirectory>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>maven-launchpad-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>prepare-package</id>
+ <goals>
+ <goal>prepare-package</goal>
+ </goals>
+ <configuration>
+ <defaultBundleList>
+ <version>6-SNAPSHOT</version>
+ </defaultBundleList>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!--
+ Include sling-app launcher classes and resources, but no Sling
+ bundles (we want to specify our own versions)
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webResources>
+ <!-- the configuration resources -->
+ <resource>
+ <directory>
+ ${project.build.directory}/launchpad-bundles
+ </directory>
+ <targetPath>WEB-INF</targetPath>
+ </resource>
+ <!-- Legal stuff -->
+ <resource>
+ <directory>${basedir}</directory>
+ <targetPath>META-INF</targetPath>
+ <includes>
+ <include>LICENSE*</include>
+ <include>NOTICE*</include>
+ </includes>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <!--
+ WARNING: make sure these URLs are consistent with the
+ cargo-maven2-plugin settings: AFAIK Maven does not
+ expand variables in the <value> element.
+ And WARNING: these properties are duplicated somewhere in this
+ POM with slightly different values...there must be a better way.
+ -->
+ <property>
+ <name>launchpad.http.server.url</name>
+ <value>
+ http://${test.host}:${http.port}/${http.base.path}
+ </value>
+ </property>
+ <property>
+ <name>launchpad.webdav.server.url</name>
+ <value>
+ http://${test.host}:${http.port}/${webdav.workspace.path}
+ </value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <!-- No javadocs -->
+ <excludePackageNames>
+ org.apache.sling
+ </excludePackageNames>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <profiles>
+ <profile>
+ <!--
+ Run the cargo-based integration tests.
+ -->
+ <id>cargoIntegrationTesting</id>
+ <activation>
+ <property>
+ <name>!maven.test.skip</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>surefire-integration-test</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <!-- needed to make it possible to scan the jar -->
+ <useManifestOnlyJar>false</useManifestOnlyJar>
+
+ <excludes>
+ <exclude>none</exclude>
+ </excludes>
+ <includes>
+ <include>
+ **/launchpad/testing/TestAll.java
+ </include>
+ </includes>
+ <systemProperties>
+ <!--
+ WARNING: make sure these URLs are consistent with the
+ cargo-maven2-plugin settings: AFAIK Maven does not
+ expand variables in the <value> element.
+ And WARNING: these properties are duplicated somewhere in this
+ POM with slightly different values...there must be a better way.
+ -->
+ <property>
+ <name>
+ launchpad.http.server.url
+ </name>
+ <value>
+ http://${test.host}:${http.port}/${project.build.finalName}
+ </value>
+ </property>
+ <property>
+ <name>
+ launchpad.webdav.server.url
+ </name>
+ <value>
+ http://${test.host}:${http.port}/${project.build.finalName}/${webdav.workspace.path}
+ </value>
+ </property>
+
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <wait>${integration.test.wait}</wait>
+ <container>
+ <containerId>jetty6x</containerId>
+ <type>embedded</type>
+ <systemProperties>
+ <sling.home>
+ ${basedir}/target/it/sling
+ </sling.home>
+ </systemProperties>
+ </container>
+ <configuration>
+ <home>${project.build.directory}/cargo</home>
+ <properties>
+ <cargo.servlet.port>
+ ${http.port}
+ </cargo.servlet.port>
+ <!--
+ <cargo.jvmargs>-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=30333,server=y,suspend=y</cargo.jvmargs>
+ -->
+ </properties>
+ </configuration>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <!--
+ By default, do not run the integration tests in the test phase, as they have
+ no Sling instance to talk to.
+ See README.txt for how to run the integration tests against a running instance
+ of Sling.
+ -->
+ <id>disableIntegrationTestsInTestPhase</id>
+ <activation>
+ <property>
+ <name>!maven.test.skip</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>
+ ${integration.test.code.path}/**/*.java
+ </exclude>
+ <exclude>
+ **/launchpad/testing/TestAll.java
+ </exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.launchpad.integration-tests</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- The basic Sling WebApp -->
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.launchpad.base</artifactId>
+ <version>2.2.1-SNAPSHOT</version>
+ <classifier>webapp</classifier>
+ <type>war</type>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>biz.aQute</groupId>
+ <artifactId>bnd</artifactId>
+ <version>0.0.169</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Dependencies for the Test Build and Run -->
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.commons.testing</artifactId>
+ <version>2.0.6</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.servlets.post</artifactId>
+ <version>2.0.2-incubator</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>log4j-over-slf4j</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>${logback.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/src/main/bundles/list.xml b/src/main/bundles/list.xml
new file mode 100644
index 0000000..5e3f81e
--- /dev/null
+++ b/src/main/bundles/list.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<bundles>
+ <startLevel level="0">
+ <bundle>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.launchpad.test-services</artifactId>
+ <version>2.0.7-SNAPSHOT</version>
+ </bundle>
+ <bundle>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.launchpad.test-services-war</artifactId>
+ <version>2.0.7-SNAPSHOT</version>
+ <type>war</type>
+ </bundle>
+ </startLevel>
+</bundles>
diff --git a/src/main/resources/META-INF/LICENSE b/src/main/resources/META-INF/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/src/main/resources/META-INF/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
diff --git a/src/main/resources/META-INF/NOTICE b/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000..861d0ce
--- /dev/null
+++ b/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,8 @@
+Apache Sling Launchpad Testing
+Copyright 2008-2009 The Apache Software Foundation
+
+Apache Sling is based on source code originally developed
+by Day Software (http://www.day.com/).
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
diff --git a/src/main/resources/repository.xml b/src/main/resources/repository.xml
new file mode 100644
index 0000000..1cf3602
--- /dev/null
+++ b/src/main/resources/repository.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+-->
+<!DOCTYPE Repository
+ PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 2.0//EN"
+ "http://jackrabbit.apache.org/dtd/repository-2.0.dtd">
+
+<Repository>
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <param name="path" value="${rep.home}/prod_repository"/>
+ </FileSystem>
+
+ <DataStore class="org.apache.jackrabbit.core.data.FileDataStore"/>
+
+ <Security appName="Jackrabbit">
+ <SecurityManager class="org.apache.jackrabbit.core.DefaultSecurityManager" workspaceName="security">
+ </SecurityManager>
+
+ <AccessManager class="org.apache.sling.jcr.jackrabbit.server.impl.security.PluggableDefaultAccessManager">
+ </AccessManager>
+
+ <LoginModule class="org.apache.sling.jcr.jackrabbit.server.impl.security.PluggableDefaultLoginModule">
+ <param name="anonymousId" value="anonymous"/>
+ <param name="adminId" value="admin"/>
+ </LoginModule>
+ </Security>
+
+ <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
+
+ <Workspace name="${wsp.name}">
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <param name="path" value="${wsp.home}"/>
+ </FileSystem>
+ <PersistenceManager class="org.apache.jackrabbit.core.persistence.db.DerbyPersistenceManager">
+ <param name="url" value="jdbc:derby:${wsp.home}/db;create=true"/>
+ <param name="schemaObjectPrefix" value="${wsp.name}_"/>
+ <param name="shutdownOnClose" value="false"/>
+ </PersistenceManager>
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <param name="path" value="${wsp.home}/index"/>
+ <param name="supportHighlighting" value="true"/>
+ </SearchIndex>
+ </Workspace>
+
+ <Versioning rootPath="${rep.home}/version">
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <param name="path" value="${rep.home}/version" />
+ </FileSystem>
+
+ <PersistenceManager class="org.apache.jackrabbit.core.persistence.db.DerbyPersistenceManager">
+ <param name="url" value="jdbc:derby:${rep.home}/version/db;create=true"/>
+ <param name="schemaObjectPrefix" value="version_"/>
+ <param name="shutdownOnClose" value="false"/>
+ </PersistenceManager>
+ </Versioning>
+
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <param name="path" value="${rep.home}/repository/index"/>
+ <param name="supportHighlighting" value="true"/>
+ </SearchIndex>
+</Repository>
\ No newline at end of file
diff --git a/src/main/webapp/META-INF/MANIFEST.MF b/src/main/webapp/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..5e94951
--- /dev/null
+++ b/src/main/webapp/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
diff --git a/src/main/webapp/WEB-INF/resources/config/integrationTestsConfig.cfg b/src/main/webapp/WEB-INF/resources/config/integrationTestsConfig.cfg
new file mode 100644
index 0000000..7473fef
--- /dev/null
+++ b/src/main/webapp/WEB-INF/resources/config/integrationTestsConfig.cfg
@@ -0,0 +1,2 @@
+# Config used to test LaunchpadConfigInstaller
+message=This test config should be loaded at startup
\ No newline at end of file
diff --git a/src/test/config/sling.properties b/src/test/config/sling.properties
new file mode 100644
index 0000000..3959e83
--- /dev/null
+++ b/src/test/config/sling.properties
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+sling.system.packages.class.com.vladium.emma.rt.RT=com.vladium.emma.rt
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/launchpad/testing/LoggingSuite.java b/src/test/java/org/apache/sling/launchpad/testing/LoggingSuite.java
new file mode 100644
index 0000000..658b3fb
--- /dev/null
+++ b/src/test/java/org/apache/sling/launchpad/testing/LoggingSuite.java
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+/*
+ * 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.launchpad.testing;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+
+import org.slf4j.Logger;
+
+/**
+ * Simple TestSuite subclass which logs when each test is starting.
+ */
+class LoggingSuite extends TestSuite {
+
+ private Logger logger;
+
+ private int lastRuns;
+
+ private int lastErrors;
+
+ private int lastFailures;
+
+ LoggingSuite(Set<Class<TestCase>> classSet, String name, Logger logger) {
+ super(classSet.toArray(new Class[classSet.size()]), name);
+ this.logger = logger;
+ }
+
+ @Override
+ public void run(TestResult result) {
+ // result.addListener(new SlingTestListener());
+ super.run(result);
+ }
+
+ @Override
+ public void runTest(Test test, TestResult result) {
+ final String name = (test instanceof TestSuite)
+ ? ((TestSuite) test).getName()
+ : test.getClass().getName();
+ final String startMessage = String.format("Running %s", name);
+ System.out.println(startMessage);
+ logger.info(startMessage);
+
+ super.runTest(test, result);
+
+ final String endMessage = String.format(
+ "Tests run: %d, Failures: %d, Errors: %d, Skipped: %d",
+ result.runCount() - lastRuns, result.failureCount() - lastFailures,
+ result.errorCount() - lastErrors,
+ test.countTestCases() - result.runCount() + lastRuns);
+ System.out.println(endMessage);
+ logger.info(endMessage);
+
+ lastRuns = result.runCount();
+ lastFailures = result.failureCount();
+ lastErrors = result.errorCount();
+ }
+
+}
diff --git a/src/test/java/org/apache/sling/launchpad/testing/TestAll.java b/src/test/java/org/apache/sling/launchpad/testing/TestAll.java
new file mode 100644
index 0000000..2d36f5e
--- /dev/null
+++ b/src/test/java/org/apache/sling/launchpad/testing/TestAll.java
@@ -0,0 +1,166 @@
+/*
+ * 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.launchpad.testing;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Modifier;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.regex.Pattern;
+
+/**
+ *
+ */
+public class TestAll extends TestCase {
+ private static final Logger LOGGER = LoggerFactory.getLogger(TestAll.class);
+
+ @SuppressWarnings("unchecked")
+ public static Test suite() {
+ final ClassLoader sysClassLoader = TestAll.class.getClassLoader();
+ final List<String> matchingClasses = new ArrayList<String>();
+ // Get the URLs
+ final URL[] urls = ((URLClassLoader) sysClassLoader).getURLs();
+ final String testPattern = System.getProperty("integrationTestPattern",
+ "**/launchpad/webapp/integrationtest/**/*Test");
+ final String testRegex = convertToRegex(testPattern);
+ final Pattern pattern = Pattern.compile(testRegex);
+ for (URL u : urls) {
+ try {
+ matchingClasses.addAll(scanFile(new File(u.toURI()), pattern));
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ final Set<Class<TestCase>> classSet = new HashSet<Class<TestCase>>();
+ for (String classFile : matchingClasses) {
+ String className = classFileToName(classFile);
+ try {
+ final Class<TestCase> c = (Class<TestCase>) sysClassLoader.loadClass(className);
+ if (!c.isInterface() && !Modifier.isAbstract(c.getModifiers())) {
+ LOGGER.info("Added " + className);
+ classSet.add(c);
+ }
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+ LOGGER.info(classSet.size() + " test classes found using Pattern "
+ + testRegex);
+ TestSuite suite = new LoggingSuite(classSet,
+ "Sling Integration Tests matching " + testPattern, LOGGER);
+
+ return suite;
+ }
+
+ /**
+ * @param classFile
+ * @return
+ */
+ private static String classFileToName(String classFile) {
+ String className = classFile.substring(0,
+ classFile.length() - (".class".length())).replace('/', '.');
+ if (className.charAt(0) == '.') {
+ className = className.substring(1);
+ }
+ return className;
+ }
+
+ /**
+ * @param testPattern
+ * @return
+ */
+ private static String convertToRegex(String testPattern) {
+ return testPattern.replace("**/", ".a?").replace("*", ".a?").replace(
+ ".a?", ".*?").replace("/", "\\/")
+ + "\\.class$";
+ }
+
+ /**
+ * @param u
+ * @return
+ * @throws IOException
+ * @throws URISyntaxException
+ */
+ private static List<String> scanFile(File f, Pattern pattern)
+ throws URISyntaxException, IOException {
+ List<String> classPathMatches = new ArrayList<String>();
+ if (f.isFile()) {
+ scanJar(f, pattern, classPathMatches);
+ } else {
+ scanDir(f, pattern, classPathMatches, f.getPath().length());
+ }
+ return classPathMatches;
+ }
+
+ /**
+ * @param f
+ * @param pattern
+ * @return
+ */
+ private static void scanDir(File f, Pattern pattern,
+ List<String> classPathMatches, int trim) {
+ if (f.isFile()) {
+ String name = f.getPath().substring(trim);
+ if (pattern.matcher(name).matches()) {
+ classPathMatches.add(name);
+ }
+ } else {
+ for (File cf : f.listFiles()) {
+ scanDir(cf, pattern, classPathMatches, trim);
+ }
+ }
+ }
+
+ /**
+ * @param u
+ * @return
+ * @throws URISyntaxException
+ * @throws IOException
+ */
+ private static void scanJar(File f, Pattern pattern,
+ List<String> classPathMatches) throws URISyntaxException,
+ IOException {
+ JarFile jarFile = new JarFile(f);
+ for (Enumeration<JarEntry> e = jarFile.entries(); e.hasMoreElements();) {
+ JarEntry je = e.nextElement();
+ String entryName = je.getName();
+ if (pattern.matcher(entryName).matches()) {
+ classPathMatches.add(entryName);
+ }
+ }
+ jarFile.close();
+ }
+
+}
diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml
new file mode 100644
index 0000000..51c11bc
--- /dev/null
+++ b/src/test/resources/logback-test.xml
@@ -0,0 +1,49 @@
+<?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.
+ -->
+<configuration>
+
+ <appender name="file" class="ch.qos.logback.core.FileAppender">
+ <file>target/sling-tests.log</file>
+ <encoder>
+ <pattern>%date{HH:mm:ss.SSS} %-5level %-40([%thread] %F:%L) %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="sift" class="ch.qos.logback.classic.sift.SiftingAppender">
+ <discriminator>
+ <Key>testclass</Key>
+ <DefaultValue>junit</DefaultValue>
+ </discriminator>
+ <sift>
+ <appender name="FILE-${testname}" class="ch.qos.logback.core.FileAppender">
+ <File>target/surefire-reports/${testclass}.log</File>
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <Pattern>%date{HH:mm:ss.SSS} %-5level %-40([%thread] %F:%L) %msg%n</Pattern>
+ </layout>
+ </appender>
+ </sift>
+ </appender>
+
+ <logger name="org.apache.sling.launchpad" level="DEBUG" />
+
+ <root level="INFO">
+ <appender-ref ref="file" />
+ <appender-ref ref="sift" />
+ </root>
+
+</configuration>
\ No newline at end of file
diff --git a/src/test/resources/repository.xml b/src/test/resources/repository.xml
new file mode 100644
index 0000000..c20e17d
--- /dev/null
+++ b/src/test/resources/repository.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+-->
+<!DOCTYPE Repository
+ PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 2.0//EN"
+ "http://jackrabbit.apache.org/dtd/repository-2.0.dtd">
+
+<Repository>
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <param name="path" value="${rep.home}/test_repository"/>
+ </FileSystem>
+
+ <DataStore class="org.apache.jackrabbit.core.data.FileDataStore"/>
+
+ <Security appName="Jackrabbit">
+ <SecurityManager class="org.apache.jackrabbit.core.DefaultSecurityManager" workspaceName="security">
+ </SecurityManager>
+
+ <AccessManager class="org.apache.sling.jcr.jackrabbit.server.impl.security.PluggableDefaultAccessManager">
+ </AccessManager>
+
+ <LoginModule class="org.apache.sling.jcr.jackrabbit.server.impl.security.PluggableDefaultLoginModule">
+ <param name="anonymousId" value="anonymous"/>
+ <param name="adminId" value="admin"/>
+ </LoginModule>
+ </Security>
+
+ <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
+
+ <Workspace name="${wsp.name}">
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <param name="path" value="${wsp.home}"/>
+ </FileSystem>
+ <PersistenceManager class="org.apache.jackrabbit.core.persistence.db.DerbyPersistenceManager">
+ <param name="url" value="jdbc:derby:${wsp.home}/db;create=true"/>
+ <param name="schemaObjectPrefix" value="${wsp.name}_"/>
+ <param name="shutdownOnClose" value="false"/>
+ </PersistenceManager>
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <param name="path" value="${wsp.home}/index"/>
+ <param name="supportHighlighting" value="true"/>
+ </SearchIndex>
+ </Workspace>
+
+ <Versioning rootPath="${rep.home}/version">
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <param name="path" value="${rep.home}/version" />
+ </FileSystem>
+
+ <PersistenceManager class="org.apache.jackrabbit.core.persistence.db.DerbyPersistenceManager">
+ <param name="url" value="jdbc:derby:${rep.home}/version/db;create=true"/>
+ <param name="schemaObjectPrefix" value="version_"/>
+ <param name="shutdownOnClose" value="false"/>
+ </PersistenceManager>
+ </Versioning>
+
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <param name="path" value="${rep.home}/repository/index"/>
+ <param name="supportHighlighting" value="true"/>
+ </SearchIndex>
+</Repository>
\ No newline at end of file
diff --git a/src/test/rules/emma.drl b/src/test/rules/emma.drl
new file mode 100644
index 0000000..05d6bd2
--- /dev/null
+++ b/src/test/rules/emma.drl
@@ -0,0 +1,35 @@
+# 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.launchpad.testing
+dialect "mvel"
+
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.*;
+
+rule "Add emma classifier to org.apache.sling SNAPSHOTs"
+
+ when
+ $bundleList : BundleList()
+ $startLevel : StartLevel() from $bundleList.startLevels
+ $bundle : Bundle(groupId == "org.apache.sling" &&
+ type == "jar" &&
+ (version matches ".*-SNAPSHOT$" || version == "LATEST"))
+ from $startLevel.bundles
+ then
+ $bundle.classifier = "emma"
+
+end
+
diff --git a/src/test/rules/reactor.drl b/src/test/rules/reactor.drl
new file mode 100644
index 0000000..d2cbb84
--- /dev/null
+++ b/src/test/rules/reactor.drl
@@ -0,0 +1,56 @@
+# 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.launchpad.testing
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.project.MavenProject;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.*;
+
+global MavenSession mavenSession
+
+function boolean inCurrentBuild(MavenSession session, String artifactId) {
+ for (MavenProject project : session.getSortedProjects()) {
+ if (project.getArtifactId().equals(artifactId)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+function String getBuildVersion(MavenSession session, String artifactId) {
+ for (MavenProject project : session.getSortedProjects()) {
+ if (project.getArtifactId().equals(artifactId)) {
+ return project.getVersion();
+ }
+ }
+ return null;
+}
+
+rule "use LATEST for all Sling bundles"
+
+ when
+ $bundleList : BundleList()
+ $startLevel : StartLevel() from $bundleList.startLevels
+ $bundle : Bundle(groupId == "org.apache.sling")
+ from $startLevel.bundles
+ eval(inCurrentBuild(mavenSession, $bundle.getArtifactId()))
+ then
+ System.out.println("Using reactor version for " + $bundle.getArtifactId());
+ $bundle.setVersion(getBuildVersion(mavenSession, $bundle.getArtifactId()));
+
+end
+
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.