jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r157422 - incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java
Date Mon, 14 Mar 2005 14:14:23 GMT
Author: mreutegg
Date: Mon Mar 14 06:14:20 2005
New Revision: 157422

URL: http://svn.apache.org/viewcvs?view=rev&rev=157422
Log:
Additional test cases.

Modified:
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java?view=diff&r1=157421&r2=157422
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java
Mon Mar 14 06:14:20 2005
@@ -35,6 +35,7 @@
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.nodetype.PropertyDef;
 import javax.jcr.nodetype.NodeDef;
+import javax.jcr.nodetype.NodeTypeIterator;
 import java.io.InputStream;
 import java.io.IOException;
 import java.util.Iterator;
@@ -111,6 +112,44 @@
         super.tearDown();
     }
 
+
+    /**
+     * Tests if the mandatory node type <code>nt:base</code> is supported
+     */
+    public void testNTBaseSupport()
+            throws RepositoryException {
+
+        try {
+            manager.getNodeType(ntBase);
+        } catch (NoSuchNodeTypeException e) {
+            fail("Node type nt:base must be supported.");
+        }
+    }
+
+    /**
+     * Tests if all primary node types are subtypes of node type <code>nt:base</code>
+     */
+    public void testIfPrimaryNodeTypesAreSubtypesOfNTBase()
+            throws NoSuchNodeTypeException, RepositoryException {
+
+        NodeTypeIterator types = manager.getPrimaryNodeTypes();
+
+        while (types.hasNext()) {
+            NodeType type = types.nextNodeType();
+            NodeType superTypes[] = type.getSupertypes();
+            if (!type.getName().equals(ntBase)) {
+                boolean isSubOfNTBase = false;
+                for (int i = 0; i < superTypes.length; i++) {
+                    if (superTypes[i].getName().equals(ntBase)) {
+                        isSubOfNTBase = true;
+                    }
+                }
+                assertTrue("All primary node types must be subtypes of nt:base",
+                           isSubOfNTBase);
+            }
+        }
+    }
+
     /**
      * Read and parse the xml file containing all the predefined node type
      * definitions. If predefined node types are implemented, compare the
@@ -745,4 +784,4 @@
         return true;
     }
 
-}
\ No newline at end of file
+}



Mime
View raw message