SLING-1393 - adding davex module and test content loading support
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@923417 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index e2f9dfc..2617a62 100644
--- a/pom.xml
+++ b/pom.xml
@@ -442,6 +442,21 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>javax.jcr</groupId>
+ <artifactId>jcr</artifactId>
+ <version>2.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-jcr2dav</artifactId>
+ <version>2.0.0</version>
+ <scope>test</scope>
+ </dependency>
+
+
<!-- Dependencies for the Test Build and Run -->
<dependency>
<groupId>org.apache.sling</groupId>
diff --git a/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/DavExIntegrationTest.java b/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/DavExIntegrationTest.java
new file mode 100644
index 0000000..13c81e3
--- /dev/null
+++ b/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/DavExIntegrationTest.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.sling.launchpad.webapp.integrationtest;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jcr.Node;
+import javax.jcr.Repository;
+import javax.jcr.Session;
+
+import org.apache.jackrabbit.commons.JcrUtils;
+import org.apache.sling.commons.testing.integration.HttpTestBase;
+
+/**
+ * Test of Davex
+ */
+public class DavExIntegrationTest extends HttpTestBase {
+
+ private Repository repository;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ repository = JcrUtils.getRepository(HTTP_BASE_URL + "/server/");
+ }
+
+ public void testDescriptor() throws Exception {
+ assertEquals("2.0", repository.getDescriptor(Repository.SPEC_VERSION_DESC));
+ assertEquals("Jackrabbit", repository.getDescriptor(Repository.REP_NAME_DESC));
+ }
+
+ public void testReadNode() throws Exception {
+ final String path = "/DavExNodeTest_1_" + System.currentTimeMillis();
+ final String url = HTTP_BASE_URL + path;
+
+ // add some properties to the node
+ final Map<String, String> props = new HashMap<String, String>();
+ props.put("name1", "value1");
+ props.put("name2", "value2");
+
+ testClient.createNode(url, props);
+
+ Session session = repository.login("default");
+
+ Node node = session.getNode(path);
+
+ assertNotNull(node);
+ assertEquals("value1", node.getProperty("name1").getString());
+ assertEquals("value2", node.getProperty("name2").getString());
+
+ session.logout();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ repository = null;
+ }
+}