jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1412596 - /jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
Date Thu, 22 Nov 2012 16:01:07 GMT
Author: mduerig
Date: Thu Nov 22 16:01:06 2012
New Revision: 1412596

URL: http://svn.apache.org/viewvc?rev=1412596&view=rev
Log:
OAK-467: Include Node Type Support changes in jcr commons
regression test for OAK-299

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java?rev=1412596&r1=1412595&r2=1412596&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
Thu Nov 22 16:01:06 2012
@@ -21,6 +21,8 @@ package org.apache.jackrabbit.oak.jcr;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Calendar;
@@ -65,6 +67,8 @@ import javax.jcr.observation.Observation
 
 import com.google.common.collect.Sets;
 import org.apache.jackrabbit.JcrConstants;
+import org.apache.jackrabbit.commons.cnd.CndImporter;
+import org.apache.jackrabbit.commons.cnd.ParseException;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -1638,6 +1642,23 @@ public class RepositoryTest extends Abst
         }
     }
 
+    @Test  // Regression test for OAK-299
+    public void importNodeType() throws RepositoryException, IOException, ParseException
{
+        Session session = getAdminSession();
+        NodeTypeManager manager = session.getWorkspace().getNodeTypeManager();
+        if (!manager.hasNodeType("myNodeType")) {
+            StringBuilder defs = new StringBuilder();
+            defs.append("[\"myNodeType\"]\n");
+            defs.append("  - prop1\n");
+            defs.append("  + * (nt:base) = nt:unstructured \n");
+            Reader cndReader = new InputStreamReader(new ByteArrayInputStream(defs.toString().getBytes()));
+            CndImporter.registerNodeTypes(cndReader, session);
+        }
+
+        NodeType myNodeType = manager.getNodeType("myNodeType");
+        assertTrue(myNodeType.isNodeType("nt:base"));
+    }
+
     @Test
     public void mixin() throws RepositoryException {
         NodeTypeManager ntMgr = getAdminSession().getWorkspace().getNodeTypeManager();



Mime
View raw message