You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2008/07/18 15:00:11 UTC

svn commit: r677895 - in /jackrabbit/trunk/jackrabbit-jcr-server/src: main/java/org/apache/jackrabbit/webdav/simple/ test/java/org/apache/jackrabbit/webdav/simple/

Author: angela
Date: Fri Jul 18 06:00:10 2008
New Revision: 677895

URL: http://svn.apache.org/viewvc?rev=677895&view=rev
Log:
JCR-1679: dir with same name as repository has incorrect behavior

Added:
    jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/
    jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplExTest.java   (with props)
Modified:
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplEx.java

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplEx.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplEx.java?rev=677895&r1=677894&r2=677895&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplEx.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplEx.java Fri Jul 18 06:00:10 2008
@@ -62,7 +62,7 @@
         if (repositoryPath == null) {
             throw new IllegalArgumentException("Cannot build resource path from 'null' repository path");
         }
-        return (startsWithWorkspace(repositoryPath, wspPath)) ? repositoryPath : wspPath + repositoryPath;
+        return wspPath + repositoryPath;
     }
 
     private boolean startsWithWorkspace(String repositoryPath, String wspPath) {

Added: jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplExTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplExTest.java?rev=677895&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplExTest.java (added)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplExTest.java Fri Jul 18 06:00:10 2008
@@ -0,0 +1,52 @@
+/*
+ * 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 junit.framework.TestCase;
+import org.apache.jackrabbit.webdav.DavLocatorFactory;
+import org.apache.jackrabbit.webdav.DavResourceLocator;
+
+/** <code>LocatorFactoryImplExTest</code>... */
+public class LocatorFactoryImplExTest extends TestCase {
+
+    private DavLocatorFactory factory;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        // for simplicity (not yet used) ignore the path prefix.
+        factory = new LocatorFactoryImplEx(null);
+    }
+
+    /**
+     * Test for issue https://issues.apache.org/jira/browse/JCR-1679: An top
+     * level resource (node directly below the root) whose name equals the
+     * workspace name results in wrong collection behaviour (garbeled locator
+     * of child resources).
+     */
+    public void testCollectionNameEqualsWorkspaceName() {
+        String prefix = "http://localhost:8080/jackrabbit/repository";
+        String workspacePath = "/default";
+        String nodePath = "/default/another";
+
+        DavResourceLocator locator = factory.createResourceLocator(prefix, workspacePath, nodePath, false);
+        assertTrue(locator.getHref(true).indexOf("/default/default") > 0);
+
+        DavResourceLocator locator2 = factory.createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(), locator.getResourcePath());
+        assertEquals(locator, locator2);
+        assertEquals(nodePath, locator2.getRepositoryPath());
+    }
+}
\ No newline at end of file

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

Propchange: jackrabbit/trunk/jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/simple/LocatorFactoryImplExTest.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url