jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r591371 - in /jackrabbit/trunk/jackrabbit-core/src/test: java/org/apache/jackrabbit/core/integration/ java/org/apache/jackrabbit/core/query/ repository/repository/ resources/org/apache/jackrabbit/core/integration/
Date Fri, 02 Nov 2007 15:50:14 GMT
Author: jukka
Date: Fri Nov  2 08:50:12 2007
New Revision: 591371

URL: http://svn.apache.org/viewvc?rev=591371&view=rev
Log:
JCR-1203: Reorganize core test suite
    - Initialize test namespaces and node types using the proper APIs

Added:
    jackrabbit/trunk/jackrabbit-core/src/test/resources/org/apache/jackrabbit/core/integration/
    jackrabbit/trunk/jackrabbit-core/src/test/resources/org/apache/jackrabbit/core/integration/test-nodetypes.xml
      - copied, changed from r591253, jackrabbit/trunk/jackrabbit-core/src/test/repository/repository/nodetypes/custom_nodetypes.xml
Removed:
    jackrabbit/trunk/jackrabbit-core/src/test/repository/repository/
Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/PrepareTestRepository.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/MixinTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/PrepareTestRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/PrepareTestRepository.java?rev=591371&r1=591370&r2=591371&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/PrepareTestRepository.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/PrepareTestRepository.java
Fri Nov  2 08:50:12 2007
@@ -18,6 +18,7 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.Calendar;
 
 import javax.jcr.Node;
@@ -27,6 +28,7 @@
 import javax.jcr.Value;
 import javax.jcr.ValueFactory;
 
+import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
 import org.apache.jackrabbit.test.AbstractJCRTest;
 
 /**
@@ -40,6 +42,15 @@
 
     public void testPrepareTestRepository()
             throws RepositoryException, IOException {
+        InputStream xml = getClass().getResourceAsStream("test-nodetypes.xml");
+        try {
+            JackrabbitNodeTypeManager manager = (JackrabbitNodeTypeManager)
+            superuser.getWorkspace().getNodeTypeManager();
+            manager.registerNodeTypes(xml, JackrabbitNodeTypeManager.TEXT_XML);
+        } finally {
+            xml.close();
+        }
+
         Node data = getOrAddNode(superuser.getRootNode(), "testdata");
         addPropertyTestData(getOrAddNode(data, "property"));
         addQueryTestData(getOrAddNode(data, "query"));

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/MixinTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/MixinTest.java?rev=591371&r1=591370&r2=591371&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/MixinTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/MixinTest.java
Fri Nov  2 08:50:12 2007
@@ -16,8 +16,13 @@
  */
 package org.apache.jackrabbit.core.query;
 
+import javax.jcr.NamespaceException;
+import javax.jcr.NamespaceRegistry;
 import javax.jcr.RepositoryException;
 import javax.jcr.Node;
+
+import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
+
 import java.io.ByteArrayInputStream;
 import java.util.Calendar;
 
@@ -25,6 +30,21 @@
  * Tests if mixin types are queried correctly when using element test: element()
  */
 public class MixinTest extends AbstractQueryTest {
+
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        JackrabbitNodeTypeManager manager = (JackrabbitNodeTypeManager)
+            superuser.getWorkspace().getNodeTypeManager();
+        if (!manager.hasNodeType("test:referenceable")) {
+            String cnd =
+                "<test='http://www.apache.org/jackrabbit/test'>\n"
+                + "[test:referenceable] > mix:referenceable mixin";
+            manager.registerNodeTypes(
+                    new ByteArrayInputStream(cnd.getBytes()),
+                    JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
+        }
+    }
 
     public void testBuiltInMixin() throws RepositoryException {
         // nt:resoure is referenceable by its node type definition

Copied: jackrabbit/trunk/jackrabbit-core/src/test/resources/org/apache/jackrabbit/core/integration/test-nodetypes.xml
(from r591253, jackrabbit/trunk/jackrabbit-core/src/test/repository/repository/nodetypes/custom_nodetypes.xml)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/resources/org/apache/jackrabbit/core/integration/test-nodetypes.xml?p2=jackrabbit/trunk/jackrabbit-core/src/test/resources/org/apache/jackrabbit/core/integration/test-nodetypes.xml&p1=jackrabbit/trunk/jackrabbit-core/src/test/repository/repository/nodetypes/custom_nodetypes.xml&r1=591253&r2=591371&rev=591371&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/repository/repository/nodetypes/custom_nodetypes.xml
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/resources/org/apache/jackrabbit/core/integration/test-nodetypes.xml
Fri Nov  2 08:50:12 2007
@@ -242,16 +242,4 @@
     </childNodeDefinition>
   </nodeType>
 
-
-  <!-- ======================================================== -->
-  <!-- Node type definitions only required for jackrabbit core  -->
-  <!-- (internal) test cases.                                   -->
-  <!-- ======================================================== -->
-
-  <!-- Defines a mixin node type that extends mix:referenceable -->
-  <nodeType isMixin="true" name="test:referenceable" hasOrderableChildNodes="false" primaryItemName="">
-    <supertypes>
-      <supertype>mix:referenceable</supertype>
-    </supertypes>
-  </nodeType>
 </nodeTypes>



Mime
View raw message