jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r761675 - in /jackrabbit/commons/jcr-rmi/trunk/it/src/test: java/org/apache/jackrabbit/rmi/it/RepositoryServer.java resources/test-nodetypes.xml
Date Fri, 03 Apr 2009 13:48:07 GMT
Author: jukka
Date: Fri Apr  3 13:48:07 2009
New Revision: 761675

URL: http://svn.apache.org/viewvc?rev=761675&view=rev
Log:
JCRRMI-14: Integration tests for JCR-RMI

Add TCK initialization code from jackrabbit-core.

Added:
    jackrabbit/commons/jcr-rmi/trunk/it/src/test/resources/test-nodetypes.xml   (with props)
Modified:
    jackrabbit/commons/jcr-rmi/trunk/it/src/test/java/org/apache/jackrabbit/rmi/it/RepositoryServer.java

Modified: jackrabbit/commons/jcr-rmi/trunk/it/src/test/java/org/apache/jackrabbit/rmi/it/RepositoryServer.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/it/src/test/java/org/apache/jackrabbit/rmi/it/RepositoryServer.java?rev=761675&r1=761674&r2=761675&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/it/src/test/java/org/apache/jackrabbit/rmi/it/RepositoryServer.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/it/src/test/java/org/apache/jackrabbit/rmi/it/RepositoryServer.java
Fri Apr  3 13:48:07 2009
@@ -19,13 +19,24 @@
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.rmi.server.RemoteObject;
+import java.util.Calendar;
 
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.PropertyType;
 import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
 
+import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
 import org.apache.jackrabbit.core.RepositoryImpl;
 import org.apache.jackrabbit.core.config.RepositoryConfig;
 import org.apache.jackrabbit.rmi.client.LocalAdapterFactory;
@@ -60,23 +71,31 @@
             RepositoryConfig config = RepositoryConfig.create(
                     xml, new File("target", "repository").getPath());
             server = RepositoryImpl.create(config);
+        } finally {
+            xml.close();
+        }
 
-            RemoteAdapterFactory raf = new JackrabbitServerAdapterFactory();
-            remote = raf.getRemoteRepository(server);
+        RemoteAdapterFactory raf = new JackrabbitServerAdapterFactory();
+        remote = raf.getRemoteRepository(server);
 
-            // Make sure that the remote reference survives serialization
-            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-            ObjectOutputStream oos = new ObjectOutputStream(buffer);
-            oos.writeObject(RemoteObject.toStub(remote));
-            oos.close();
-
-            ObjectInputStream ois = new ObjectInputStream(
-                    new ByteArrayInputStream(buffer.toByteArray()));
-            LocalAdapterFactory laf = new JackrabbitClientAdapterFactory();
-            client = laf.getRepository((RemoteRepository) ois.readObject());
-            ois.close();
+        // Make sure that the remote reference survives serialization
+        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+        ObjectOutputStream oos = new ObjectOutputStream(buffer);
+        oos.writeObject(RemoteObject.toStub(remote));
+        oos.close();
+
+        ObjectInputStream ois = new ObjectInputStream(
+                new ByteArrayInputStream(buffer.toByteArray()));
+        LocalAdapterFactory laf = new JackrabbitClientAdapterFactory();
+        client = laf.getRepository((RemoteRepository) ois.readObject());
+        ois.close();
+
+        Session session =
+            client.login(new SimpleCredentials("admin", "admin".toCharArray()));
+        try {
+            prepareRepositoryForConformanceTests(session);
         } finally {
-            xml.close();
+            session.logout();
         }
     }
 
@@ -88,4 +107,175 @@
         server = null;
     }
 
+    private static void prepareRepositoryForConformanceTests(Session session)
+            throws RepositoryException, IOException {
+        JackrabbitNodeTypeManager manager = (JackrabbitNodeTypeManager)
+            session.getWorkspace().getNodeTypeManager();
+        if (!manager.hasNodeType("test:versionable")) {
+            InputStream xml = RepositoryServer.class.getResourceAsStream(
+                    "/test-nodetypes.xml");
+            try {
+                manager.registerNodeTypes(
+                        xml, JackrabbitNodeTypeManager.TEXT_XML);
+            } finally {
+                xml.close();
+            }
+        }
+
+        Node data = getOrAddNode(session.getRootNode(), "testdata");
+        addPropertyTestData(getOrAddNode(data, "property"));
+        addQueryTestData(getOrAddNode(data, "query"));
+        addNodeTestData(getOrAddNode(data, "node"));
+        addExportTestData(getOrAddNode(data, "docViewTest"));
+        session.save();
+    }
+
+    private static Node getOrAddNode(Node node, String name)
+            throws RepositoryException {
+        try {
+            return node.getNode(name);
+        } catch (PathNotFoundException e) {
+            return node.addNode(name);
+        }
+    }
+
+    /**
+     * Creates a boolean, double, long, calendar and a path property at the
+     * given node.
+     */
+    private static void addPropertyTestData(Node node)
+            throws RepositoryException {
+        node.setProperty("boolean", true);
+        node.setProperty("double", Math.PI);
+        node.setProperty("long", 90834953485278298l);
+        Calendar c = Calendar.getInstance();
+        c.set(2005, 6, 18, 17, 30);
+        node.setProperty("calendar", c);
+        ValueFactory factory = node.getSession().getValueFactory();
+        node.setProperty("path", factory.createValue("/", PropertyType.PATH));
+        node.setProperty("multi", new String[] { "one", "two", "three" });
+    }
+
+    /**
+     * Creates four nodes under the given node. Each node has a String
+     * property named "prop1" with some content set.
+     */
+    private static void addQueryTestData(Node node) throws RepositoryException {
+        while (node.hasNode("node1")) {
+            node.getNode("node1").remove();
+        }
+        getOrAddNode(node, "node1").setProperty(
+                "prop1", "You can have it good, cheap, or fast. Any two.");
+        getOrAddNode(node, "node1").setProperty("prop1", "foo bar");
+        getOrAddNode(node, "node1").setProperty("prop1", "Hello world!");
+        getOrAddNode(node, "node2").setProperty("prop1", "Apache Jackrabbit");
+    }
+
+
+    /**
+     * Creates three nodes under the given node: one of type nt:resource
+     * and the other nodes referencing it.
+     */
+    private static void addNodeTestData(Node node)
+            throws RepositoryException, IOException {
+        if (node.hasNode("multiReference")) {
+            node.getNode("multiReference").remove();
+        }
+        if (node.hasNode("resReference")) {
+            node.getNode("resReference").remove();
+        }
+        if (node.hasNode("myResource")) {
+            node.getNode("myResource").remove();
+        }
+
+        Node resource = node.addNode("myResource", "nt:resource");
+        resource.setProperty("jcr:encoding", "UTF-8");
+        resource.setProperty("jcr:mimeType", "text/plain");
+        resource.setProperty(
+                "jcr:data",
+                new ByteArrayInputStream("Hello w\u00F6rld.".getBytes("UTF-8")));
+        resource.setProperty("jcr:lastModified", Calendar.getInstance());
+
+        Node resReference = getOrAddNode(node, "reference");
+        resReference.setProperty("ref", resource);
+        // make this node itself referenceable
+        resReference.addMixin("mix:referenceable");
+
+        Node multiReference = node.addNode("multiReference");
+        ValueFactory factory = node.getSession().getValueFactory();
+        multiReference.setProperty("ref", new Value[] {
+                factory.createValue(resource),
+                factory.createValue(resReference)
+            });
+    }
+
+    private static void addExportTestData(Node node)
+            throws RepositoryException, IOException {
+        getOrAddNode(node, "invalidXmlName").setProperty("propName", "some text");
+
+        // three nodes which should be serialized as xml text in docView export
+        // separated with spaces
+        getOrAddNode(node, "jcr:xmltext").setProperty(
+                "jcr:xmlcharacters", "A text without any special character.");
+        getOrAddNode(node, "some-element");
+        getOrAddNode(node, "jcr:xmltext").setProperty(
+                "jcr:xmlcharacters",
+                " The entity reference characters: <, ', ,&, >,  \" should"
+                + " be escaped in xml export. ");
+        getOrAddNode(node, "some-element");
+        getOrAddNode(node, "jcr:xmltext").setProperty(
+                "jcr:xmlcharacters", "A text without any special character.");
+
+        Node big = getOrAddNode(node, "bigNode");
+        big.setProperty(
+                "propName0",
+                "SGVsbG8gd8O2cmxkLg==;SGVsbG8gd8O2cmxkLg==".split(";"),
+                PropertyType.BINARY);
+        big.setProperty("propName1", "text 1");
+        big.setProperty(
+                "propName2",
+                "multival text 1;multival text 2;multival text 3".split(";"));
+        big.setProperty("propName3", "text 1");
+
+        addExportValues(node, "propName");
+        addExportValues(node, "Prop<>prop");
+    }
+
+    /**
+     * create nodes with following properties
+     * binary & single
+     * binary & multival
+     * notbinary & single
+     * notbinary & multival
+     */
+    private static void addExportValues(Node node, String name)
+            throws RepositoryException, IOException {
+        String prefix = "valid";
+        if (name.indexOf('<') != -1) {
+            prefix = "invalid";
+        }
+        node = getOrAddNode(node, prefix + "Names");
+
+        String[] texts = new String[] {
+                "multival text 1", "multival text 2", "multival text 3" };
+        getOrAddNode(node, prefix + "MultiNoBin").setProperty(name, texts);
+
+        Node resource = getOrAddNode(node, prefix + "MultiBin");
+        resource.setProperty("jcr:encoding", "UTF-8");
+        resource.setProperty("jcr:mimeType", "text/plain");
+        String[] values =
+            new String[] { "SGVsbG8gd8O2cmxkLg==", "SGVsbG8gd8O2cmxkLg==" };
+        resource.setProperty(name, values, PropertyType.BINARY);
+        resource.setProperty("jcr:lastModified", Calendar.getInstance());
+
+        getOrAddNode(node, prefix + "NoBin").setProperty(name,  "text 1");
+
+        resource = getOrAddNode(node, "invalidBin");
+        resource.setProperty("jcr:encoding", "UTF-8");
+        resource.setProperty("jcr:mimeType", "text/plain");
+        byte[] bytes = "Hello w\u00F6rld.".getBytes("UTF-8");
+        resource.setProperty(name, new ByteArrayInputStream(bytes));
+        resource.setProperty("jcr:lastModified", Calendar.getInstance());
+    }
+
 }

Added: jackrabbit/commons/jcr-rmi/trunk/it/src/test/resources/test-nodetypes.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/it/src/test/resources/test-nodetypes.xml?rev=761675&view=auto
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/it/src/test/resources/test-nodetypes.xml (added)
+++ jackrabbit/commons/jcr-rmi/trunk/it/src/test/resources/test-nodetypes.xml Fri Apr  3 13:48:07
2009
@@ -0,0 +1,245 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+ -->
+<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:rep="internal" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:test="http://www.apache.org/jackrabbit/test"
xmlns:mix="http://www.jcp.org/jcr/mix/1.0">
+  <nodeType name="test:versionable" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
+    <supertypes>
+      <supertype>mix:versionable</supertype>
+      <supertype>nt:base</supertype>
+    </supertypes>
+    <propertyDefinition name="*" requiredType="undefined" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="false" />
+    <propertyDefinition name="test:copyOnParentVersionProp" requiredType="String" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="false" />
+    <propertyDefinition name="test:versionOnParentVersionProp" requiredType="String" autoCreated="false"
mandatory="false" onParentVersion="VERSION" protected="false" multiple="false" />
+    <propertyDefinition name="test:initializeOnParentVersionProp" requiredType="String"
autoCreated="false" mandatory="false" onParentVersion="INITIALIZE" protected="false" multiple="false"
/>
+    <propertyDefinition name="test:computeOnParentVersionProp" requiredType="String" autoCreated="false"
mandatory="false" onParentVersion="COMPUTE" protected="false" multiple="false" />
+    <propertyDefinition name="test:ignoreOnParentVersionProp" requiredType="String" autoCreated="false"
mandatory="false" onParentVersion="IGNORE" protected="false" multiple="false" />
+    <propertyDefinition name="test:abortOnParentVersionProp" requiredType="String" autoCreated="false"
mandatory="false" onParentVersion="ABORT" protected="false" multiple="false" />
+    <childNodeDefinition name="*" defaultPrimaryType="test:versionable" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
+      <requiredPrimaryTypes>
+        <requiredPrimaryType>nt:base</requiredPrimaryType>
+      </requiredPrimaryTypes>
+    </childNodeDefinition>
+    <childNodeDefinition name="test:copyOnParentVersion" defaultPrimaryType="nt:unstructured"
autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
+      <requiredPrimaryTypes>
+        <requiredPrimaryType>nt:base</requiredPrimaryType>
+      </requiredPrimaryTypes>
+    </childNodeDefinition>
+    <childNodeDefinition name="test:versionOnParentVersion" defaultPrimaryType="nt:unstructured"
autoCreated="false" mandatory="false" onParentVersion="VERSION" protected="false" sameNameSiblings="false">
+      <requiredPrimaryTypes>
+        <requiredPrimaryType>nt:base</requiredPrimaryType>
+      </requiredPrimaryTypes>
+    </childNodeDefinition>
+    <childNodeDefinition name="test:initializeOnParentVersion" defaultPrimaryType="nt:unstructured"
autoCreated="false" mandatory="false" onParentVersion="INITIALIZE" protected="false" sameNameSiblings="false">
+      <requiredPrimaryTypes>
+        <requiredPrimaryType>nt:base</requiredPrimaryType>
+      </requiredPrimaryTypes>
+    </childNodeDefinition>
+    <childNodeDefinition name="test:computeOnParentVersion" defaultPrimaryType="nt:unstructured"
autoCreated="false" mandatory="false" onParentVersion="COMPUTE" protected="false" sameNameSiblings="false">
+      <requiredPrimaryTypes>
+        <requiredPrimaryType>nt:base</requiredPrimaryType>
+      </requiredPrimaryTypes>
+    </childNodeDefinition>
+    <childNodeDefinition name="test:ignoreOnParentVersion" defaultPrimaryType="nt:unstructured"
autoCreated="false" mandatory="false" onParentVersion="IGNORE" protected="false" sameNameSiblings="false">
+      <requiredPrimaryTypes>
+        <requiredPrimaryType>nt:base</requiredPrimaryType>
+      </requiredPrimaryTypes>
+    </childNodeDefinition>
+    <childNodeDefinition name="test:abortOnParentVersion" defaultPrimaryType="nt:unstructured"
autoCreated="false" mandatory="false" onParentVersion="ABORT" protected="false" sameNameSiblings="false">
+      <requiredPrimaryTypes>
+        <requiredPrimaryType>nt:base</requiredPrimaryType>
+      </requiredPrimaryTypes>
+    </childNodeDefinition>
+  </nodeType>
+
+  <!-- Defines a referenceable nodetype for testing purposes -->
+  <nodeType name="test:refTargetNode" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
+    <supertypes>
+      <supertype>mix:versionable</supertype>
+      <supertype>nt:base</supertype>
+    </supertypes>
+    <propertyDefinition name="*" requiredType="undefined" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="false"/>
+  </nodeType>
+
+  <!-- Defines a nodetype for tests of NodeType.canSetProperty(), Property.setValue()
and Node.setProperty() -->
+  <nodeType name="test:canSetProperty" isMixin="false" hasOrderableChildNodes="false"
primaryItemName="">
+    <supertypes>
+      <supertype>nt:base</supertype>
+    </supertypes>
+    <propertyDefinition name="String" requiredType="String" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="false"/>
+    <propertyDefinition name="StringMultiple" requiredType="String" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="true"/>
+    <propertyDefinition name="StringConstraints" requiredType="String" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+      <valueConstraints>
+        <valueConstraint>abc</valueConstraint>
+        <valueConstraint>def</valueConstraint>
+        <valueConstraint>ghi</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="StringMultipleConstraints" requiredType="String" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+      <valueConstraints>
+        <valueConstraint>abc</valueConstraint>
+        <valueConstraint>def</valueConstraint>
+        <valueConstraint>ghi</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="Binary" requiredType="Binary" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="false"/>
+    <propertyDefinition name="BinaryMultiple" requiredType="Binary" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="true"/>
+    <propertyDefinition name="BinaryConstraints" requiredType="Binary" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+      <valueConstraints>
+        <valueConstraint>(,100)</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="BinaryMultipleConstraints" requiredType="Binary" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+      <valueConstraints>
+        <valueConstraint>(,100)</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="Date" requiredType="Date" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="false"/>
+    <propertyDefinition name="DateMultiple" requiredType="Date" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="true"/>
+    <propertyDefinition name="DateConstraints" requiredType="Date" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+      <valueConstraints>
+        <valueConstraint>(1974-02-15T00:00:00.000Z,)</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="DateMultipleConstraints" requiredType="Date" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+      <valueConstraints>
+        <valueConstraint>(,1974-02-15T00:00:00.000Z)</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="Double" requiredType="Double" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="false"/>
+    <propertyDefinition name="DoubleMultiple" requiredType="Double" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="true"/>
+    <propertyDefinition name="DoubleConstraints" requiredType="Double" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+      <valueConstraints>
+        <valueConstraint>(100,)</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="DoubleMultipleConstraints" requiredType="Double" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+      <valueConstraints>
+        <valueConstraint>(,100)</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="Long" requiredType="Long" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="false"/>
+    <propertyDefinition name="LongMultiple" requiredType="Long" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="true"/>
+    <propertyDefinition name="LongConstraints" requiredType="Long" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+      <valueConstraints>
+        <valueConstraint>(100,)</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="LongMultipleConstraints" requiredType="Long" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+      <valueConstraints>
+        <valueConstraint>(,100)</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="Boolean" requiredType="Boolean" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="false"/>
+    <propertyDefinition name="BooleanMultiple" requiredType="Boolean" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="true"/>
+    <propertyDefinition name="BooleanConstraints" requiredType="Boolean" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+      <valueConstraints>
+        <valueConstraint>true</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="BooleanMultipleConstraints" requiredType="Boolean" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+      <valueConstraints>
+        <valueConstraint>true</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="Name" requiredType="Name" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="false"/>
+    <propertyDefinition name="NameMultiple" requiredType="Name" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="true"/>
+    <propertyDefinition name="NameConstraints" requiredType="Name" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+      <valueConstraints>
+        <valueConstraint>abc</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="NameMultipleConstraints" requiredType="Name" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+      <valueConstraints>
+        <valueConstraint>abc</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="Path" requiredType="Path" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="false"/>
+    <propertyDefinition name="PathMultiple" requiredType="Path" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="true"/>
+    <propertyDefinition name="PathConstraints" requiredType="Path" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+      <valueConstraints>
+        <valueConstraint>/abc</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="PathMultipleConstraints" requiredType="Path" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+      <valueConstraints>
+        <valueConstraint>/abc</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="ReferenceConstraints" requiredType="Reference" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+      <valueConstraints>
+        <valueConstraint>test:canSetProperty</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+    <propertyDefinition name="ReferenceMultipleConstraints" requiredType="Reference" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+      <valueConstraints>
+        <valueConstraint>test:canSetProperty</valueConstraint>
+      </valueConstraints>
+    </propertyDefinition>
+  </nodeType>
+
+  <!-- Defines a nodetype for testing NodeType.canAddChildNode() -->
+  <nodeType name="test:canAddChildNode" isMixin="false" hasOrderableChildNodes="false"
primaryItemName="">
+    <supertypes>
+      <supertype>nt:base</supertype>
+    </supertypes>
+    <childNodeDefinition name="testChildWithDefaultType" defaultPrimaryType="nt:base"
autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
+      <requiredPrimaryTypes>
+        <requiredPrimaryType>nt:base</requiredPrimaryType>
+      </requiredPrimaryTypes>
+    </childNodeDefinition>
+    <childNodeDefinition name="testChildWithoutDefaultType" defaultPrimaryType="" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
+      <requiredPrimaryTypes>
+        <requiredPrimaryType>nt:base</requiredPrimaryType>
+      </requiredPrimaryTypes>
+    </childNodeDefinition>
+  </nodeType>
+
+  <!-- Defines a nodetype for testing Node.setProperty(). -->
+  <nodeType name="test:setProperty" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
+    <supertypes>
+      <supertype>nt:base</supertype>
+      <supertype>mix:referenceable</supertype>
+    </supertypes>
+    <propertyDefinition name="*" requiredType="undefined" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="false" />
+    <propertyDefinition name="test:multiProperty" requiredType="undefined" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="true" />
+    <childNodeDefinition name="*" defaultPrimaryType="test:setProperty" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false" />
+  </nodeType>
+
+  <!-- Defines a nodetype to test assuming the PropertyType at Node.setProperty(). -->
+  <nodeType name="test:setPropertyAssumingType" isMixin="false" hasOrderableChildNodes="false"
primaryItemName="">
+    <supertypes>
+      <supertype>nt:base</supertype>
+    </supertypes>
+    <propertyDefinition name="test:singleProperty" requiredType="undefined" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="false" />
+    <propertyDefinition name="test:multiProperty" requiredType="undefined" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="true" />
+    <childNodeDefinition name="*" defaultPrimaryType="test:setPropertyAssumingType" autoCreated="false"
mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false" />
+  </nodeType>
+
+  <!-- Defines a nodetype with a childNodeDefinition that does not allow same name siblings
-->
+  <nodeType name="test:sameNameSibsFalseChildNodeDefinition" isMixin="false" hasOrderableChildNodes="false"
primaryItemName="">
+    <supertypes>
+      <supertype>nt:base</supertype>
+    </supertypes>
+    <propertyDefinition name="*" requiredType="undefined" autoCreated="false" mandatory="false"
onParentVersion="COPY" protected="false" multiple="false"/>
+    <childNodeDefinition name="*" defaultPrimaryType="test:sameNameSibsFalseChildNodeDefinition"
autoCreated="false" mandatory="false" onParentVersion="COMPUTE" protected="false" sameNameSiblings="false">
+      <requiredPrimaryTypes>
+        <requiredPrimaryType>nt:base</requiredPrimaryType>
+      </requiredPrimaryTypes>
+    </childNodeDefinition>
+  </nodeType>
+
+</nodeTypes>

Propchange: jackrabbit/commons/jcr-rmi/trunk/it/src/test/resources/test-nodetypes.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message