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:25:06 UTC

[sling-org-apache-sling-crankstart-launcher] 09/31: SLING-3528 - add test-services to prepare for config command testing

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 7f6e504dfb2785ec5effab6746371e43172e156e
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri May 2 08:13:56 2014 +0000

    SLING-3528 - add test-services to prepare for config command testing
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/crankstart/launcher@1591823 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  6 +++++
 .../launcher/CrankstartBootstrapTest.java          | 30 +++++++++++-----------
 2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/pom.xml b/pom.xml
index 555db0e..9e10b6b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -97,6 +97,12 @@
             <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>1.0.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
          <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
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 c559290..64c9205 100644
--- a/src/test/java/org/apache/sling/crankstart/launcher/CrankstartBootstrapTest.java
+++ b/src/test/java/org/apache/sling/crankstart/launcher/CrankstartBootstrapTest.java
@@ -6,8 +6,6 @@ import static org.junit.Assert.fail;
 import java.io.File;
 import java.io.IOException;
 import java.io.StringReader;
-import java.net.MalformedURLException;
-import java.net.URL;
 import java.util.Random;
 
 import org.apache.commons.httpclient.HttpClient;
@@ -16,6 +14,7 @@ import org.apache.sling.commons.testing.junit.Retry;
 import org.apache.sling.commons.testing.junit.RetryRule;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 
@@ -27,16 +26,8 @@ public class CrankstartBootstrapTest {
     private static final int port = Integer.valueOf(System.getProperty("test.http.port", "12345"));
     private static final HttpClient client = new HttpClient();
     private static Thread crankstartThread;
-    private static URL rootUrl = null;
+    private static String baseUrl = "http://localhost:" + port;
             
-    static {
-        try {
-            rootUrl = new URL("http://localhost:" + port + "/");
-        } catch(MalformedURLException mfe) {
-            fail(mfe.toString());
-        }
-    }
-    
     @Rule
     public final RetryRule retryRule = new RetryRule();
     
@@ -58,7 +49,7 @@ public class CrankstartBootstrapTest {
     
     @BeforeClass
     public static void setup() {
-        final GetMethod get = new GetMethod(rootUrl.toExternalForm());
+        final GetMethod get = new GetMethod(baseUrl);
         
         try {
             client.executeMethod(get);
@@ -87,10 +78,19 @@ public class CrankstartBootstrapTest {
     
     @Test
     @Retry(timeoutMsec=10000, intervalMsec=250)
-    public void testHttpResponse() throws Exception {
-        final GetMethod get = new GetMethod(rootUrl.toExternalForm());
+    public void testHttpRoot() throws Exception {
+        final GetMethod get = new GetMethod(baseUrl);
+        client.executeMethod(get);
+        assertEquals("Expecting page not found at " + get.getURI(), 404, get.getStatusCode());
+    }
+    
+    @Test
+    @Retry(timeoutMsec=10000, intervalMsec=250)
+    @Ignore("TODO: activate once config command is ready")
+    public void testSingleConfigServlet() throws Exception {
+        final GetMethod get = new GetMethod(baseUrl + "/single");
         client.executeMethod(get);
-        assertEquals("Expecting 404 at " + get.getURI(), 404, get.getStatusCode());
+        assertEquals("Expecting success " + get.getURI(), 200, get.getStatusCode());
     }
     
     private static String getOsgiStoragePath() {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.