jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1418288 - /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java
Date Fri, 07 Dec 2012 12:42:56 GMT
Author: mduerig
Date: Fri Dec  7 12:42:55 2012
New Revision: 1418288

URL: http://svn.apache.org/viewvc?rev=1418288&view=rev
Log:
OAK-498: NamePathMapper should fail on absolute paths escaping root
test cases

Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java?rev=1418288&r1=1418287&r2=1418288&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/namepath/NamePathMapperImplTest.java
Fri Dec  7 12:42:55 2012
@@ -22,9 +22,11 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.jackrabbit.oak.plugins.identifier.IdentifierManager;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
@@ -141,6 +143,45 @@ public class NamePathMapperImplTest {
         }
     }
 
+    @Ignore
+    @Test
+    public void testInvalidJcrPaths() {
+        assertNull(npMapper.getOakPath("//"));
+        assertNull(npMapper.getOakPath("/foo//"));
+        assertNull(npMapper.getOakPath("/..//"));
+        assertNull(npMapper.getOakPath("/.."));
+        assertNull(npMapper.getOakPath("/foo/../.."));
+    }
+
+    @Ignore
+    @Test
+    public void testInvalidOakPaths() {
+        getJcrPath("//");
+        getJcrPath("/foo//");
+        getJcrPath("/..//");
+        getJcrPath("/..");
+        getJcrPath("/foo/../..");
+    }
+
+    private void getJcrPath(String path) {
+        try {
+            npMapper.getJcrPath(path);
+            fail("Expected IllegalArgumentException");
+        }
+        catch (IllegalArgumentException expected) {
+        }
+    }
+
+    @Ignore
+    @Test
+    public void testValidateInvalidPaths() {
+        assertFalse(JcrPathParser.validate("//"));
+        assertFalse(JcrPathParser.validate("/foo//"));
+        assertFalse(JcrPathParser.validate("/..//"));
+        assertFalse(JcrPathParser.validate("/.."));
+        assertFalse(JcrPathParser.validate("/foo/../.."));
+    }
+
     private void checkEquals(NamePathMapper npMapper, String jcrPath) {
         String oakPath = npMapper.getOakPathKeepIndex(jcrPath);
         assertEquals(jcrPath, oakPath);



Mime
View raw message