jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1157028 - in /jackrabbit/sandbox/spi2microkernel/src: main/java/org/apache/jackrabbit/spi2microkernel/ main/java/org/apache/jackrabbit/spi2microkernel/util/ test/java/org/apache/jackrabbit/spi2microkernel/
Date Fri, 12 Aug 2011 10:00:26 GMT
Author: mduerig
Date: Fri Aug 12 10:00:25 2011
New Revision: 1157028

URL: http://svn.apache.org/viewvc?rev=1157028&view=rev
Log:
spi2microkernel (WIP)
- resolve id based nodeIds

Modified:
    jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
    jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Paths.java
    jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java

Modified: jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java?rev=1157028&r1=1157027&r2=1157028&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
Fri Aug 12 10:00:25 2011
@@ -456,7 +456,7 @@ public class RepositoryServiceImpl exten
     private static Path getPath(NodeId nodeId) throws ItemNotFoundException {
         Path path = nodeId.getPath();
         if (path == null) {
-            throw new ItemNotFoundException(nodeId.toString()); // fixme: correctly resolve
node based ids
+            path = Paths.parseQPath(nodeId.getUniqueID());
         }
         
         return path;

Modified: jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Paths.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Paths.java?rev=1157028&r1=1157027&r2=1157028&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Paths.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Paths.java
Fri Aug 12 10:00:25 2011
@@ -35,6 +35,10 @@ import java.util.concurrent.ConcurrentMa
 
 import static org.apache.jackrabbit.spi.Name.NS_DEFAULT_URI;
 
+/**
+ * Methods for converting between the individual path representations (JCR, Microkernel,
SPI).
+ * Its always good to have at least 3 representations of the same thing... :(
+ */
 public final class Paths {
     private static final NameFactory NAME_FACTORY = NameFactoryImpl.getInstance();
     private static final PathFactory PATH_FACTORY = PathFactoryImpl.getInstance();
@@ -77,6 +81,10 @@ public final class Paths {
         return PATH_FACTORY.create(elements.toArray(new Element[elements.size()]));
     }
 
+    public static Path parseQPath(String qPath) {
+        return PATH_FACTORY.create(qPath);
+    }
+
     public static String nameToString(Name name) {
         String nameSpaceURI = name.getNamespaceURI();
         return '{' + escapeNameSpaceURI(nameSpaceURI) + '}' + name.getLocalName();
@@ -98,6 +106,7 @@ public final class Paths {
             : wspPath + translateQPath(absPath);
     }
 
+    // fixme don't static here!
     public static void addKnownNamespace(String prefix, String uri) {
         KNOWN_NAME_SPACES.putIfAbsent(prefix, uri);
         KNOWN_PREFIXES.putIfAbsent(uri, prefix);

Modified: jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java?rev=1157028&r1=1157027&r2=1157028&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
Fri Aug 12 10:00:25 2011
@@ -930,6 +930,31 @@ public class RepositoryTest {
     }
 
     @Test
+    public void removeReferenceableNode() throws RepositoryException {
+        Node parentNode = getNode(testPath);
+        Node ref = parentNode.addNode("ref");
+        ref.addMixin("mix:referenceable");
+        parentNode.getSession().save();
+
+        Session session2 = getRepository().login();
+        try {
+            session2.getNode(testPath + "/ref").remove();
+            session2.save();
+        }
+        finally {
+            session2.logout();
+        }
+
+        Session session3 = getRepository().login();
+        try {
+            assertFalse(session3.nodeExists(testPath + "/ref"));
+        }
+        finally {
+            session3.logout();
+        }
+    }
+
+    @Test
     public void setPrimaryType() throws RepositoryException {
         Node testNode = getNode(testPath);
         assertEquals("nt:unstructured", testNode.getPrimaryNodeType().getName());



Mime
View raw message