jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r786028 - in /jackrabbit/trunk: jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java jackrabbit-spi2jcr/pom.xml
Date Thu, 18 Jun 2009 12:06:08 GMT
Author: angela
Date: Thu Jun 18 12:06:07 2009
New Revision: 786028

URL: http://svn.apache.org/viewvc?rev=786028&view=rev
Log:
JCR-2116:  JSR 283: Built-In Node Types

fix testcase jcr2spi that relied on jsr 170 node type definition (nt:resource extends mix:referenceable)


Modified:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java
    jackrabbit/trunk/jackrabbit-spi2jcr/pom.xml

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java?rev=786028&r1=786027&r2=786028&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java
Thu Jun 18 12:06:07 2009
@@ -19,6 +19,7 @@
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.test.NotExecutableException;
 import org.apache.jackrabbit.uuid.UUID;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
@@ -31,6 +32,8 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NodeTypeIterator;
+import javax.jcr.nodetype.NodeType;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -152,12 +155,30 @@
      * @throws IOException
      * @throws RepositoryException
      */
-    public void testEmptyMixins2() throws IOException, RepositoryException {
+    public void testEmptyMixins2() throws IOException, RepositoryException, NotExecutableException
{
         /*
-        JSR 170: nt:resource includes mix:referenceable
-        TODO: tests needs to be adjusted for JSR 283 (-> define test-property)
+        look for a a node type that includes mix:referenceable but isn't any
+        of the known internal nodetypes that ev. cannot be created through a
+        session-import
         */
-        String referenceableNt = "nt:resource";
+        String referenceableNt = null;
+        NodeTypeIterator it = superuser.getWorkspace().getNodeTypeManager().getPrimaryNodeTypes();
+        while (it.hasNext() && referenceableNt == null) {
+            NodeType nt = it.nextNodeType();
+            String ntName = nt.getName();
+            if (nt.isNodeType(mixReferenceable) &&
+                    !nt.isAbstract() &&
+                    // TODO: improve....
+                    // ignore are built-in nodetypes (mostly version related)
+                    !ntName.startsWith("nt:") &&
+                    // also skip all internal node types...
+                    !ntName.startsWith("rep:")) {
+                referenceableNt = ntName;
+            }
+        }
+        if (referenceableNt == null) {
+            throw new NotExecutableException("No primary type found that extends from mix:referenceable.");
+        }
         /*
         TODO: retrieve valid jcr:uuid value from test-properties.
         */

Modified: jackrabbit/trunk/jackrabbit-spi2jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2jcr/pom.xml?rev=786028&r1=786027&r2=786028&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2jcr/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-spi2jcr/pom.xml Thu Jun 18 12:06:07 2009
@@ -69,7 +69,6 @@
               <value>
                 org.apache.jackrabbit.jcr2spi.name.NamespaceRegistryTest#testReRegisteredNamespaceVisibility
                 org.apache.jackrabbit.jcr2spi.name.NamespaceRegistryTest#testRegisteredNamespaceVisibility
-                org.apache.jackrabbit.jcr2spi.xml.SessionImportTest#testEmptyMixins2
                 org.apache.jackrabbit.test.api.observation.EventJournalTest
                 org.apache.jackrabbit.test.api.query.OrderByDateTest
                 org.apache.jackrabbit.test.api.query.OrderByDoubleTest



Mime
View raw message