SLING-3528 - add test-services to prepare for config command testing
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1591823 13f79535-47bb-0310-9956-ffa450edef68
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 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.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 @@
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 @@
@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 @@
@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 404 at " + get.getURI(), 404, get.getStatusCode());
+ 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 success " + get.getURI(), 200, get.getStatusCode());
}
private static String getOsgiStoragePath() {