You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2013/10/28 14:11:26 UTC
svn commit: r1536348 -
/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/DavExIntegrationTest.java
Author: bdelacretaz
Date: Mon Oct 28 13:11:26 2013
New Revision: 1536348
URL: http://svn.apache.org/r1536348
Log:
SLING-3210 - verify anonymous HTTP access to the davex servlet separately
Modified:
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/DavExIntegrationTest.java
Modified: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/DavExIntegrationTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/DavExIntegrationTest.java?rev=1536348&r1=1536347&r2=1536348&view=diff
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/DavExIntegrationTest.java (original)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/DavExIntegrationTest.java Mon Oct 28 13:11:26 2013
@@ -16,15 +16,19 @@
*/
package org.apache.sling.launchpad.webapp.integrationtest;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.jcr.Credentials;
+import javax.jcr.GuestCredentials;
import javax.jcr.Node;
import javax.jcr.Repository;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.jackrabbit.commons.JcrUtils;
import org.apache.sling.commons.testing.integration.HttpTestBase;
@@ -34,12 +38,13 @@ import org.apache.sling.commons.testing.
public class DavExIntegrationTest extends HttpTestBase {
private Repository repository;
+ public static final String DAVEX_SERVER_URL = HTTP_BASE_URL + "/server/";
@Override
protected void setUp() throws Exception {
super.setUp();
configureServerBeforeTest();
- repository = JcrUtils.getRepository(HTTP_BASE_URL + "/server/");
+ repository = JcrUtils.getRepository(DAVEX_SERVER_URL);
}
protected void configureServerBeforeTest() throws Exception {
@@ -50,6 +55,9 @@ public class DavExIntegrationTest extend
assertTrue(repository.getDescriptor(Repository.REP_NAME_DESC).contains("Jackrabbit"));
}
+ /** Create a node via Sling's http interface and verify that admin can
+ * read it via davex remote access.
+ */
public void testReadNode() throws Exception {
final String path = "/DavExNodeTest_1_" + System.currentTimeMillis();
final String url = HTTP_BASE_URL + path;
@@ -61,6 +69,8 @@ public class DavExIntegrationTest extend
testClient.createNode(url, props);
+ // Oak does not support login without credentials, so to
+ // verify that davex access works we do need valid repository credentials.
final Credentials creds = new SimpleCredentials("admin", "admin".toCharArray());
Session session = repository.login(creds);
@@ -74,6 +84,14 @@ public class DavExIntegrationTest extend
}
}
+ /** Verify that we can access the davex servlet without credentials (SLING-2274) */
+ public void testDavexServletAccess() throws IOException {
+ final HttpClient noCredentialsClient = new HttpClient();
+ final GetMethod get = new GetMethod(DAVEX_SERVER_URL);
+ final int status = noCredentialsClient.executeMethod(get);
+ assertEquals("With no HTTP credentials, expecting 200 status at " + DAVEX_SERVER_URL, 200, status);
+ }
+
@Override
protected void tearDown() throws Exception {
repository = null;