incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r697080 - in /incubator/sling/trunk/jcr/resource/src: main/resources/SLING-INF/nodetypes/folder.cnd test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
Date Fri, 19 Sep 2008 13:05:37 GMT
Author: fmeschbe
Date: Fri Sep 19 06:05:36 2008
New Revision: 697080

URL: http://svn.apache.org/viewvc?rev=697080&view=rev
Log:
SLING-663 Change the required primary type of sling:Folder and
sling:OrderedFolder to nt:base to enable creating any node
below a sling:[Ordered]Folder. Still the default type is
sling:[Ordered]Folder. Also added a simple testcase for this.

Modified:
    incubator/sling/trunk/jcr/resource/src/main/resources/SLING-INF/nodetypes/folder.cnd
    incubator/sling/trunk/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java

Modified: incubator/sling/trunk/jcr/resource/src/main/resources/SLING-INF/nodetypes/folder.cnd
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/resources/SLING-INF/nodetypes/folder.cnd?rev=697080&r1=697079&r2=697080&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/resources/SLING-INF/nodetypes/folder.cnd (original)
+++ incubator/sling/trunk/jcr/resource/src/main/resources/SLING-INF/nodetypes/folder.cnd Fri
Sep 19 06:05:36 2008
@@ -26,7 +26,7 @@
 [sling:Folder] > nt:folder
   - * (undefined) multiple
   - * (undefined)
-  + * (nt:hierarchyNode) = sling:Folder version
+  + * (nt:base) = sling:Folder version
 
 
 //-----------------------------------------------------------------------------
@@ -43,4 +43,4 @@
 // (See SLING-663)
 [sling:OrderedFolder] > sling:Folder
     orderable
-  + * (nt:hierarchyNode) = sling:OrderedFolder version 
+  + * (nt:base) = sling:OrderedFolder version 

Modified: incubator/sling/trunk/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java?rev=697080&r1=697079&r2=697080&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
(original)
+++ incubator/sling/trunk/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
Fri Sep 19 06:05:36 2008
@@ -27,6 +27,7 @@
 
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.Node;
+import javax.jcr.RepositoryException;
 import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletInputStream;
 import javax.servlet.http.Cookie;
@@ -212,6 +213,36 @@
         testStarResourceHelper(path, "DELETE");
     }
 
+    public void testSlingFolder() throws Exception {
+        
+        // create a folder
+        String folderPath = "folder";
+        Node folder = rootNode.addNode(folderPath, "sling:Folder");
+        rootNode.save();
+        
+        // test default child node type
+        Node child = folder.addNode("child0");
+        folder.save();
+        assertEquals("sling:Folder", child.getPrimaryNodeType().getName());
+        
+        // test explicit sling:Folder child
+        child = folder.addNode("child1", "sling:Folder");
+        folder.save();
+        assertEquals("sling:Folder", child.getPrimaryNodeType().getName());
+        
+        // test explicit nt:folder child
+        child = folder.addNode("child2", "nt:folder");
+        folder.save();
+        assertEquals("nt:folder", child.getPrimaryNodeType().getName());
+        
+        // test any child node -- use nt:unstructured here
+        child = folder.addNode("child3", "nt:unstructured");
+        folder.save();
+        assertEquals("nt:unstructured", child.getPrimaryNodeType().getName());
+    }
+    
+    //---------- internal
+    
     private void testStarResourceHelper(final String path, final String method) {
         final Resource res = resResolver.resolve(new ResourceResolverTestRequest(path, method));
         assertNotNull(res);



Mime
View raw message