incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1387625 - /sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java
Date Wed, 19 Sep 2012 14:54:39 GMT
Author: cziegeler
Date: Wed Sep 19 14:54:38 2012
New Revision: 1387625

URL: http://svn.apache.org/viewvc?rev=1387625&view=rev
Log:
SLING-2602 : Simplify usage of system properties for integration tests

Modified:
    sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java

Modified: sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java?rev=1387625&r1=1387624&r2=1387625&view=diff
==============================================================================
--- sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java
(original)
+++ sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java
Wed Sep 19 14:54:38 2012
@@ -49,9 +49,10 @@ public class HttpTestBase extends TestCa
     /** If this system property is set, the startup check is skipped. */
     public static final String PROPERTY_SKIP_STARTUP_CHECK = "launchpad.skip.startupcheck";
 
-    public static final String HTTP_BASE_URL = removeEndingSlash(System.getProperty("launchpad.http.server.url",
"http://localhost:8888"));
-    public static final String WEBDAV_BASE_URL = removeEndingSlash(System.getProperty("launchpad.webdav.server.url",
"http://localhost:8888"));
-    public static final String SERVLET_CONTEXT = removeEndingSlash(System.getProperty("launchpad.servlet.context",
""));
+    public static final String HTTP_URL = removeEndingSlash(System.getProperty("launchpad.http.server.url",
"http://localhost:8888"));
+    public static final String HTTP_BASE_URL = removePath(HTTP_URL);
+    public static final String WEBDAV_BASE_URL = removeEndingSlash(System.getProperty("launchpad.webdav.server.url",
HTTP_BASE_URL));
+    public static final String SERVLET_CONTEXT = removeEndingSlash(System.getProperty("launchpad.servlet.context",
getPath(HTTP_URL)));
 
     /** base path for test files */
     public static final String TEST_PATH = "/launchpad-integration-tests";
@@ -121,6 +122,24 @@ public class HttpTestBase extends TestCa
         return str;
     }
 
+    private static String removePath(String str) {
+        final int pos = str.indexOf(":/");
+        final int slashPos = str.indexOf('/', pos+3);
+        if ( slashPos != -1 ) {
+            return str.substring(0, slashPos);
+        }
+        return str;
+    }
+
+    private static String getPath(String str) {
+        final int pos = str.indexOf(":/");
+        final int slashPos = str.indexOf('/', pos+3);
+        if ( slashPos != -1 ) {
+            return str.substring(slashPos);
+        }
+        return "";
+    }
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();



Mime
View raw message