This is an automated email from the ASF dual-hosted git repository. olli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-paxexam.git
commit 9db5cdaa142417ab9c456dd368ac7af51d2054bb Author: Oliver Lietz <[email protected]> AuthorDate: Fri Dec 22 16:18:11 2017 +0100 update README --- README.md | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 777835e..b3d57e9 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ This module is part of the [Apache Sling](https://sling.apache.org) project. -**Test support for use with Pax Exam.** +**Test support for use with [Pax Exam](https://github.com/ops4j/org.ops4j.pax.exam2).** -* _Sling's Karaf Features_ as `Option`s for Pax Exam (without Karaf) +* [_Sling's Karaf Features_](https://sling.apache.org/documentation/karaf.html#sling-karaf-features) as `Option`s for Pax Exam (without Karaf) * `TestSupport` with common helper methods and `Option`s **Provided features:** @@ -15,7 +15,7 @@ This module is part of the [Apache Sling](https://sling.apache.org) project. ## Getting Started -Add required dependencies: +###1. Add required dependencies: <!-- Sling Testing PaxExam --> <dependency> @@ -29,7 +29,7 @@ Add required dependencies: <dependency> <groupId>org.apache.felix</groupId> <artifactId>org.apache.felix.framework</artifactId> - <version>5.6.6</version> + <version>5.6.10</version> <scope>test</scope> </dependency> @@ -70,7 +70,7 @@ Add required dependencies: <scope>test</scope> </dependency> -Configure the build artifact (*bundle*) to use in integration testing in `pom.xml`: +### 2. Configure the build artifact (*bundle*) to use in integration testing in `pom.xml`: <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -100,7 +100,7 @@ Add `depends-maven-plugin` when using `TestSupport#baseConfiguration()` or `Slin <plugin> <groupId>org.apache.servicemix.tooling</groupId> <artifactId>depends-maven-plugin</artifactId> - <version>1.3.1</version> + <version>1.4.0</version> <executions> <execution> <goals> @@ -110,13 +110,13 @@ Add `depends-maven-plugin` when using `TestSupport#baseConfiguration()` or `Slin </executions> </plugin> -Create a test class (extend `TestSupport` to use helper methods and `Option`s) and provide a *Configuration* (`Option[]`) for Pax Exam: +### 3. Create a test class (extend `TestSupport` to use helper methods and `Option`s) and provide a *Configuration* (`Option[]`) for Pax Exam: @Configuration public Option[] configuration() { return new Option[]{ baseConfiguration(), // from TestSupport - launchpad(), + quickstart(), // build artifact testBundle("bundle.filename"), // from TestSupport // testing @@ -124,22 +124,38 @@ Create a test class (extend `TestSupport` to use helper methods and `Option`s) a }; } - protected Option launchpad() { + protected Option quickstart() { final String workingDirectory = workingDirectory(); // from TestSupport final int httpPort = findFreePort(); // from TestSupport return composite( - slingLaunchpadOakTar(workingDirectory, httpPort), // from SlingOptions + slingQuickstartOakTar(workingDirectory, httpPort), // from SlingOptions slingExtensionModels(), // from SlingOptions (for illustration) slingScriptingThymeleaf() // from SlingOptions (for illustration) ); } -**Overriding (or adding) versions:** +The above configuration provides all bundles and OSGi configurations to run a Sling Quickstart setup with Extension Models and Scripting Thymeleaf. + +**NOTE:** When using `slingQuickstartOakTar()` or `slingQuickstartOakMongo()` without _working directory_, _HTTP port_ and _Mongo URI_ make sure to clean up file system and database after each test and do not run tests in parallel to prevent interferences between tests. + +## Overriding or adding versions + +To use different versions of bundles in tests than the ones in `SlingVersionResolver` create a custom `SlingVersionResolver` (extending `SlingVersionResolver`) and set it in `SlingOptions`: + + SlingOptions.versionResolver = new CustomSlingVersionResolver(); + +or simply (re)set versions in `SlingVersionResolver`: SlingOptions.versionResolver.setVersion(SLING_GROUP_ID, "org.apache.sling.jcr.oak.server", "1.1.0"); -using a version from project (`pom.xml`): +To use a version from project (`pom.xml`) use `setVersionFromProject(String, String)` with `groupId` and `artifactId`: SlingOptions.versionResolver.setVersionFromProject(SLING_GROUP_ID, "org.apache.sling.jcr.oak.server"); -**NOTE:** When using `slingLaunchpadOakTar()` or `slingLaunchpadOakMongo()` without _working directory_, _HTTP port_ and _Mongo URI_ make sure to clean up file system and database after each test and do not run tests in parallel to prevent interferences between tests. +## Logging + +See Pax Exam's [Logging Configuration](https://ops4j1.jira.com/wiki/spaces/PAXEXAM4/pages/54263891/Logging+Configuration) if logging needs to be tweaked. + +For [Logback](https://logback.qos.ch) use `SlingOptions#logback()` and add both `exam.properties` and `logback.xml` to `src/test/resources` as described in Pax Exam's [Logging Configuration](https://ops4j1.jira.com/wiki/spaces/PAXEXAM4/pages/54263891/Logging+Configuration). + + -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
