Modified: 
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCache.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCache.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCache.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/secondary/SecondaryStoreCache.java
 Wed Apr 10 11:13:19 2019
@@ -20,10 +20,10 @@
 package org.apache.jackrabbit.oak.plugins.document.secondary;
 
 import com.google.common.collect.EvictingQueue;
-import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.plugins.document.AbstractDocumentNodeState;
 import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStateCache;
 import org.apache.jackrabbit.oak.plugins.document.NodeStateDiffer;
+import org.apache.jackrabbit.oak.plugins.document.Path;
 import org.apache.jackrabbit.oak.plugins.document.RevisionVector;
 import org.apache.jackrabbit.oak.spi.filter.PathFilter;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -73,11 +73,12 @@ public class SecondaryStoreCache impleme
 
     @Nullable
     @Override
-    public AbstractDocumentNodeState getDocumentNodeState(String path, 
RevisionVector rootRevision,
-                                                    RevisionVector lastRev) {
+    public AbstractDocumentNodeState getDocumentNodeState(Path path, 
RevisionVector rootRevision,
+                                                          RevisionVector 
lastRev) {
         //TODO We might need skip the calls if they occur due to 
SecondaryStoreObserver
         //doing the diff or in the startup when we try to sync the state
-        PathFilter.Result result = pathFilter.filter(path);
+        String p = path.toString();
+        PathFilter.Result result = pathFilter.filter(p);
         if (result != PathFilter.Result.INCLUDE) {
             unknownPaths.mark();
             return null;
@@ -103,7 +104,7 @@ public class SecondaryStoreCache impleme
 
         AbstractDocumentNodeState matchingRoot = 
findMatchingRoot(rootRevision);
         if (matchingRoot != null){
-            NodeState state = NodeStateUtils.getNode(matchingRoot, path);
+            NodeState state = NodeStateUtils.getNode(matchingRoot, p);
             if (state.exists()){
                 AbstractDocumentNodeState docState = asDocState(state);
                 prevRevMatched.mark();
@@ -116,16 +117,16 @@ public class SecondaryStoreCache impleme
     }
 
     @Override
-    public boolean isCached(String path) {
-        return pathFilter.filter(path) == PathFilter.Result.INCLUDE;
+    public boolean isCached(Path path) {
+        return pathFilter.filter(path.toString()) == PathFilter.Result.INCLUDE;
     }
 
     @Nullable
-    private AbstractDocumentNodeState 
findByMatchingLastRev(AbstractDocumentNodeState root, String path,
+    private AbstractDocumentNodeState 
findByMatchingLastRev(AbstractDocumentNodeState root, Path path,
                                                       RevisionVector lastRev){
         NodeState state = root;
 
-        for (String name : PathUtils.elements(path)) {
+        for (String name : path.elements()) {
             state = state.getChildNode(name);
 
             if (!state.exists()){

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MapFactory.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MapFactory.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MapFactory.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/MapFactory.java
 Wed Apr 10 11:13:19 2019
@@ -22,6 +22,7 @@ package org.apache.jackrabbit.oak.plugin
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
+import org.apache.jackrabbit.oak.plugins.document.Path;
 import org.apache.jackrabbit.oak.plugins.document.Revision;
 
 /**
@@ -31,12 +32,12 @@ import org.apache.jackrabbit.oak.plugins
 public abstract class MapFactory {
     private static MapFactory DEFAULT = new MapFactory() {
         @Override
-        public ConcurrentMap<String, Revision> create() {
-            return new ConcurrentHashMap<String, Revision>();
+        public ConcurrentMap<Path, Revision> create() {
+            return new ConcurrentHashMap<>();
         }
     };
 
-    public abstract ConcurrentMap<String, Revision> create();
+    public abstract ConcurrentMap<Path, Revision> create();
 
     private static MapFactory instance = DEFAULT;
 

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/RevisionsKey.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/RevisionsKey.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/RevisionsKey.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/RevisionsKey.java
 Wed Apr 10 11:13:19 2019
@@ -39,6 +39,14 @@ public final class RevisionsKey implemen
         this.r2 = checkNotNull(r2);
     }
 
+    public RevisionVector getRev1() {
+        return r1;
+    }
+
+    public RevisionVector getRev2() {
+        return r2;
+    }
+
     @Override
     public int getMemory() {
         long size = 32 + (long)r1.getMemory() + (long)r2.getMemory();

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java
 Wed Apr 10 11:13:19 2019
@@ -43,6 +43,7 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.document.DocumentStore;
 import org.apache.jackrabbit.oak.plugins.document.DocumentStoreException;
 import org.apache.jackrabbit.oak.plugins.document.NodeDocument;
+import org.apache.jackrabbit.oak.plugins.document.Path;
 import org.apache.jackrabbit.oak.plugins.document.Revision;
 import org.apache.jackrabbit.oak.plugins.document.RevisionVector;
 import org.apache.jackrabbit.oak.plugins.document.StableRevisionComparator;
@@ -116,6 +117,22 @@ public class Utils {
         return depth;
     }
 
+    /**
+     * Calculates the depth prefix of the id for the given {@code path}. The is
+     * the same as {@link #pathDepth(String)}, but takes a {@link Path}
+     * argument.
+     *
+     * @param path a path.
+     * @return the id depth prefix for the given {@code path}.
+     */
+    public static int getIdDepth(Path path) {
+        int depth = path.getDepth();
+        if (!path.isAbsolute()) {
+            depth--;
+        }
+        return depth;
+    }
+
     @SuppressWarnings("unchecked")
     public static int estimateMemoryUsage(Map<?, Object> map) {
         if (map == null) {
@@ -232,27 +249,42 @@ public class Utils {
         return !key.startsWith("_") || key.startsWith("__") || 
key.startsWith("_$");
     }
 
-    public static String getIdFromPath(String path) {
+    public static String getIdFromPath(@NotNull String path) {
+        int depth = Utils.pathDepth(path);
         if (isLongPath(path)) {
-            MessageDigest digest;
-            try {
-                digest = MessageDigest.getInstance("SHA-256");
-            } catch (NoSuchAlgorithmException e) {
-                throw new RuntimeException(e);
-            }
-            int depth = Utils.pathDepth(path);
             String parent = PathUtils.getParentPath(path);
-            byte[] hash = digest.digest(parent.getBytes(UTF_8));
-            String name = PathUtils.getName(path);
-            StringBuilder sb = new StringBuilder(digest.getDigestLength() * 2 
+ name.length() + 6);
-            sb.append(depth).append(":h");
-            encodeHexString(hash, sb).append("/").append(name);
-            return sb.toString();
+            byte[] hash = createSHA256Digest(parent);
+            return createHashedId(depth, hash, PathUtils.getName(path));
+        }
+        return depth + ":" + path;
+    }
+
+    public static String getIdFromPath(@NotNull Path path) {
+        checkNotNull(path);
+        int depth = getIdDepth(path);
+        Path parent = path.getParent();
+        if (parent != null && isLongPath(path)) {
+            byte[] hash = createSHA256Digest(parent.toString());
+            return createHashedId(depth, hash, path.getName());
         }
-        int depth = Utils.pathDepth(path);
         return depth + ":" + path;
     }
 
+    private static String createHashedId(int depth, byte[] hash, String name) {
+        StringBuilder sb = new StringBuilder(hash.length * 2 + name.length() + 
6);
+        sb.append(depth).append(":h");
+        encodeHexString(hash, sb).append("/").append(name);
+        return sb.toString();
+    }
+
+    private static byte[] createSHA256Digest(String input) {
+        try {
+            return 
MessageDigest.getInstance("SHA-256").digest(input.getBytes(UTF_8));
+        } catch (NoSuchAlgorithmException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
     /**
      * Encodes the given data as hexadecimal string representation and appends
      * it to the {@code StringBuilder}. The hex digits are in lower case.
@@ -298,7 +330,7 @@ public class Utils {
         return Utils.getIdFromPath(parentPath);
     }
 
-    public static boolean isLongPath(String path) {
+    private static boolean isLongPath(String path) {
         // the most common case: a short path
         // avoid calculating the parent path
         if (path.length() < PATH_SHORT) {
@@ -315,12 +347,33 @@ public class Utils {
         }
         return true;
     }
-    
+
+    public static boolean isLongPath(Path path) {
+        // the most common case: a short path
+        // avoid calculating the parent path
+        if (path.length() < PATH_SHORT) {
+            return false;
+        }
+        // check if the parent path is long
+        Path parent = path.getParent();
+        if (parent == null) {
+            return false;
+        }
+        if (parent.toString().getBytes(UTF_8).length < PATH_LONG) {
+            return false;
+        }
+        if (path.getName().getBytes(UTF_8).length > NODE_NAME_LIMIT) {
+            throw new IllegalArgumentException("Node name is too long: " + 
path);
+        }
+        return true;
+    }
+
     public static boolean isIdFromLongPath(String id) {
         int index = id.indexOf(':');
         return index != -1 && index < id.length() - 1 && id.charAt(index + 1) 
== 'h';
     }
 
+    // TODO deprecate?
     public static String getPathFromId(String id) {
         if (isIdFromLongPath(id)) {
             throw new IllegalArgumentException("Id is hashed: " + id);
@@ -341,20 +394,19 @@ public class Utils {
         throw new IllegalArgumentException("Invalid id: " + id);
     }
 
-    public static String getPreviousPathFor(String path, Revision r, int 
height) {
-        if (!PathUtils.isAbsolute(path)) {
+    public static Path getPreviousPathFor(Path path, Revision r, int height) {
+        if (!path.isAbsolute()) {
             throw new IllegalArgumentException("path must be absolute: " + 
path);
         }
-        StringBuilder sb = new StringBuilder(path.length() + REVISION_LENGTH + 
3);
-        sb.append("p").append(path);
-        if (sb.charAt(sb.length() - 1) != '/') {
-            sb.append('/');
+        Path prev = new Path("p");
+        for (String name : path.elements()) {
+            prev = new Path(prev, name);
         }
-        r.toStringBuilder(sb).append("/").append(height);
-        return sb.toString();
+        prev = new Path(prev, r.toString());
+        return new Path(prev, String.valueOf(height));
     }
 
-    public static String getPreviousIdFor(String path, Revision r, int height) 
{
+    public static String getPreviousIdFor(Path path, Revision r, int height) {
         return getIdFromPath(getPreviousPathFor(path, r, height));
     }
 
@@ -416,9 +468,8 @@ public class Utils {
      * @param path a path.
      * @return the lower key limit.
      */
-    public static String getKeyLowerLimit(String path) {
-        String from = PathUtils.concat(path, "a");
-        from = getIdFromPath(from);
+    public static String getKeyLowerLimit(Path path) {
+        String from = getIdFromPath(new Path(path, "a"));
         from = from.substring(0, from.length() - 1);
         return from;
     }
@@ -430,9 +481,8 @@ public class Utils {
      * @param path a path.
      * @return the upper key limit.
      */
-    public static String getKeyUpperLimit(String path) {
-        String to = PathUtils.concat(path, "z");
-        to = getIdFromPath(to);
+    public static String getKeyUpperLimit(Path path) {
+        String to = getIdFromPath(new Path(path, "z"));
         to = to.substring(0, to.length() - 2) + "0";
         return to;
     }
@@ -608,7 +658,7 @@ public class Utils {
      */
     @NotNull
     public static NodeDocument getRootDocument(@NotNull DocumentStore store) {
-        String rootId = Utils.getIdFromPath("/");
+        String rootId = Utils.getIdFromPath(Path.ROOT);
         NodeDocument root = store.find(Collection.NODES, rootId);
         if (root == null) {
             throw new IllegalStateException("missing root document");
@@ -950,7 +1000,7 @@ public class Utils {
                                         ClusterNodeInfo info,
                                         Clock clock)
             throws DocumentStoreException {
-        NodeDocument root = store.find(Collection.NODES, getIdFromPath("/"));
+        NodeDocument root = store.find(Collection.NODES, 
getIdFromPath(Path.ROOT));
         if (root == null) {
             return;
         }

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AmnesiaDiffCache.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AmnesiaDiffCache.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AmnesiaDiffCache.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AmnesiaDiffCache.java
 Wed Apr 10 11:13:19 2019
@@ -36,7 +36,7 @@ class AmnesiaDiffCache extends DiffCache
     @Override
     public String getChanges(@NotNull RevisionVector from,
                              @NotNull RevisionVector to,
-                             @NotNull String path,
+                             @NotNull Path path,
                              @Nullable Loader loader) {
         if (loader != null) {
             return loader.call();
@@ -49,7 +49,7 @@ class AmnesiaDiffCache extends DiffCache
     public Entry newEntry(@NotNull RevisionVector from, @NotNull 
RevisionVector to, boolean local) {
         return new Entry() {
             @Override
-            public void append(@NotNull String path, @NotNull String changes) {
+            public void append(@NotNull Path path, @NotNull String changes) {
             }
 
             @Override

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AsyncCacheTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AsyncCacheTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AsyncCacheTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/AsyncCacheTest.java
 Wed Apr 10 11:13:19 2019
@@ -37,14 +37,15 @@ public class AsyncCacheTest {
         DocumentMK.Builder builder = builderProvider.newBuilder();
         builder.setPersistentCache("target/cacheTest");
         DocumentNodeStore nodeStore = builder.getNodeStore();
-        Cache<PathRev, DocumentNodeState.Children> cache = 
builder.buildChildrenCache(nodeStore);
+        Cache<NamePathRev, DocumentNodeState.Children> cache = 
builder.buildChildrenCache(nodeStore);
         DocumentNodeState.Children c = new DocumentNodeState.Children();
         for (int i = 0; i < 100; i++) {
             c.children.add("node-" + i);
         }
-        PathRev key = null;
+        Path path = Path.fromString("/foo/bar");
+        NamePathRev key = null;
         for (int i = 0; i < 1000; i++) {
-            key = new PathRev("/foo/bar", new RevisionVector(new Revision(i, 
0, 1)));
+            key = new NamePathRev("", path, new RevisionVector(new Revision(i, 
0, 1)));
             cache.put(key, c);
         }
         cache.invalidate(key);

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BackgroundWriteTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BackgroundWriteTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BackgroundWriteTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BackgroundWriteTest.java
 Wed Apr 10 11:13:19 2019
@@ -53,9 +53,9 @@ public class BackgroundWriteTest {
         mk.runBackgroundOperations();
         Revision r = mk.getNodeStore().newRevision();
         UnsavedModifications pending = 
mk.getNodeStore().getPendingModifications();
-        pending.put("/", r);
+        pending.put(Path.ROOT, r);
         for (String p : paths) {
-            pending.put(p, r);
+            pending.put(Path.fromString(p), r);
         }
         mk.runBackgroundOperations();
         mk.dispose();

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BasicDocumentStoreTest.java
 Wed Apr 10 11:13:19 2019
@@ -1104,7 +1104,7 @@ public class BasicDocumentStoreTest exte
     @Test
     public void removeWithCondition() throws Exception {
 
-        Set<String> existingDocs = new HashSet<String>();
+        Set<Path> existingDocs = new HashSet<>();
         for (NodeDocument doc : Utils.getAllDocuments(ds)) {
             existingDocs.add(doc.getPath());
         }
@@ -1132,8 +1132,9 @@ public class BasicDocumentStoreTest exte
 
         assertEquals(2, removed);
         assertNotNull(ds.find(Collection.NODES, Utils.getIdFromPath("/bar")));
+        Path bar = Path.fromString("/bar");
         for (NodeDocument doc : Utils.getAllDocuments(ds)) {
-            if (!doc.getPath().equals("/bar") && 
!existingDocs.contains(doc.getPath())) {
+            if (!doc.getPath().equals(bar) && 
!existingDocs.contains(doc.getPath())) {
                 fail("document must not exist: " + doc.getId());
             }
         }

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BranchTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BranchTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BranchTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/BranchTest.java
 Wed Apr 10 11:13:19 2019
@@ -56,12 +56,12 @@ public class BranchTest {
         Branch b = branches.create(base, c1, null);
 
         BranchCommit bc1 = b.getCommit(c1);
-        bc1.track("/foo");
+        bc1.track(Path.fromString("/foo"));
 
         Revision c2 = Revision.newRevision(1).asBranchRevision();
         b.addCommit(c2);
         BranchCommit bc2 = b.getCommit(c2);
-        bc2.track("/bar");
+        bc2.track(Path.fromString("/bar"));
 
         Revision c3 = Revision.newRevision(1).asBranchRevision();
         b.rebase(c3, new RevisionVector(Revision.newRevision(1)));
@@ -69,7 +69,7 @@ public class BranchTest {
         Revision c4 = Revision.newRevision(1).asBranchRevision();
         b.addCommit(c4);
         BranchCommit bc4 = b.getCommit(c4);
-        bc4.track("/baz");
+        bc4.track(Path.fromString("/baz"));
 
         Revision c5 = Revision.newRevision(1).asBranchRevision();
 
@@ -138,7 +138,11 @@ public class BranchTest {
         assertEquals("a", state.getString("p"));
     }
 
-    private void assertModifiedPaths(Iterable<String> actual, String... 
expected) {
-        assertEquals(Sets.newHashSet(expected), Sets.newHashSet(actual));
+    private void assertModifiedPaths(Iterable<Path> actual, String... 
expected) {
+        Set<Path> expectedSet = Sets.newHashSet();
+        for (String p : expected) {
+            expectedSet.add(Path.fromString(p));
+        }
+        assertEquals(expectedSet, Sets.newHashSet(actual));
     }
 }

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CacheConsistencyRDBTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CacheConsistencyRDBTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CacheConsistencyRDBTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CacheConsistencyRDBTest.java
 Wed Apr 10 11:13:19 2019
@@ -65,7 +65,7 @@ public class CacheConsistencyRDBTest ext
         Thread t = new Thread(new Runnable() {
             @Override
             public void run() {
-                store.query(NODES, Utils.getKeyLowerLimit("/"), 
Utils.getKeyUpperLimit("/"), 10);
+                store.query(NODES, Utils.getKeyLowerLimit(Path.ROOT), 
Utils.getKeyUpperLimit(Path.ROOT), 10);
             }
         }, "query");
         // block thread when it tries to convert db objects

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CacheConsistencyTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CacheConsistencyTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CacheConsistencyTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CacheConsistencyTest.java
 Wed Apr 10 11:13:19 2019
@@ -71,8 +71,8 @@ public class CacheConsistencyTest extend
             @Override
             public void run() {
                 store.query(NODES,
-                        Utils.getKeyLowerLimit("/"),
-                        Utils.getKeyUpperLimit("/"), 10);
+                        Utils.getKeyLowerLimit(Path.ROOT),
+                        Utils.getKeyUpperLimit(Path.ROOT), 10);
             }
         });
         // block thread when it tries to convert db objects

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ClusterTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ClusterTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ClusterTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ClusterTest.java
 Wed Apr 10 11:13:19 2019
@@ -225,9 +225,9 @@ public class ClusterTest {
 
         mk3.runBackgroundOperations(); // pick up changes from mk2
 
-        DocumentNodeState base = ns3.getNode("/", 
RevisionVector.fromString(base3));
+        DocumentNodeState base = ns3.getNode(Path.ROOT, 
RevisionVector.fromString(base3));
         assertNotNull(base);
-        NodeState branchHead = ns3.getNode("/", RevisionVector.fromString(b3));
+        NodeState branchHead = ns3.getNode(Path.ROOT, 
RevisionVector.fromString(b3));
         assertNotNull(branchHead);
         TrackingDiff diff = new TrackingDiff();
         branchHead.compareAgainstBaseState(base, diff);

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitBuilderTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitBuilderTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitBuilderTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitBuilderTest.java
 Wed Apr 10 11:13:19 2019
@@ -92,8 +92,9 @@ public class CommitBuilderTest {
     @Test
     public void addNode() {
         RevisionVector baseRev = ns.getHeadRevision();
+        Path foo = Path.fromString("/foo");
         CommitBuilder builder = new CommitBuilder(ns, baseRev);
-        builder.addNode("/foo");
+        builder.addNode(foo);
         Commit c = builder.build(ns.newRevision());
         assertNotNull(c);
         assertFalse(c.isEmpty());
@@ -102,10 +103,11 @@ public class CommitBuilderTest {
     @Test
     public void addNodeTwice() {
         RevisionVector baseRev = ns.getHeadRevision();
+        Path foo = Path.fromString("/foo");
         CommitBuilder builder = new CommitBuilder(ns, baseRev);
-        builder.addNode("/foo");
+        builder.addNode(foo);
         try {
-            builder.addNode("/foo");
+            builder.addNode(foo);
             fail("Must fail with DocumentStoreException");
         } catch (DocumentStoreException e) {
             assertThat(e.getMessage(), containsString("already added"));
@@ -116,7 +118,7 @@ public class CommitBuilderTest {
     public void addNodePathNull() {
         CommitBuilder builder = new CommitBuilder(ns, null);
         try {
-            builder.addNode((String) null);
+            builder.addNode((Path) null);
             expectNPE();
         } catch (NullPointerException e) {
             // expected
@@ -136,7 +138,7 @@ public class CommitBuilderTest {
 
     @Test
     public void addNodeState() {
-        String path = "/foo";
+        Path path = Path.fromString("/foo");
         DocumentNodeState foo = addNode("foo");
 
         CommitBuilder builder = new CommitBuilder(ns, null);
@@ -153,10 +155,11 @@ public class CommitBuilderTest {
         RevisionVector baseRev = ns.getHeadRevision()
                 .update(ns.newRevision().asBranchRevision());
         CommitBuilder builder = new CommitBuilder(ns, baseRev);
-        builder.addNode("/foo");
+        Path path = Path.fromString("/foo");
+        builder.addNode(path);
         Revision commitRev = ns.newRevision();
         Commit c = builder.build(commitRev);
-        UpdateOp up = c.getUpdateOperationForNode("/foo");
+        UpdateOp up = c.getUpdateOperationForNode(path);
         UpdateOp.Operation op = up.getChanges().get(
                 new UpdateOp.Key("_bc", commitRev));
         assertNotNull(op);
@@ -167,7 +170,7 @@ public class CommitBuilderTest {
         DocumentNodeState bar = addNode("bar");
 
         CommitBuilder builder = new CommitBuilder(ns, null);
-        String path = "/bar";
+        Path path = Path.fromString("/bar");
 
         builder.removeNode(path, bar);
         Commit c = builder.build(ns.newRevision());
@@ -182,7 +185,7 @@ public class CommitBuilderTest {
         DocumentNodeState bar = addNode("bar");
 
         CommitBuilder builder = new CommitBuilder(ns, null);
-        String path = "/bar";
+        Path path = Path.fromString("/bar");
 
         builder.removeNode(path, bar);
         try {
@@ -210,7 +213,7 @@ public class CommitBuilderTest {
     public void removeNodeStateNull() {
         CommitBuilder builder = new CommitBuilder(ns, null);
         try {
-            builder.removeNode("/bar", null);
+            builder.removeNode(Path.fromString("/bar"), null);
             expectNPE();
         } catch (NullPointerException e) {
             // expected
@@ -219,10 +222,11 @@ public class CommitBuilderTest {
 
     @Test
     public void updateProperty() {
+        Path path = Path.fromString("/foo");
         CommitBuilder builder = new CommitBuilder(ns, null);
-        builder.updateProperty("/foo", "p", "v");
+        builder.updateProperty(path, "p", "v");
         Commit c = builder.build(ns.newRevision());
-        UpdateOp up = c.getUpdateOperationForNode("/foo");
+        UpdateOp up = c.getUpdateOperationForNode(path);
         UpdateOp.Operation op = up.getChanges().get(
                 new UpdateOp.Key("p", c.getRevision()));
         assertNotNull(op);
@@ -230,10 +234,11 @@ public class CommitBuilderTest {
 
     @Test
     public void updatePropertyValueNull() {
+        Path path = Path.fromString("/foo");
         CommitBuilder builder = new CommitBuilder(ns, null);
-        builder.updateProperty("/foo", "p", null);
+        builder.updateProperty(path, "p", null);
         Commit c = builder.build(ns.newRevision());
-        UpdateOp up = c.getUpdateOperationForNode("/foo");
+        UpdateOp up = c.getUpdateOperationForNode(path);
         UpdateOp.Operation op = up.getChanges().get(
                 new UpdateOp.Key("p", c.getRevision()));
         assertNotNull(op);
@@ -243,7 +248,7 @@ public class CommitBuilderTest {
     public void updatePropertyPathNull() {
         CommitBuilder builder = new CommitBuilder(ns, null);
         try {
-            builder.updateProperty(null, "p", "v");
+            builder.updateProperty((Path) null, "p", "v");
             expectNPE();
         } catch (NullPointerException e) {
             // expected
@@ -254,7 +259,7 @@ public class CommitBuilderTest {
     public void updatePropertyPropertyNull() {
         CommitBuilder builder = new CommitBuilder(ns, null);
         try {
-            builder.updateProperty("/foo", null, "v");
+            builder.updateProperty(Path.fromString("/foo"), null, "v");
             expectNPE();
         } catch (NullPointerException e) {
             // expected

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitRootUpdateTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitRootUpdateTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitRootUpdateTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitRootUpdateTest.java
 Wed Apr 10 11:13:19 2019
@@ -68,8 +68,8 @@ public class CommitRootUpdateTest {
         throwAfterUpdate.set(true);
         boolean success = false;
         Commit c = ns.newCommit(changes -> {
-            changes.addNode("/foo/node");
-            changes.addNode("/bar/node");
+            changes.addNode(Path.fromString("/foo/node"));
+            changes.addNode(Path.fromString("/bar/node"));
         }, ns.getHeadRevision(), null);
         try {
             c.apply();
@@ -125,7 +125,7 @@ public class CommitRootUpdateTest {
         throwAfterUpdate.set(true);
         boolean success = false;
         Commit c = ns.newCommit(
-                changes -> changes.updateProperty("/foo", "p", "v"),
+                changes -> changes.updateProperty(Path.fromString("/foo"), 
"p", "v"),
                 ns.getHeadRevision(), null);
         try {
             c.apply();

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CommitTest.java
 Wed Apr 10 11:13:19 2019
@@ -59,10 +59,10 @@ public class CommitTest {
 
         // this commit should fail
         Commit c = ns.newCommit(changes -> {
-            changes.addNode("/foo/baz");
+            changes.addNode(Path.fromString("/foo/baz"));
         }, ns.getHeadRevision(), null);
         try {
-            UpdateOp op = c.getUpdateOperationForNode("/bar");
+            UpdateOp op = c.getUpdateOperationForNode(Path.fromString("/bar"));
             op.setMapEntry("p", c.getRevision(), "v");
             try {
                 c.apply();
@@ -94,7 +94,7 @@ public class CommitTest {
 
         // this commit should fail
         Commit c = ns.newCommit(changes -> {
-            changes.addNode("/foo");
+            changes.addNode(Path.fromString("/foo"));
         }, ns.getHeadRevision(), null);
         try {
             c.apply();
@@ -117,7 +117,7 @@ public class CommitTest {
 
         // this branch commit must fail with a DocumentStoreException
         Commit c = ns.newCommit(changes -> {
-            changes.removeNode("/foo", EMPTY_NODE);
+            changes.removeNode(Path.fromString("/foo"), EMPTY_NODE);
         }, ns.getHeadRevision().asBranchRevision(ns.getClusterId()), null);
         try {
             try {

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndInvalidateIT.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndInvalidateIT.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndInvalidateIT.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndInvalidateIT.java
 Wed Apr 10 11:13:19 2019
@@ -122,7 +122,7 @@ public class ConcurrentQueryAndInvalidat
     }
 
     private void queryDocuments() {
-        ds1.query(NODES, getKeyLowerLimit("/"), getKeyUpperLimit("/"), 100);
+        ds1.query(NODES, getKeyLowerLimit(Path.ROOT), 
getKeyUpperLimit(Path.ROOT), 100);
     }
 
     private Iterable<String> updateDocuments() {

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndUpdate2IT.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndUpdate2IT.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndUpdate2IT.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndUpdate2IT.java
 Wed Apr 10 11:13:19 2019
@@ -105,7 +105,7 @@ public class ConcurrentQueryAndUpdate2IT
             Thread.sleep(0, ThreadLocalRandom.current().nextInt(1000, 10000));
         } catch (InterruptedException ignore) {
         }
-        ds.query(NODES, getKeyLowerLimit("/"), getKeyUpperLimit("/"), 100);
+        ds.query(NODES, getKeyLowerLimit(Path.ROOT), 
getKeyUpperLimit(Path.ROOT), 100);
     }
 
     private void updateDocuments() {

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndUpdateIT.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndUpdateIT.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndUpdateIT.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/ConcurrentQueryAndUpdateIT.java
 Wed Apr 10 11:13:19 2019
@@ -87,7 +87,7 @@ public class ConcurrentQueryAndUpdateIT
     }
 
     private void queryDocuments() {
-        ds.query(NODES, getKeyLowerLimit("/"), getKeyUpperLimit("/"), 100);
+        ds.query(NODES, getKeyLowerLimit(Path.ROOT), 
getKeyUpperLimit(Path.ROOT), 100);
     }
 
     private void updateDocuments() {

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CountingDiffCache.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CountingDiffCache.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CountingDiffCache.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/CountingDiffCache.java
 Wed Apr 10 11:13:19 2019
@@ -58,7 +58,7 @@ public class CountingDiffCache extends M
     @Override
     public String getChanges(@NotNull RevisionVector from,
                              @NotNull RevisionVector to,
-                             @NotNull String path,
+                             @NotNull Path path,
                              @Nullable Loader loader) {
         return super.getChanges(from, to, path, new CountingLoader(loader));
     }

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
 Wed Apr 10 11:13:19 2019
@@ -126,8 +126,9 @@ public class DocumentMK {
         }
         RevisionVector fromRev = RevisionVector.fromString(fromRevisionId);
         RevisionVector toRev = RevisionVector.fromString(toRevisionId);
-        final DocumentNodeState before = nodeStore.getNode(path, fromRev);
-        final DocumentNodeState after = nodeStore.getNode(path, toRev);
+        Path p = Path.fromString(path);
+        final DocumentNodeState before = nodeStore.getNode(p, fromRev);
+        final DocumentNodeState after = nodeStore.getNode(p, toRev);
         if (before == null || after == null) {
             String msg = String.format("Diff is only supported if the node 
exists in both cases. " +
                             "Node [%s], fromRev [%s] -> %s, toRev [%s] -> %s",
@@ -149,7 +150,7 @@ public class DocumentMK {
         RevisionVector rev = RevisionVector.fromString(revisionId);
         DocumentNodeState n;
         try {
-            n = nodeStore.getNode(path, rev);
+            n = nodeStore.getNode(Path.fromString(path), rev);
         } catch (DocumentStoreException e) {
             throw new DocumentStoreException(e);
         }
@@ -165,7 +166,7 @@ public class DocumentMK {
         revisionId = revisionId != null ? revisionId : 
nodeStore.getHeadRevision().toString();
         RevisionVector rev = RevisionVector.fromString(revisionId);
         try {
-            DocumentNodeState n = nodeStore.getNode(path, rev);
+            DocumentNodeState n = nodeStore.getNode(Path.fromString(path), 
rev);
             if (n == null) {
                 return null;
             }
@@ -183,7 +184,7 @@ public class DocumentMK {
                 long m = ((long) maxChildNodes) + offset;
                 max = (int) Math.min(m, Integer.MAX_VALUE);
             }
-            Children c = nodeStore.getChildren(n, null, max);
+            Children c = nodeStore.getChildren(n, "", max);
             for (long i = offset; i < c.children.size(); i++) {
                 if (maxChildNodes-- <= 0) {
                     break;
@@ -330,7 +331,7 @@ public class DocumentMK {
                     added.add(path);
                     break;
                 case '-':
-                    DocumentNodeState toRemove = nodeStore.getNode(path, 
commit.getBaseRevision());
+                    DocumentNodeState toRemove = 
nodeStore.getNode(Path.fromString(path), commit.getBaseRevision());
                     if (toRemove == null) {
                         throw new DocumentStoreException("Node not found: " + 
path + " in revision " + baseRevId);
                     }
@@ -345,11 +346,11 @@ public class DocumentMK {
                         value = t.readRawValue().trim();
                     }
                     String p = PathUtils.getParentPath(path);
-                    if (!added.contains(p) && nodeStore.getNode(p, 
commit.getBaseRevision()) == null) {
+                    if (!added.contains(p) && 
nodeStore.getNode(Path.fromString(p), commit.getBaseRevision()) == null) {
                         throw new DocumentStoreException("Node not found: " + 
path + " in revision " + baseRevId);
                     }
                     String propertyName = PathUtils.getName(path);
-                    commit.updateProperty(p, propertyName, value);
+                    commit.updateProperty(Path.fromString(p), propertyName, 
value);
                     break;
                 case '>': {
                     t.read(':');
@@ -357,7 +358,7 @@ public class DocumentMK {
                     if (!PathUtils.isAbsolute(targetPath)) {
                         targetPath = PathUtils.concat(rootPath, targetPath);
                     }
-                    DocumentNodeState source = nodeStore.getNode(path, 
baseRev);
+                    DocumentNodeState source = 
nodeStore.getNode(Path.fromString(path), baseRev);
                     if (source == null) {
                         throw new DocumentStoreException("Node not found: " + 
path + " in revision " + baseRevId);
                     } else if (nodeExists(targetPath, baseRevId)) {
@@ -372,7 +373,7 @@ public class DocumentMK {
                     if (!PathUtils.isAbsolute(targetPath)) {
                         targetPath = PathUtils.concat(rootPath, targetPath);
                     }
-                    DocumentNodeState source = nodeStore.getNode(path, 
baseRev);
+                    DocumentNodeState source = 
nodeStore.getNode(Path.fromString(path), baseRev);
                     if (source == null) {
                         throw new DocumentStoreException("Node not found: " + 
path + " in revision " + baseRevId);
                     } else if (nodeExists(targetPath, baseRevId)) {
@@ -403,7 +404,7 @@ public class DocumentMK {
             } while (t.matches(','));
             t.read('}');
         }
-        DocumentNodeState n = new DocumentNodeState(nodeStore, path,
+        DocumentNodeState n = new DocumentNodeState(nodeStore, 
Path.fromString(path),
                 new RevisionVector(commit.getRevision()), props, false, null);
         commit.addNode(n);
     }
@@ -421,7 +422,7 @@ public class DocumentMK {
 
         if (subTreeAlso) {
             // recurse down the tree
-            for (DocumentNodeState child : nodeStore.getChildNodes(node, null, 
Integer.MAX_VALUE)) {
+            for (DocumentNodeState child : nodeStore.getChildNodes(node, "", 
Integer.MAX_VALUE)) {
                 markAsDeleted(child, commit, true);
             }
         }
@@ -432,15 +433,15 @@ public class DocumentMK {
                                 String targetPath,
                                 CommitBuilder commit) {
         RevisionVector destRevision = 
commit.getBaseRevision().update(commit.getRevision());
-        DocumentNodeState newNode = new DocumentNodeState(nodeStore, 
targetPath, destRevision,
+        DocumentNodeState newNode = new DocumentNodeState(nodeStore, 
Path.fromString(targetPath), destRevision,
                 source.getProperties(), false, null);
 
         commit.addNode(newNode);
         if (move) {
             markAsDeleted(source, commit, false);
         }
-        for (DocumentNodeState child : nodeStore.getChildNodes(source, null, 
Integer.MAX_VALUE)) {
-            String childName = PathUtils.getName(child.getPath());
+        for (DocumentNodeState child : nodeStore.getChildNodes(source, "", 
Integer.MAX_VALUE)) {
+            String childName = child.getPath().getName();
             String destChildPath = concat(targetPath, childName);
             moveOrCopyNode(move, child, destChildPath, commit);
         }

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStateTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStateTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStateTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStateTest.java
 Wed Apr 10 11:13:19 2019
@@ -35,8 +35,8 @@ public class DocumentNodeStateTest {
     public void getMemory() {
         DocumentNodeStore store = builderProvider.newBuilder().getNodeStore();
         RevisionVector rv = new RevisionVector(Revision.newRevision(1));
-        DocumentNodeState state = new DocumentNodeState(store, "/foo", rv);
-        assertEquals(176, state.getMemory());
+        DocumentNodeState state = new DocumentNodeState(store, 
Path.fromString("/foo"), rv);
+        assertEquals(198, state.getMemory());
     }
 
     @Test

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranchesTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranchesTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranchesTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranchesTest.java
 Wed Apr 10 11:13:19 2019
@@ -190,10 +190,12 @@ public class DocumentNodeStoreBranchesTe
         long numCreateOrUpdate = store.getNumCreateOrUpdateCalls(NODES);
         assertThat(numCreateOrUpdate, lessThanOrEqualTo(branchCommits + 1));
 
+        Path bar = Path.fromString("/bar");
         // verify reset cleaned up properly
         for (NodeDocument doc : Utils.getAllDocuments(store)) {
-            String path = doc.getPath();
-            if (path.startsWith("/bar")) {
+            Path p = doc.getPath();
+            if (bar.isAncestorOf(p) || bar.equals(p)) {
+                String path = p.toString();
                 assertThat(path, doc.getLocalRevisions().keySet(), 
is(empty()));
                 assertThat(path, doc.getLocalCommitRoot().keySet(), 
is(empty()));
                 assertThat(path, doc.getDeleted().keySet(), is(empty()));
@@ -238,10 +240,12 @@ public class DocumentNodeStoreBranchesTe
             // expected
         }
 
+        Path bar = Path.fromString("/bar");
         // verify reset cleaned up properly
         for (NodeDocument doc : Utils.getAllDocuments(ns.getDocumentStore())) {
-            String path = doc.getPath();
-            if (path.startsWith("/bar")) {
+            Path p = doc.getPath();
+            if (bar.isAncestorOf(p) || bar.equals(p)) {
+                String path = p.toString();
                 assertThat(path, doc.getLocalRevisions().keySet(), 
is(empty()));
                 assertThat(path, doc.getLocalCommitRoot().keySet(), 
is(empty()));
                 assertThat(path, doc.getDeleted().keySet(), is(empty()));
@@ -295,10 +299,12 @@ public class DocumentNodeStoreBranchesTe
             // otherwise expected
         }
 
+        Path bar = Path.fromString("/bar");
         // verify reset cleaned up properly
         for (NodeDocument doc : Utils.getAllDocuments(ns.getDocumentStore())) {
-            String path = doc.getPath();
-            if (path.startsWith("/bar")) {
+            Path p = doc.getPath();
+            if (bar.isAncestorOf(p) || bar.equals(p)) {
+                String path = p.toString();
                 assertThat(path, doc.getLocalRevisions().keySet(), 
is(empty()));
                 assertThat(path, doc.getLocalCommitRoot().keySet(), 
is(empty()));
                 assertThat(path, doc.getDeleted().keySet(), is(empty()));
@@ -353,10 +359,12 @@ public class DocumentNodeStoreBranchesTe
             // otherwise expected
         }
 
+        Path bar = Path.fromString("/bar");
         // verify reset cleaned up properly
         for (NodeDocument doc : Utils.getAllDocuments(ns.getDocumentStore())) {
-            String path = doc.getPath();
-            if (path.startsWith("/bar")) {
+            Path p = doc.getPath();
+            if (bar.isAncestorOf(p) || bar.equals(p)) {
+                String path = p.toString();
                 assertThat(path, doc.getLocalRevisions().keySet(), 
is(empty()));
                 assertThat(path, doc.getLocalCommitRoot().keySet(), 
is(empty()));
                 assertThat(path, doc.getDeleted().keySet(), is(empty()));

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreServiceTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreServiceTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreServiceTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreServiceTest.java
 Wed Apr 10 11:13:19 2019
@@ -195,10 +195,10 @@ public class DocumentNodeStoreServiceTes
         MockOsgi.activate(service, context.bundleContext());
 
         DocumentNodeStore dns = context.getService(DocumentNodeStore.class);
-        assertTrue(dns.getNodeCachePredicate().apply("/a/b/c"));
-        assertTrue(dns.getNodeCachePredicate().apply("/c/d/e"));
+        
assertTrue(dns.getNodeCachePredicate().apply(Path.fromString("/a/b/c")));
+        
assertTrue(dns.getNodeCachePredicate().apply(Path.fromString("/c/d/e")));
 
-        assertFalse(dns.getNodeCachePredicate().apply("/x"));
+        assertFalse(dns.getNodeCachePredicate().apply(Path.fromString("/x")));
     }
 
     @Test

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreSweepIT.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreSweepIT.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreSweepIT.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreSweepIT.java
 Wed Apr 10 11:13:19 2019
@@ -164,7 +164,7 @@ public class DocumentNodeStoreSweepIT ex
         // store must now contain uncommitted changes
         NodeDocument doc = null;
         for (NodeDocument d : Utils.getAllDocuments(store)) {
-            if (d.getPath().startsWith("/node-")) {
+            if (d.getPath().toString().startsWith("/node-")) {
                 doc = d;
                 break;
             }
@@ -175,7 +175,7 @@ public class DocumentNodeStoreSweepIT ex
         assertEquals(1, deleted.size());
         assertNull(ns.getCommitValue(deleted.firstKey(), doc));
 
-        return doc.getPath();
+        return doc.getPath().toString();
     }
 
 }

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreSweepTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreSweepTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreSweepTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreSweepTest.java
 Wed Apr 10 11:13:19 2019
@@ -37,7 +37,6 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
-import static org.apache.jackrabbit.oak.commons.PathUtils.ROOT_PATH;
 import static org.apache.jackrabbit.oak.plugins.document.TestUtils.NO_BINARY;
 import static org.apache.jackrabbit.oak.plugins.document.TestUtils.merge;
 import static 
org.apache.jackrabbit.oak.plugins.document.util.Utils.getAllDocuments;
@@ -216,7 +215,7 @@ public class DocumentNodeStoreSweepTest
         crashDocumentNodeStore();
         // and remove the sweep revision for clusterId
         // this will look like an upgraded and crashed pre 1.8 node store
-        UpdateOp op = new UpdateOp(getIdFromPath(ROOT_PATH), false);
+        UpdateOp op = new UpdateOp(getIdFromPath(Path.ROOT), false);
         op.removeMapEntry("_sweepRev", new Revision(0, 0, clusterId));
         assertNotNull(store.findAndUpdate(Collection.NODES, op));
         NodeDocument rootDoc = getRootDocument(store);
@@ -260,7 +259,7 @@ public class DocumentNodeStoreSweepTest
         // get the revision of the uncommitted changes
         Revision r = null;
         for (NodeDocument d : Utils.getAllDocuments(store)) {
-            if (d.getPath().startsWith("/node-")) {
+            if (d.getPath().toString().startsWith("/node-")) {
                 r = Iterables.getFirst(d.getAllChanges(), null);
                 break;
             }
@@ -308,7 +307,7 @@ public class DocumentNodeStoreSweepTest
         // store must now contain uncommitted changes
         NodeDocument doc = null;
         for (NodeDocument d : Utils.getAllDocuments(store)) {
-            if (d.getPath().startsWith("/node-")) {
+            if (d.getPath().toString().startsWith("/node-")) {
                 doc = d;
                 break;
             }

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreTest.java
 Wed Apr 10 11:13:19 2019
@@ -295,9 +295,9 @@ public class DocumentNodeStoreTest {
             @Override
             public void run() {
                 Commit c = new CommitBuilder(store, store.newRevision(), head)
-                        .addNode("/newConflictingNode")
-                        .addNode("/deletedNode")
-                        .updateProperty("/updateNode", "foo", "baz")
+                        .addNode(Path.fromString("/newConflictingNode"))
+                        .addNode(Path.fromString("/deletedNode"))
+                        .updateProperty(Path.fromString("/updateNode"), "foo", 
"baz")
                         .build();
                 try {
                     c.apply();
@@ -316,8 +316,8 @@ public class DocumentNodeStoreTest {
         // commit will succeed and add collision marker to writer commit
         Revision r = store.newRevision();
         Commit c = new CommitBuilder(store, r, head)
-                .addNode("/newConflictingNode")
-                .addNode("/newNonConflictingNode")
+                .addNode(Path.fromString("/newConflictingNode"))
+                .addNode(Path.fromString("/newNonConflictingNode"))
                 .build();
         c.apply();
         // allow writer to continue
@@ -2144,7 +2144,7 @@ public class DocumentNodeStoreTest {
         RevisionVector to = ns.getHeadRevision();
 
         DiffCache.Entry entry = ns.getDiffCache().newEntry(from, to, true);
-        entry.append("/", "-\"foo\"");
+        entry.append(Path.ROOT, "-\"foo\"");
         entry.done();
 
         ns.compare(ns.getRoot(), ns.getRoot(from), new DefaultNodeStateDiff() {
@@ -2928,7 +2928,7 @@ public class DocumentNodeStoreTest {
 
         RevisionVector headRev = ns.getHeadRevision();
         Iterable<DocumentNodeState> nodes = ns.getChildNodes(
-                asDocumentNodeState(ns.getRoot().getChildNode("foo")), null, 
10);
+                asDocumentNodeState(ns.getRoot().getChildNode("foo")), "", 10);
         assertEquals(2, Iterables.size(nodes));
         for (DocumentNodeState c : nodes) {
             assertEquals(headRev, c.getRootRevision());
@@ -3259,7 +3259,7 @@ public class DocumentNodeStoreTest {
         Revision rev = ns.newRevision();
         RevisionVector after = new RevisionVector(ns.newRevision());
 
-        String path = "/foo";
+        Path path = Path.fromString("/foo");
         ns.getNode(path, before);
         assertNotNull(ns.getNodeCache().getIfPresent(new PathRev(path, 
before)));
 
@@ -3282,7 +3282,7 @@ public class DocumentNodeStoreTest {
         RevisionVector head = ns.getHeadRevision();
 
         // simulate an incorrect cache entry
-        PathRev key = new PathRev("/", head);
+        NamePathRev key = new NamePathRev("", Path.ROOT, head);
         DocumentNodeState.Children c = new DocumentNodeState.Children();
         c.children.add("a");
         c.children.add("b");

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
 Wed Apr 10 11:13:19 2019
@@ -107,7 +107,7 @@ public class DocumentSplitTest extends B
             assertTrue(isCommitted(ns.getCommitValue(rev, doc)));
         }
         // check if document is still there
-        assertNotNull(ns.getNode("/", RevisionVector.fromString(head)));
+        assertNotNull(ns.getNode(Path.ROOT, RevisionVector.fromString(head)));
 
         NodeDocument prevDoc = 
Iterators.getOnlyElement(doc.getAllPreviousDocs());
         assertThat(prevDoc.getSplitDocType(), 
either(is(SplitDocType.DEFAULT)).or(is(SplitDocType.DEFAULT_NO_BRANCH)));
@@ -147,7 +147,7 @@ public class DocumentSplitTest extends B
                     || doc.getCommitRootPath(rev) != null);
             assertTrue(isCommitted(ns.getCommitValue(rev, doc)));
         }
-        DocumentNodeState node = ns.getNode("/foo", 
RevisionVector.fromString(head));
+        DocumentNodeState node = ns.getNode(Path.fromString("/foo"), 
RevisionVector.fromString(head));
         // check status of node
         if (create) {
             assertNull(node);
@@ -305,7 +305,7 @@ public class DocumentSplitTest extends B
             NodeDocument doc = ds.find(NODES, Utils.getIdFromPath("/test"));
             assertNotNull(doc);
             RevisionVector head = ns.getHeadRevision();
-            Revision lastRev = ns.getPendingModifications().get("/test");
+            Revision lastRev = 
ns.getPendingModifications().get(Path.fromString("/test"));
             DocumentNodeState n = doc.getNodeAtRevision(mk.getNodeStore(), 
head, lastRev);
             assertNotNull(n);
             String value = n.getPropertyAsString(name);
@@ -416,11 +416,11 @@ public class DocumentSplitTest extends B
 
     @Test
     public void cascadingSplitLongPath() {
-        String p = "/";
+        Path p = Path.ROOT;
         while (!Utils.isLongPath(p)) {
-            p = PathUtils.concat(p, "long-path-element");
+            p = new Path(p, "long-path-element");
         }
-        cascadingSplit(p);
+        cascadingSplit(p.toString());
     }
 
     private void cascadingSplit(String path) {
@@ -502,7 +502,8 @@ public class DocumentSplitTest extends B
     @Test
     public void mainPath() {
         Revision r = Revision.fromString("r1-0-1");
-        for (String path : new String[]{"/", "/test", "/test/path"}) {
+        for (String p : new String[]{"/", "/test", "/test/path"}) {
+            Path path = Path.fromString(p);
             DocumentStore store = mk.getDocumentStore();
             NodeDocument doc = new NodeDocument(store);
             String id = Utils.getPreviousIdFor(path, r, 0);
@@ -550,7 +551,7 @@ public class DocumentSplitTest extends B
         assertEquals(2, splitOps.size());
         // first update op is for the new intermediate doc
         op = splitOps.get(0);
-        String newPrevId = Utils.getPreviousIdFor("/test", prev.last(), 1);
+        String newPrevId = Utils.getPreviousIdFor(Path.fromString("/test"), 
prev.last(), 1);
         assertEquals(newPrevId, op.getId());
         // second update op is for the main document
         op = splitOps.get(1);
@@ -563,7 +564,7 @@ public class DocumentSplitTest extends B
                 if (entry.getValue().type == REMOVE_MAP_ENTRY) {
                     assertTrue(prev.contains(r));
                 } else if (entry.getValue().type == SET_MAP_ENTRY) {
-                    assertEquals(newPrevId, Utils.getPreviousIdFor("/test", r, 
1));
+                    assertEquals(newPrevId, 
Utils.getPreviousIdFor(Path.fromString("/test"), r, 1));
                 } else {
                     fail("unexpected update operation " + entry);
                 }
@@ -605,7 +606,7 @@ public class DocumentSplitTest extends B
                 mk.getNodeStore(), mk.getNodeStore().getHeadRevision(),
                 NO_BINARY));
         assertEquals(2, splitOps.size());
-        String prevId = Utils.getPreviousIdFor("/test", revs.get(revs.size() - 
2), 0);
+        String prevId = Utils.getPreviousIdFor(Path.fromString("/test"), 
revs.get(revs.size() - 2), 0);
         assertEquals(prevId, splitOps.get(0).getId());
         assertEquals(id, splitOps.get(1).getId());
     }

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalEntryTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalEntryTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalEntryTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/JournalEntryTest.java
 Wed Apr 10 11:13:19 2019
@@ -27,7 +27,6 @@ import java.util.concurrent.atomic.Atomi
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
-import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.commons.json.JsopReader;
 import org.apache.jackrabbit.oak.commons.json.JsopTokenizer;
 import org.apache.jackrabbit.oak.commons.sort.StringSort;
@@ -52,20 +51,20 @@ public class JournalEntryTest {
     @Test
     public void applyTo() throws Exception {
         DiffCache cache = new MemoryDiffCache(new DocumentMK.Builder());
-        List<String> paths = Lists.newArrayList();
+        List<Path> paths = Lists.newArrayList();
         addRandomPaths(paths);
         StringSort sort = JournalEntry.newSorter();
         add(sort, paths);
         RevisionVector from = new RevisionVector(new Revision(1, 0, 1));
         RevisionVector to = new RevisionVector(new Revision(2, 0, 1));
         sort.sort();
-        JournalEntry.applyTo(sort, cache, "/", from, to);
+        JournalEntry.applyTo(sort, cache, Path.ROOT, from, to);
 
-        for (String p : paths) {
+        for (Path p : paths) {
             String changes = cache.getChanges(from, to, p, null);
             assertNotNull("missing changes for " + p, changes);
             for (String c : getChildren(changes)) {
-                assertTrue(paths.contains(PathUtils.concat(p, c)));
+                assertTrue(paths.contains(new Path(p, c)));
             }
         }
         sort.close();
@@ -85,13 +84,13 @@ public class JournalEntryTest {
         RevisionVector from = new RevisionVector(Revision.newRevision(1));
         RevisionVector to = new RevisionVector(Revision.newRevision(1));
         sort.sort();
-        JournalEntry.applyTo(sort, cache, "/foo", from, to);
-        assertNotNull(cache.getChanges(from, to, "/foo", null));
-        assertNotNull(cache.getChanges(from, to, "/foo/a", null));
-        assertNotNull(cache.getChanges(from, to, "/foo/b", null));
-        assertNull(cache.getChanges(from, to, "/bar", null));
-        assertNull(cache.getChanges(from, to, "/bar/a", null));
-        assertNull(cache.getChanges(from, to, "/bar/b", null));
+        JournalEntry.applyTo(sort, cache, p("/foo"), from, to);
+        assertNotNull(cache.getChanges(from, to, p("/foo"), null));
+        assertNotNull(cache.getChanges(from, to, p("/foo/a"), null));
+        assertNotNull(cache.getChanges(from, to, p("/foo/b"), null));
+        assertNull(cache.getChanges(from, to, p("/bar"), null));
+        assertNull(cache.getChanges(from, to, p("/bar/a"), null));
+        assertNull(cache.getChanges(from, to, p("/bar/b"), null));
     }
 
     //OAK-3494
@@ -104,7 +103,7 @@ public class JournalEntryTest {
 
         //Put one entry for (from, to, "/a/b")->["c1", "c2"] manually
         DiffCache.Entry entry = cache.newEntry(from, to, false);
-        entry.append("/a/b", "^\"c1\":{}^\"c2\":{}");
+        entry.append(p("/a/b"), "^\"c1\":{}^\"c2\":{}");
         entry.done();
 
         //NOTE: calling validateCacheUsage fills the cache with an empty diff 
for the path being validated.
@@ -120,11 +119,14 @@ public class JournalEntryTest {
         validateCacheUsage(cache, from, to, "/c", false);//there is no cache 
entry for the whole hierarchy
 
         //Fill cache using journal
-        List<String> paths = Lists.newArrayList("/content/changed", 
"/content/changed1/child1");
+        List<Path> paths = Lists.newArrayList(
+                p("/content/changed"),
+                p("/content/changed1/child1")
+        );
         StringSort sort = JournalEntry.newSorter();
         add(sort, paths);
         sort.sort();
-        JournalEntry.applyTo(sort, cache, "/", from, to);
+        JournalEntry.applyTo(sort, cache, Path.ROOT, from, to);
 
         validateCacheUsage(cache, from, to, "/topUnchanged", true);
         validateCacheUsage(cache, from, to, "/content/changed/unchangedLeaf", 
true);
@@ -138,7 +140,7 @@ public class JournalEntryTest {
     public void fillExternalChanges() throws Exception {
         DocumentStore store = new MemoryDocumentStore();
         JournalEntry entry = JOURNAL.newDocument(store);
-        Set<String> paths = Sets.newHashSet();
+        Set<Path> paths = Sets.newHashSet();
         addRandomPaths(paths);
         entry.modified(paths);
         Revision r1 = new Revision(1, 0, 1);
@@ -170,7 +172,7 @@ public class JournalEntryTest {
     public void invalidateOnly() throws Exception {
         DocumentStore store = new MemoryDocumentStore();
         JournalEntry invalidateEntry = JOURNAL.newDocument(store);
-        Set<String> paths = Sets.newHashSet();
+        Set<Path> paths = Sets.newHashSet();
         addRandomPaths(paths);
         invalidateEntry.modified(paths);
         Revision r1 = new Revision(1, 0, 1);
@@ -213,14 +215,14 @@ public class JournalEntryTest {
         Revision r4 = new Revision(4, 0, 1);
         DocumentStore store = new MemoryDocumentStore();
         JournalEntry entry = JOURNAL.newDocument(store);
-        entry.modified("/");
-        entry.modified("/foo");
+        entry.modified(p("/"));
+        entry.modified(p("/foo"));
         UpdateOp op = entry.asUpdateOp(r2);
         assertTrue(store.create(JOURNAL, Collections.singletonList(op)));
 
         entry = JOURNAL.newDocument(store);
-        entry.modified("/");
-        entry.modified("/bar");
+        entry.modified(p("/"));
+        entry.modified(p("/bar"));
         op = entry.asUpdateOp(r4);
         assertTrue(store.create(JOURNAL, Collections.singletonList(op)));
 
@@ -271,22 +273,22 @@ public class JournalEntryTest {
         Revision r2 = new Revision(2, 0, 1);
         DocumentStore store = new MemoryDocumentStore();
         JournalEntry entry = JOURNAL.newDocument(store);
-        entry.modified("/");
-        entry.modified("/foo");
-        entry.modified("/foo/a");
-        entry.modified("/foo/b");
-        entry.modified("/foo/c");
-        entry.modified("/bar");
-        entry.modified("/bar/a");
-        entry.modified("/bar/b");
-        entry.modified("/bar/c");
+        entry.modified(p("/"));
+        entry.modified(p("/foo"));
+        entry.modified(p("/foo/a"));
+        entry.modified(p("/foo/b"));
+        entry.modified(p("/foo/c"));
+        entry.modified(p("/bar"));
+        entry.modified(p("/bar/a"));
+        entry.modified(p("/bar/b"));
+        entry.modified(p("/bar/c"));
 
         UpdateOp op = entry.asUpdateOp(r2);
         assertTrue(store.create(JOURNAL, Collections.singletonList(op)));
 
         StringSort sort = JournalEntry.newSorter();
         StringSort inv = JournalEntry.newSorter();
-        JournalEntry.fillExternalChanges(sort, inv, "/foo", r1, r2, store, e 
-> {}, null, null);
+        JournalEntry.fillExternalChanges(sort, inv, p("/foo"), r1, r2, store, 
e -> {}, null, null);
         assertEquals(4, sort.getSize());
         assertEquals(0, inv.getSize());
         sort.close();
@@ -297,7 +299,7 @@ public class JournalEntryTest {
     public void getRevisionTimestamp() throws Exception {
         DocumentStore store = new MemoryDocumentStore();
         JournalEntry entry = JOURNAL.newDocument(store);
-        entry.modified("/foo");
+        entry.modified(p("/foo"));
         Revision r = Revision.newRevision(1);
         assertTrue(store.create(JOURNAL,
                 Collections.singletonList(entry.asUpdateOp(r))));
@@ -315,14 +317,14 @@ public class JournalEntryTest {
                 @Override
                 public void run() {
                     for (int i = 0; i < 100000; i++) {
-                        entry.modified("/node-" + i);
+                        entry.modified(p("/node-" + i));
                     }
                 }
             });
             t.start();
             StringSort sort = JournalEntry.newSorter();
             try {
-                entry.addTo(sort, PathUtils.ROOT_PATH);
+                entry.addTo(sort, Path.ROOT);
             } finally {
                 sort.close();
             }
@@ -336,17 +338,17 @@ public class JournalEntryTest {
     public void addToWithPath() throws Exception {
         DocumentStore store = new MemoryDocumentStore();
         JournalEntry entry = JOURNAL.newDocument(store);
-        entry.modified("/");
-        entry.modified("/foo");
-        entry.modified("/foo/a");
-        entry.modified("/foo/b");
-        entry.modified("/foo/c");
-        entry.modified("/bar");
-        entry.modified("/bar/a");
-        entry.modified("/bar/b");
-        entry.modified("/bar/c");
+        entry.modified(p("/"));
+        entry.modified(p("/foo"));
+        entry.modified(p("/foo/a"));
+        entry.modified(p("/foo/b"));
+        entry.modified(p("/foo/c"));
+        entry.modified(p("/bar"));
+        entry.modified(p("/bar/a"));
+        entry.modified(p("/bar/b"));
+        entry.modified(p("/bar/c"));
         StringSort sort = JournalEntry.newSorter();
-        entry.addTo(sort, "/foo");
+        entry.addTo(sort, p("/foo"));
         assertEquals(4, sort.getSize());
         sort.close();
     }
@@ -359,24 +361,24 @@ public class JournalEntryTest {
         assertEquals("Incorrect number of initial paths", 0, 
entry.getNumChangedNodes());
         assertFalse("Incorrect hasChanges", entry.hasChanges());
 
-        entry.modified("/foo");
-        entry.modified("/bar");
+        entry.modified(p("/foo"));
+        entry.modified(p("/bar"));
         assertEquals("Incorrect number of paths", 2, 
entry.getNumChangedNodes());
         assertTrue("Incorrect hasChanges", entry.hasChanges());
 
-        entry.modified(Arrays.asList("/foo1", "/bar1"));
+        entry.modified(Arrays.asList(p("/foo1"), p("/bar1")));
         assertEquals("Incorrect number of paths", 4, 
entry.getNumChangedNodes());
         assertTrue("Incorrect hasChanges", entry.hasChanges());
 
-        entry.modified("/foo/bar2");
+        entry.modified(p("/foo/bar2"));
         assertEquals("Incorrect number of paths", 5, 
entry.getNumChangedNodes());
         assertTrue("Incorrect hasChanges", entry.hasChanges());
 
-        entry.modified("/foo3/bar3");
+        entry.modified(p("/foo3/bar3"));
         assertEquals("Incorrect number of paths", 7, 
entry.getNumChangedNodes());
         assertTrue("Incorrect hasChanges", entry.hasChanges());
 
-        entry.modified(Arrays.asList("/foo/bar4", "/foo5/bar5"));
+        entry.modified(Arrays.asList(p("/foo/bar4"), p("/foo5/bar5")));
         assertEquals("Incorrect number of paths", 10, 
entry.getNumChangedNodes());
         assertTrue("Incorrect hasChanges", entry.hasChanges());
     }
@@ -405,24 +407,24 @@ public class JournalEntryTest {
         assertNull(entry.get(JournalEntry.BRANCH_COMMITS));
     }
 
-    private static void addRandomPaths(java.util.Collection<String> paths) 
throws IOException {
-        paths.add("/");
+    private static void addRandomPaths(java.util.Collection<Path> paths) 
throws IOException {
+        paths.add(Path.ROOT);
         Random random = new Random(42);
         for (int i = 0; i < 1000; i++) {
-            String path = "/";
+            Path path = Path.ROOT;
             int depth = random.nextInt(6);
             for (int j = 0; j < depth; j++) {
                 char name = (char) ('a' + random.nextInt(26));
-                path = PathUtils.concat(path, String.valueOf(name));
+                path = new Path(path, String.valueOf(name));
                 paths.add(path);
             }
         }
     }
 
-    private static void add(StringSort sort, List<String> paths)
+    private static void add(StringSort sort, List<Path> paths)
             throws IOException {
-        for (String p : paths) {
-            sort.add(p);
+        for (Path p : paths) {
+            sort.add(p.toString());
         }
     }
 
@@ -453,9 +455,10 @@ public class JournalEntryTest {
                                     RevisionVector to,
                                     String path,
                                     boolean cacheExpected) {
-        String nonLoaderDiff = cache.getChanges(from, to, path, null);
+        Path p = p(path);
+        String nonLoaderDiff = cache.getChanges(from, to, p, null);
         final AtomicBoolean loaderCalled = new AtomicBoolean(false);
-        cache.getChanges(from, to, path, new DiffCache.Loader() {
+        cache.getChanges(from, to, p, new DiffCache.Loader() {
             @Override
             public String call() {
                 loaderCalled.set(true);
@@ -484,4 +487,8 @@ public class JournalEntryTest {
             invalidate.close();
         } return changes;
     }
+    
+    private static Path p(String path) {
+        return Path.fromString(path);
+    }
 }

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/LocalDiffCacheTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/LocalDiffCacheTest.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/LocalDiffCacheTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/LocalDiffCacheTest.java
 Wed Apr 10 11:13:19 2019
@@ -34,8 +34,6 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.junit.After;
 import org.junit.Test;
 
-import static com.google.common.collect.Maps.newHashMap;
-import static com.google.common.collect.Sets.newHashSet;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -85,11 +83,11 @@ public class LocalDiffCacheTest {
 
     @Test
     public void diffFromAsString() {
-        Map<String, String> changes = Maps.newHashMap();
-        changes.put("/", "+\"foo\":{}^\"bar\":{}-\"baz\"");
-        changes.put("/foo", "");
-        changes.put("/bar", "+\"qux\"");
-        changes.put("/bar/qux", "");
+        Map<Path, String> changes = Maps.newHashMap();
+        changes.put(Path.ROOT, "+\"foo\":{}^\"bar\":{}-\"baz\"");
+        changes.put(Path.fromString("/foo"), "");
+        changes.put(Path.fromString("/bar"), "+\"qux\"");
+        changes.put(Path.fromString("/bar/qux"), "");
         Diff diff = new Diff(changes, 0);
 
         assertEquals(changes, Diff.fromString(diff.asString()).getChanges());
@@ -97,7 +95,7 @@ public class LocalDiffCacheTest {
 
     @Test
     public void emptyDiff() throws Exception{
-        Map<String, String> changes = new HashMap<String, String>();
+        Map<Path, String> changes = new HashMap<>();
         Diff diff = new Diff(changes, 100);
         String asString = diff.asString();
         Diff diff2 = Diff.fromString(asString);

Modified: 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MeasureMemory.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MeasureMemory.java?rev=1857240&r1=1857239&r2=1857240&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MeasureMemory.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/MeasureMemory.java
 Wed Apr 10 11:13:19 2019
@@ -23,12 +23,14 @@ import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import com.google.common.collect.Lists;
 import com.mongodb.BasicDBObject;
 
 import org.apache.jackrabbit.oak.api.Blob;
 import org.apache.jackrabbit.oak.api.PropertyState;
+import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.plugins.document.util.RevisionsKey;
 import org.apache.jackrabbit.oak.plugins.document.util.Utils;
 import org.apache.jackrabbit.oak.plugins.memory.BinaryPropertyState;
@@ -43,7 +45,7 @@ import org.junit.Test;
  */
 public class MeasureMemory {
 
-    static final boolean TRACE = false;
+    static final boolean TRACE = true;
 
     static final int TEST_COUNT = 10000;
     static final int OVERHEAD = 24;
@@ -179,6 +181,19 @@ public class MeasureMemory {
     }
 
     @Test
+    public void revisionsKey2() throws Exception {
+        measureMemory(new Callable<Object[]>() {
+            @Override
+            public Object[] call() {
+                RevisionsKey k = new RevisionsKey(
+                        new RevisionVector(Revision.newRevision(0)),
+                        new RevisionVector(Revision.newRevision(0)));
+                return new Object[]{k, k.getMemory() + OVERHEAD};
+            }
+        });
+    }
+
+    @Test
     public void revisionVector() throws Exception {
         measureMemory(new Callable<Object[]>() {
             @Override
@@ -215,6 +230,84 @@ public class MeasureMemory {
         });
     }
 
+    @Test
+    public void memoryDiffCacheKey() throws Exception {
+        measureMemory(new Callable<Object[]>() {
+            private int counter = 0;
+            @Override
+            public Object[] call() {
+                Path p = Path.fromString(generatePath());
+                RevisionVector rv1 = new RevisionVector(
+                        Revision.newRevision(0),
+                        Revision.newRevision(1));
+                RevisionVector rv2 = new RevisionVector(
+                        Revision.newRevision(0),
+                        Revision.newRevision(1));
+                MemoryDiffCache.Key k = new MemoryDiffCache.Key(p, rv1, rv2);
+                return new Object[]{k, k.getMemory() + OVERHEAD};
+            }
+
+            private String generatePath() {
+                String p = "/";
+                for (int i = 0; i < 5; i++) {
+                    p = PathUtils.concat(p, generateName());
+                }
+                return p;
+            }
+
+            private String generateName() {
+                return String.format("node-%05d", counter++);
+            }
+        });
+    }
+
+    @Test
+    public void path() throws Exception {
+        measureMemory(new Callable<Object[]>() {
+            private AtomicInteger counter = new AtomicInteger();
+            @Override
+            public Object[] call() {
+                Path p = Path.fromString(generatePath(counter));
+                return new Object[]{p, p.getMemory() + OVERHEAD};
+            }
+        });
+    }
+
+    @Test
+    public void pathRev() throws Exception {
+        measureMemory(new Callable<Object[]>() {
+            private AtomicInteger counter = new AtomicInteger();
+            @Override
+            public Object[] call() {
+                Path p = Path.fromString(generatePath(counter));
+                RevisionVector r = new RevisionVector(
+                        Revision.newRevision(1),
+                        Revision.newRevision(2)
+                );
+                PathRev pr = new PathRev(p, r);
+                return new Object[]{pr, pr.getMemory() + OVERHEAD};
+            }
+        });
+    }
+
+    @Test
+    public void namePathRev() throws Exception {
+        measureMemory(new Callable<Object[]>() {
+            private AtomicInteger counter = new AtomicInteger();
+            @Override
+            public Object[] call() {
+                String name = generateName(counter);
+                Path p = Path.fromString(generatePath(counter));
+                RevisionVector r = new RevisionVector(
+                        Revision.newRevision(1),
+                        Revision.newRevision(2)
+                );
+                NamePathRev npr = new NamePathRev(name, p, r);
+                return new Object[]{npr, npr.getMemory() + OVERHEAD};
+            }
+        });
+    }
+
     private static void measureMemory(Callable<Object[]> c) throws Exception {
         LinkedList<Object> list = new LinkedList<Object>();
         long base = getMemoryUsed();
@@ -252,7 +345,7 @@ public class MeasureMemory {
             String key = "property" + i;
             props.add(STORE.createPropertyState(key, "\"values " + i + "\""));
         }
-        return new DocumentNodeState(STORE, new String("/hello/world"),
+        return new DocumentNodeState(STORE, Path.fromString("/hello/world"),
                 new RevisionVector(new Revision(1, 2, 3)), props, false, new 
RevisionVector(new Revision(1, 2, 3)));
     }
 
@@ -289,4 +382,15 @@ public class MeasureMemory {
                 - Runtime.getRuntime().freeMemory();
     }
 
+    private static String generatePath(AtomicInteger counter) {
+        String p = "/";
+        for (int i = 0; i < 5; i++) {
+            p = PathUtils.concat(p, generateName(counter));
+        }
+        return p;
+    }
+
+    private static String generateName(AtomicInteger counter) {
+        return String.format("node-%05d", counter.getAndIncrement());
+    }
 }


Reply via email to