jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1138756 - in /jackrabbit/sandbox/spi2microkernel/src: main/java/org/apache/jackrabbit/spi2microkernel/util/Paths.java test/java/org/apache/jackrabbit/spi2microkernel/util/PathsTest.java
Date Thu, 23 Jun 2011 07:53:48 GMT
Author: mduerig
Date: Thu Jun 23 07:53:48 2011
New Revision: 1138756

URL: http://svn.apache.org/viewvc?rev=1138756&view=rev
Log:
spi2microkernel prototype (WIP)
path handling

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

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=1138756&r1=1138755&r2=1138756&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
Thu Jun 23 07:53:48 2011
@@ -61,15 +61,16 @@ public final class Paths {
 
     public static Path stringToPath(String path) {
         LinkedList<Element> elements = new LinkedList<Element>();
-        boolean absolute = PathUtils.isAbsolute(path);
 
-        while (!PathUtils.denotesRoot(path)) {
-            String name = PathUtils.getName(path);
+        String name = PathUtils.getName(path);
+        String parent = PathUtils.getParentPath(path);
+        while (!"".equals(name)) {
             elements.addFirst(PATH_FACTORY.createElement(stringToName(name)));
-            path = PathUtils.getParentPath(path);
+            name = PathUtils.getName(parent);
+            parent = PathUtils.getParentPath(parent);
         }
 
-        if (absolute) {
+        if ("/".equals(parent)) {
             elements.addFirst(PATH_FACTORY.getRootElement());
         }
 

Modified: jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/util/PathsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/util/PathsTest.java?rev=1138756&r1=1138755&r2=1138756&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/util/PathsTest.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/util/PathsTest.java
Thu Jun 23 07:53:48 2011
@@ -21,7 +21,6 @@ package org.apache.jackrabbit.spi2microk
 
 import org.apache.jackrabbit.spi.Path;
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class PathsTest {
@@ -42,18 +41,12 @@ public class PathsTest {
 
         p = Paths.stringToPath("/");
         Assert.assertEquals("{}", p.toString());
-    }
 
-    @Ignore  // fixme fix in microkernel
-    @Test
-    public void fixInMicrokernel() {
-        Path p = Paths.stringToPath("/foo/");
+        p = Paths.stringToPath("/foo/");
         Assert.assertEquals("{}\t{}foo", p.toString());
-    }
 
-    @Ignore  // fixme fix in microkernel
-    @Test
-    public void fixInMicrokernel2() {
-        Path p = Paths.stringToPath("/foo//");
+        p = Paths.stringToPath("/foo//");
+        Assert.assertEquals("{}\t{}foo", p.toString());
     }
+
 }



Mime
View raw message