jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1360972 - in /jackrabbit/oak/trunk/oak-jcr/src: main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java test/java/org/apache/jackrabbit/oak/jcr/CRUDTest.java
Date Thu, 12 Jul 2012 21:48:38 GMT
Author: jukka
Date: Thu Jul 12 21:48:38 2012
New Revision: 1360972

URL: http://svn.apache.org/viewvc?rev=1360972&view=rev
Log:
OAK-61: Implement JCR path handling

Fix the paths of properties of the root node.

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CRUDTest.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java?rev=1360972&r1=1360971&r2=1360972&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
Thu Jul 12 21:48:38 2012
@@ -68,7 +68,12 @@ public class PropertyDelegate extends It
 
     @Override
     public String getPath() throws InvalidItemStateException {
-        return getParent().getPath() + '/' + getName();
+        String path = getParent().getPath();
+        if (path.equals("/")) {
+            return path + getName();
+        } else {
+            return path + '/' + getName();
+        }
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CRUDTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CRUDTest.java?rev=1360972&r1=1360971&r2=1360972&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CRUDTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/CRUDTest.java
Thu Jul 12 21:48:38 2012
@@ -19,6 +19,7 @@ package org.apache.jackrabbit.oak.jcr;
 import org.junit.Test;
 
 import javax.jcr.Node;
+import javax.jcr.Property;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
@@ -64,4 +65,10 @@ public class CRUDTest extends AbstractRe
         root.setProperty("missing", (String) null);
     }
 
+    @Test
+    public void testRootPropertyPath() throws RepositoryException {
+        Property property =
+                getSession().getRootNode().getProperty("jcr:primaryType");
+        assertEquals("/jcr:primaryType", property.getPath());
+    }
 }



Mime
View raw message