This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-paxexam-util.git
commit 6b322032e85e80309b2d7cbea9350dd388bc0862 Author: Bertrand Delacretaz <[email protected]> AuthorDate: Fri Jan 24 11:10:39 2014 +0000 SLING-2788 - explain this better git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1560942 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 5 +++++ .../org/apache/sling/paxexam/util/SlingRepositoryTest.java | 14 ++++++++------ .../java/org/apache/sling/paxexam/util/SlingSetupTest.java | 5 ++++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index a69e323..4f694fe 100644 --- a/pom.xml +++ b/pom.xml @@ -27,6 +27,11 @@ <packaging>jar</packaging> <name>Apache Sling Pax Exam Utilities</name> + + <description> + Utilities that make it easier to test Sling code with Pax Exam. + See this module's tests for usage examples. + </description> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> diff --git a/src/test/java/org/apache/sling/paxexam/util/SlingRepositoryTest.java b/src/test/java/org/apache/sling/paxexam/util/SlingRepositoryTest.java index b436511..18bbd3e 100644 --- a/src/test/java/org/apache/sling/paxexam/util/SlingRepositoryTest.java +++ b/src/test/java/org/apache/sling/paxexam/util/SlingRepositoryTest.java @@ -34,11 +34,10 @@ import org.ops4j.pax.exam.spi.reactors.PerClass; /** Verify that our tests have access to a functional Sling instance, * and demonstrate how a simple test is setup. * - * To create a test like this that runs against a full Sling launchpad - * instance, one only needs the pax exam setup in the pom and a test - * like this one that runs with @RunWith PaxExam, that provides a - * Configuration method and can access services or the BundleContext - * using @Inject. + * Note how little boilerplate this example test has. You basically just + * define which version of the Sling launchpad bundle list you want to use, + * and you can then @Inject any OSGi services to be tested, along with the + * BundleContext. */ @RunWith(PaxExam.class) @ExamReactorStrategy(PerClass.class) @@ -46,9 +45,12 @@ public class SlingRepositoryTest { @Inject private SlingRepository repository; + /** Use a released launchpad for this example */ + public static final String SLING_LAUNCHPAD_VERSION = "6"; + @org.ops4j.pax.exam.Configuration public Option[] config() { - return SlingPaxOptions.defaultLaunchpadOptions("6").getOptions(); + return SlingPaxOptions.defaultLaunchpadOptions(SLING_LAUNCHPAD_VERSION).getOptions(); } @Test diff --git a/src/test/java/org/apache/sling/paxexam/util/SlingSetupTest.java b/src/test/java/org/apache/sling/paxexam/util/SlingSetupTest.java index f11cd16..0738efd 100644 --- a/src/test/java/org/apache/sling/paxexam/util/SlingSetupTest.java +++ b/src/test/java/org/apache/sling/paxexam/util/SlingSetupTest.java @@ -40,12 +40,15 @@ import org.osgi.framework.ServiceReference; @ExamReactorStrategy(PerClass.class) public class SlingSetupTest { + /** Use a released launchpad for this example */ + public static final String SLING_LAUNCHPAD_VERSION = "6"; + @Inject private BundleContext bundleContext; @org.ops4j.pax.exam.Configuration public Option[] config() { - return SlingPaxOptions.defaultLaunchpadOptions("6").getOptions(); + return SlingPaxOptions.defaultLaunchpadOptions(SLING_LAUNCHPAD_VERSION).getOptions(); } private void assertBundleActive(String symbolicName) { -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
