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:56:38 UTC
[sling-org-apache-sling-paxexam-util] 11/15: SLING-2788 - explain
this better
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.paxexam.util-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-paxexam-util.git
commit 038bd429236d7266eaf2b7e8395277b2bc9e61f1
Author: Bertrand Delacretaz <bd...@apache.org>
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/testing/sling-pax-util@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
"commits@sling.apache.org" <co...@sling.apache.org>.