You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ju...@apache.org on 2012/03/20 20:13:34 UTC
svn commit: r1303103 -
/sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java
Author: justin
Date: Tue Mar 20 19:13:33 2012
New Revision: 1303103
URL: http://svn.apache.org/viewvc?rev=1303103&view=rev
Log:
SLING-2358 - adding getDefaultCredentials() method in HttpTestBase to allow HTTP tests to specify alternate credentials
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=1303103&r1=1303102&r2=1303103&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 Tue Mar 20 19:13:33 2012
@@ -136,7 +136,7 @@ public class HttpTestBase extends TestCa
// setup HTTP client, with authentication (using default Jackrabbit credentials)
httpClient = new HttpClient();
httpClient.getParams().setAuthenticationPreemptive(true);
- Credentials defaultcreds = new UsernamePasswordCredentials("admin", "admin");
+ Credentials defaultcreds = getDefaultCredentials();
httpClient.getState().setCredentials(new AuthScope(url.getHost(), url.getPort(), AuthScope.ANY_REALM), defaultcreds);
testClient = new SlingIntegrationTestClient(httpClient);
@@ -144,6 +144,13 @@ public class HttpTestBase extends TestCa
waitForSlingStartup();
}
+ /**
+ * Generate default credentials used for HTTP requests.
+ */
+ protected Credentials getDefaultCredentials() {
+ return new UsernamePasswordCredentials("admin", "admin");
+ }
+
@Override
protected void tearDown() throws Exception {
MDC.remove("testcase");