This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.crankstart.launcher-1.0.0 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-crankstart-launcher.git
commit 2976ec975df2fa82be835ea339114b2075fc19f3 Author: Bertrand Delacretaz <[email protected]> AuthorDate: Fri May 16 14:50:49 2014 +0000 Add extension command support, with test in SystemPropertyCommand and launcher-test.crank.txt git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/crankstart/launcher@1595220 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 12 +++++++++--- .../crankstart/launcher/CrankstartBootstrapTest.java | 15 +++++++++++++++ src/test/resources/launcher-test.crank.txt | 12 +++++++++++- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index e120a5b..c37eb97 100644 --- a/pom.xml +++ b/pom.xml @@ -93,14 +93,20 @@ </dependency> <dependency> <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.crankstart.api.fragment</artifactId> + <version>0.0.1-SNAPSHOT</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.crankstart.core</artifactId> <version>0.0.1-SNAPSHOT</version> <scope>provided</scope> </dependency> <dependency> - <groupId>org.apache.sling</groupId> - <artifactId>org.apache.sling.crankstart.test.services</artifactId> - <version>0.0.1-SNAPSHOT</version> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.crankstart.test.services</artifactId> + <version>0.0.1-SNAPSHOT</version> <scope>provided</scope> </dependency> <dependency> diff --git a/src/test/java/org/apache/sling/crankstart/launcher/CrankstartBootstrapTest.java b/src/test/java/org/apache/sling/crankstart/launcher/CrankstartBootstrapTest.java index ff12860..0de1a73 100644 --- a/src/test/java/org/apache/sling/crankstart/launcher/CrankstartBootstrapTest.java +++ b/src/test/java/org/apache/sling/crankstart/launcher/CrankstartBootstrapTest.java @@ -2,6 +2,7 @@ package org.apache.sling.crankstart.launcher; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.fail; import java.io.File; @@ -31,6 +32,7 @@ public class CrankstartBootstrapTest { private static Thread crankstartThread; private static String baseUrl = "http://localhost:" + port; public static final String TEST_RESOURCE = "/launcher-test.crank.txt"; + public static final String TEST_SYSTEM_PROPERTY = "the.test.system.property"; @Rule public final RetryRule retryRule = new RetryRule(); @@ -54,6 +56,11 @@ public class CrankstartBootstrapTest { } @BeforeClass + public static void testExtensionPropertyBeforeTests() { + assertNull(TEST_SYSTEM_PROPERTY + " should not be set before tests", System.getProperty(TEST_SYSTEM_PROPERTY)); + } + + @BeforeClass public static void setup() { final GetMethod get = new GetMethod(baseUrl); System.setProperty("http.port", String.valueOf(port)); @@ -74,6 +81,7 @@ public class CrankstartBootstrapTest { try { new CrankstartBootstrap(input).start(); } catch(Exception e) { + e.printStackTrace(); fail("CrankstartBootstrap exception:" + e); } finally { try { @@ -120,6 +128,13 @@ public class CrankstartBootstrapTest { } } + @Test + public void testExtensionCommand() { + // The SystemPropertyCommand, provided by our test-services bundle, should have + // processed the test.system.property instruction in our launcher file + assertEquals("was set by test-services bundle", System.getProperty(TEST_SYSTEM_PROPERTY)); + } + private static String getOsgiStoragePath() { final File tmpRoot = new File(System.getProperty("java.io.tmpdir")); final Random random = new Random(); diff --git a/src/test/resources/launcher-test.crank.txt b/src/test/resources/launcher-test.crank.txt index 8af6a32..a250a44 100644 --- a/src/test/resources/launcher-test.crank.txt +++ b/src/test/resources/launcher-test.crank.txt @@ -25,8 +25,15 @@ bundle mvn:org.apache.felix/org.apache.felix.scr/1.8.2 bundle mvn:org.apache.felix/org.apache.felix.metatype/1.0.10 bundle mvn:org.apache.sling/org.apache.sling.commons.osgi/2.2.1-SNAPSHOT bundle mvn:org.apache.sling/org.apache.sling.commons.log/2.1.2 -bundle mvn:org.apache.sling/org.apache.sling.crankstart.test.services/0.0.1-SNAPSHOT bundle mvn:org.apache.felix/org.apache.felix.configadmin/1.6.0 + +# The crankstart.api.fragment bundle makes the crankstart.api package available +# to bundles, required for bundles to provide crankstart extension commands like +# the test.system.property command below +bundle mvn:org.apache.sling/org.apache.sling.crankstart.api.fragment/0.0.1-SNAPSHOT +bundle mvn:org.apache.sling/org.apache.sling.crankstart.test.services/0.0.1-SNAPSHOT + +# Now start our bundles start.all.bundles # OSGi configs that activate our test servlets @@ -42,5 +49,8 @@ config.factory org.apache.sling.crankstart.testservices.ConfigFactoryServlet path=/bar/test message=Not used +# Test an extension command provided by our test-services bundle +test.system.property the.test.system.property was set by test-services bundle + # Informative log log felix http service should come up at http://localhost:${http.port} \ No newline at end of file -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
