jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r935899 - in /jackrabbit/trunk/jackrabbit-jcr-server: ./ src/main/java/org/apache/jackrabbit/webdav/simple/ src/test/java/org/apache/jackrabbit/webdav/simple/ src/test/resources/
Date Tue, 20 Apr 2010 13:06:06 GMT
Author: jukka
Date: Tue Apr 20 13:06:05 2010
New Revision: 935899

URL: http://svn.apache.org/viewvc?rev=935899&view=rev
Log:
JCR-2614: Include the WebDAV litmus tests in the Jackrabbit integration tests

Add a simple LitmusTest class that runs part of the litmus test suite when started in the
integrationTesting profile (and litmus is available on PATH or specified via -Dlitmus=/path/to/litmus)

Added:
    jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/LitmusTest.java
  (with props)
    jackrabbit/trunk/jackrabbit-jcr-server/src/test/resources/config.xml   (with props)
Modified:
    jackrabbit/trunk/jackrabbit-jcr-server/pom.xml
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/SimpleWebdavServlet.java
    jackrabbit/trunk/jackrabbit-jcr-server/src/test/resources/logback-test.xml

Modified: jackrabbit/trunk/jackrabbit-jcr-server/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/pom.xml?rev=935899&r1=935898&r2=935899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/pom.xml Tue Apr 20 13:06:05 2010
@@ -48,6 +48,46 @@
     </plugins>
   </build>
 
+  <profiles>
+    <profile>
+      <id>integrationTesting</id>
+      <properties>
+        <litmus>litmus</litmus>
+      </properties>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <systemProperties>
+                <property>
+                  <name>jackrabbit.test.integration</name>
+                  <value>true</value>
+                </property>
+                <property>
+                  <name>litmus</name>
+                  <value>${litmus}</value>
+                </property>
+                <property>
+                  <name>derby.system.durability</name>
+                  <value>test</value>
+                </property>
+                <property>
+                  <name>derby.storage.fileSyncTransactionLog</name>
+                  <value>true</value>
+                </property>
+                <property>
+                  <name>derby.stream.error.file</name>
+                  <value>target/derby.log</value>
+                </property>
+              </systemProperties>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
   <dependencies>
     <dependency>
       <groupId>javax.jcr</groupId>
@@ -86,6 +126,17 @@
       <scope>test</scope>
     </dependency>
     <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-core</artifactId>
+      <version>2.2-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.mortbay.jetty</groupId>
+      <artifactId>jetty</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-classic</artifactId>
       <scope>test</scope>

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/SimpleWebdavServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/SimpleWebdavServlet.java?rev=935899&r1=935898&r2=935899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/SimpleWebdavServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/SimpleWebdavServlet.java
Tue Apr 20 13:06:05 2010
@@ -174,7 +174,7 @@ public abstract class SimpleWebdavServle
             try {
                 config.parse(getServletContext().getResource(configParam));
             } catch (MalformedURLException e) {
-                log.debug("Unable to build resource filter provider.");
+                log.debug("Unable to build resource filter provider", e);
             }
         }
     }

Added: jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/LitmusTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/LitmusTest.java?rev=935899&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/LitmusTest.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/LitmusTest.java
Tue Apr 20 13:06:05 2010
@@ -0,0 +1,116 @@
+/*
+ * 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.jackrabbit.webdav.simple;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+
+import javax.jcr.Repository;
+import javax.jcr.Session;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.jackrabbit.commons.JcrUtils;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.bio.SocketConnector;
+import org.mortbay.jetty.servlet.Context;
+import org.mortbay.jetty.servlet.ServletHolder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LitmusTest extends TestCase {
+
+    /**
+     * Logger instance.
+     */
+    private static final Logger log = LoggerFactory.getLogger(LitmusTest.class);
+
+    public void testLitmus() throws Exception {
+        File dir = new File("target", "litmus");
+        String litmus = System.getProperty("litmus", "litmus");
+
+        if (Boolean.getBoolean("jackrabbit.test.integration")
+                && litmusIsAvailable(litmus)) {
+            final Repository repository = JcrUtils.getRepository(
+                    "jcr-jackrabbit://" + dir.getCanonicalPath());
+            Session session = repository.login(); // for the TransientRepository
+            try {
+                SocketConnector connector = new SocketConnector();
+                connector.setHost("localhost");
+                connector.setPort(0);
+
+                Server server = new Server();
+                server.addConnector(connector);
+
+                ServletHolder holder = new ServletHolder(
+                        new SimpleWebdavServlet() {
+                            @Override
+                            public Repository getRepository() {
+                                return repository;
+                            }
+                        });
+                holder.setInitParameter("resource-config", "/config.xml");
+
+                Context context = new Context(server, "/");
+                context.setResourceBase("src/test/resources");
+                context.addServlet(holder, "/*");
+                server.addHandler(context);
+
+                server.start();
+                try {
+                    int port = connector.getLocalPort();
+                    String url = "http://localhost:" + port + "/default";
+
+                    ProcessBuilder builder =
+                        new ProcessBuilder(litmus, url, "admin", "admin");
+                    builder.environment().put(
+                            "TESTS", "basic props http"); // copymove locks
+                    builder.directory(dir);
+                    builder.redirectErrorStream();
+
+                    Process process = builder.start();
+                    IOUtils.copy(process.getInputStream(), System.out);
+                    assertEquals(0, process.waitFor());
+                } finally {
+                    server.stop();
+                }
+            } finally {
+                session.logout();
+            }
+        }
+    }
+
+    private boolean litmusIsAvailable(String litmus) {
+        try {
+            ProcessBuilder builder = new ProcessBuilder(litmus, "--version");
+            builder.redirectErrorStream();
+            Process process = builder.start();
+
+            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+            IOUtils.copy(process.getInputStream(), buffer);
+            int rv = process.waitFor();
+            log.info("litmus version: {}", buffer.toString("US-ASCII").trim());
+
+            return rv == 0;
+        } catch (Exception e) {
+            log.warn("litmus is not available: " + litmus, e);
+            return false;
+        }
+    }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/LitmusTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-jcr-server/src/test/resources/config.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/test/resources/config.xml?rev=935899&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/test/resources/config.xml (added)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/test/resources/config.xml Tue Apr 20 13:06:05
2010
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   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.
+  -->
+<!--
+<!DOCTYPE config [
+        <!ELEMENT config (iomanager , propertymanager, (collection | noncollection)? ,
filter?, mimetypeproperties?) >
+
+        <!ELEMENT iomanager (class, iohandler*) >
+        <!ELEMENT iohandler (class) >
+
+        <!ELEMENT propertymanager (class, propertyhandler*) >
+        <!ELEMENT propertyhandler (class) >
+
+        <!ELEMENT collection (nodetypes) >
+        <!ELEMENT noncollection (nodetypes) >
+
+        <!ELEMENT filter (class, namespaces?, nodetypes?) >
+
+        <!ELEMENT class >
+        <!ATTLIST class
+            name  CDATA #REQUIRED
+        >
+        <!ELEMENT namespaces (prefix | uri)* >
+        <!ELEMENT prefix (CDATA) >
+        <!ELEMENT uri (CDATA) >
+
+        <!ELEMENT nodetypes (nodetype)* >
+        <!ELEMENT nodetype (CDATA) >
+
+        <!ELEMENT mimetypeproperties (mimemapping*, defaultmimetype) >
+
+        <!ELEMENT mimemapping >
+        <!ATTLIST mimemapping
+            extension  CDATA #REQUIRED
+            mimetype  CDATA #REQUIRED
+        >
+
+        <!ELEMENT defaultmimetype (CDATA) >
+]>
+-->
+
+<config>
+    <!--
+     Defines the IOManager implementation that is responsible for passing
+     import/export request to the individual IO-handlers.
+    -->
+    <iomanager>
+        <!-- class element defines the manager to be used. The specified class
+             must implement the IOManager interface.
+             Note, that the handlers are being added and called in the order
+             they appear in the configuration.
+        -->
+        <class name="org.apache.jackrabbit.server.io.IOManagerImpl" />
+        <iohandler>
+            <class name="org.apache.jackrabbit.server.io.VersionHandler" />
+        </iohandler>
+        <iohandler>
+            <class name="org.apache.jackrabbit.server.io.VersionHistoryHandler" />
+        </iohandler>
+        <iohandler>
+            <class name="org.apache.jackrabbit.server.io.ZipHandler" />
+        </iohandler>
+        <iohandler>
+            <class name="org.apache.jackrabbit.server.io.XmlHandler" />
+        </iohandler>
+        <iohandler>
+            <class name="org.apache.jackrabbit.server.io.DirListingExportHandler" />
+        </iohandler>
+        <iohandler>
+            <class name="org.apache.jackrabbit.server.io.DefaultHandler" />
+        </iohandler>
+    </iomanager>
+    <!--
+     Example config for iomanager that populates its list of handlers with
+     default values. Therefore the 'iohandler' elements are omited.
+    -->
+    <!--
+    <iomanager>
+        <class name="org.apache.jackrabbit.server.io.DefaultIOManager" />
+    </iomanager>
+    -->
+    <!--
+     Defines the PropertyManager implementation that is responsible for export
+     and import of resource properties.
+    -->
+    <propertymanager>
+        <!-- class element defines the manager to be used. The specified class
+             must implement the PropertyManager interface.
+             Note, that the handlers are being added and called in the order
+             they appear in the configuration.
+        -->
+        <class name="org.apache.jackrabbit.server.io.PropertyManagerImpl" />
+        <propertyhandler>
+            <class name="org.apache.jackrabbit.server.io.VersionHandler" />
+        </propertyhandler>
+        <propertyhandler>
+            <class name="org.apache.jackrabbit.server.io.VersionHistoryHandler" />
+        </propertyhandler>
+        <propertyhandler>
+            <class name="org.apache.jackrabbit.server.io.ZipHandler" />
+        </propertyhandler>
+        <propertyhandler>
+            <class name="org.apache.jackrabbit.server.io.XmlHandler" />
+        </propertyhandler>
+        <propertyhandler>
+            <class name="org.apache.jackrabbit.server.io.DefaultHandler" />
+        </propertyhandler>
+    </propertymanager>
+    <!--
+     Define nodetypes, that should never by displayed as 'collection'
+    -->
+    <noncollection>
+        <nodetypes>
+            <nodetype>nt:file</nodetype>
+            <nodetype>nt:resource</nodetype>
+        </nodetypes>
+    </noncollection>
+    <!--
+     Example: Defines nodetypes, that should always be displayed as 'collection'.
+    -->
+    <!--
+    <collection>
+        <nodetypes>
+            <nodetype>nt:folder</nodetype>
+            <nodetype>rep:root</nodetype>
+        </nodetypes>
+    </collection>
+    -->
+    <!--
+     Filter that allows to prevent certain items from being displayed.
+     Please note, that this has an effect on PROPFIND calls only and does not
+     provide limited access to those items matching any of the filters.
+
+     However specifying a filter may cause problems with PUT or MKCOL if the
+     resource to be created is being filtered out, thus resulting in inconsistent
+     responses (e.g. PUT followed by PROPFIND on parent).
+     -->
+    <filter>
+        <!-- class element defines the resource filter to be used. The specified class
+             must implement the ItemFilter interface -->
+        <class name="org.apache.jackrabbit.webdav.simple.DefaultItemFilter" />
+        <!--
+         Nodetype names to be used to filter child nodes.
+         A child node can be filtered if the declaring nodetype of its definition
+         is one of the nodetype names specified in the nodetypes Element.
+         E.g. defining 'rep:root' as filtered nodetype whould result in jcr:system
+         being hidden but no other child node of the root node, since those
+         are defined by the nodetype nt:unstructered.
+        -->
+        <!--
+        <nodetypes>
+            <nodetype>rep:root</nodetype>
+        </nodetypes>
+        -->
+        <!--
+         Namespace prefixes or uris. Items having a name that matches any of the
+         entries will be filtered.
+        -->
+        <namespaces>
+            <prefix>rep</prefix>
+            <prefix>jcr</prefix>
+            <!--
+            <uri>internal</uri>
+            <uri>http://www.jcp.org/jcr/1.0</uri>
+            -->
+        </namespaces>
+    </filter>
+    
+    <!--
+     Optional 'mimetypeproperties' element.
+     It defines additional or replaces existing mappings for the MimeResolver
+     instance created by the ResourceConfig.
+     The default mappings are defined in org.apache.jackrabbit.server.io.mimetypes.properties.
+     If the default mime type defined by MimeResolver is 'application/octet-stream'.
+    -->
+    <!--
+    <mimetypeproperties>
+        <mimemapping extension="rtf" mimetype="application/rtf" />
+        <mimemapping extension="ott" mimetype="application/vnd.oasis.opendocument.text-template"
/>
+        <defaultmimetype>text/html</defaultmimetype>
+    </mimetypeproperties>
+    -->
+</config>
+

Propchange: jackrabbit/trunk/jackrabbit-jcr-server/src/test/resources/config.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/test/resources/logback-test.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/test/resources/logback-test.xml?rev=935899&r1=935898&r2=935899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/test/resources/logback-test.xml (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/test/resources/logback-test.xml Tue Apr 20
13:06:05 2010
@@ -24,7 +24,7 @@
     </encoder>
   </appender>
 
-  <root level="INFO">
+  <root level="DEBUG">
     <appender-ref ref="file"/>
   </root>
 



Mime
View raw message