incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1137918 - in /sling/trunk/testing: junit/remote/src/main/java/org/apache/sling/junit/remote/httpclient/ junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/ tools/src/main/java/org/apache/sling/testing/tools/http/ tools/src/ma...
Date Tue, 21 Jun 2011 09:29:24 GMT
Author: bdelacretaz
Date: Tue Jun 21 09:29:23 2011
New Revision: 1137918

URL: http://svn.apache.org/viewvc?rev=1137918&view=rev
Log:
SLING-2091 - add missing credentials to testing tools in several places. Patch contributed
by Mark Adamcin, thanks!

Modified:
    sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/httpclient/RemoteTestHttpClient.java
    sling/trunk/testing/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/HttpRequest.java
    sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/http/RetryingContentChecker.java
    sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/sling/SlingClient.java

Modified: sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/httpclient/RemoteTestHttpClient.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/httpclient/RemoteTestHttpClient.java?rev=1137918&r1=1137917&r2=1137918&view=diff
==============================================================================
--- sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/httpclient/RemoteTestHttpClient.java
(original)
+++ sling/trunk/testing/junit/remote/src/main/java/org/apache/sling/junit/remote/httpclient/RemoteTestHttpClient.java
Tue Jun 21 09:29:23 2011
@@ -25,6 +25,7 @@ import org.apache.sling.testing.tools.ht
 import org.apache.sling.testing.tools.http.RequestBuilder;
 import org.apache.sling.testing.tools.http.RequestCustomizer;
 import org.apache.sling.testing.tools.http.RequestExecutor;
+import org.apache.sling.testing.tools.sling.SlingTestBase;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -90,6 +91,7 @@ public class RemoteTestHttpClient {
                 subpath, junitServletUrl);
         final Request r = builder
         .buildPostRequest(subpath.toString())
+        .withCredentials(SlingTestBase.ADMIN, SlingTestBase.ADMIN)
         .withCustomizer(requestCustomizer);
         executor.execute(r).assertStatus(200);
 

Modified: sling/trunk/testing/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/HttpRequest.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/HttpRequest.java?rev=1137918&r1=1137917&r2=1137918&view=diff
==============================================================================
--- sling/trunk/testing/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/HttpRequest.java
(original)
+++ sling/trunk/testing/junit/scriptable/src/main/java/org/apache/sling/junit/scriptable/HttpRequest.java
Tue Jun 21 09:29:23 2011
@@ -37,10 +37,12 @@ public class HttpRequest implements Http
     public static final String FAKE_URL_BASE = "http://example.com";
     private final String path;
     private final Map<String, Object> attributes;
+    private final Map<String, String> parameters;
     
     HttpRequest(String path) {
         this.path = path;
         attributes = new HashMap<String, Object>();
+        parameters = new HashMap<String, String>();
     }
     
     public String getAuthType() {
@@ -192,7 +194,7 @@ public class HttpRequest implements Http
     }
 
     public Map<?,?> getParameterMap() {
-        return null;
+        return parameters;
     }
 
     public Enumeration<?> getParameterNames() {

Modified: sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/http/RetryingContentChecker.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/http/RetryingContentChecker.java?rev=1137918&r1=1137917&r2=1137918&view=diff
==============================================================================
--- sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/http/RetryingContentChecker.java
(original)
+++ sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/http/RetryingContentChecker.java
Tue Jun 21 09:29:23 2011
@@ -17,6 +17,7 @@
 package org.apache.sling.testing.tools.http;
 
 import org.apache.sling.testing.tools.retry.RetryLoop;
+import org.apache.sling.testing.tools.sling.SlingTestBase;
 
 /** Retry a GET on an URL until it returns 200 or 
  *  until this times out.
@@ -38,7 +39,9 @@ public class RetryingContentChecker {
             }
 
             public boolean isTrue() throws Exception {
-                executor.execute(builder.buildGetRequest(path)).assertStatus(expectedStatus);
+                executor.execute(builder.buildGetRequest(path)
+                        .withCredentials(SlingTestBase.ADMIN, SlingTestBase.ADMIN))
+                    .assertStatus(expectedStatus);
                 return assertMore(executor);
             }
                 

Modified: sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/sling/SlingClient.java
URL: http://svn.apache.org/viewvc/sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/sling/SlingClient.java?rev=1137918&r1=1137917&r2=1137918&view=diff
==============================================================================
--- sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/sling/SlingClient.java
(original)
+++ sling/trunk/testing/tools/src/main/java/org/apache/sling/testing/tools/sling/SlingClient.java
Tue Jun 21 09:29:23 2011
@@ -203,7 +203,8 @@ public class SlingClient {
     }
     
     public boolean exists(String path) throws IOException {
-        final int status = executor.execute(builder.buildGetRequest(path + ".json"))
+        final int status = executor.execute(builder.buildGetRequest(path + ".json")
+                .withCredentials(username, password))
         .getResponse().getStatusLine().getStatusCode();
         return status == 200;
     }



Mime
View raw message