jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r577867 - in /jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api: ./ query/
Date Thu, 20 Sep 2007 18:45:14 GMT
Author: jukka
Date: Thu Sep 20 11:45:13 2007
New Revision: 577867

URL: http://svn.apache.org/viewvc?rev=577867&view=rev
Log:
1.3: Merged revision 570564 (JCR-1095)

Modified:
    jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/AbstractPropertyTest.java
    jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/BinaryPropertyTest.java
    jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/BooleanPropertyTest.java
    jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/DatePropertyTest.java
    jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/DoublePropertyTest.java
    jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/LongPropertyTest.java
    jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamePropertyTest.java
    jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/PathPropertyTest.java
    jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/PropertyUtil.java
    jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ReferencePropertyTest.java
    jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/StringPropertyTest.java
    jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/UndefinedPropertyTest.java
    jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/DerefQueryLevel1Test.java

Modified: jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/AbstractPropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/AbstractPropertyTest.java?rev=577867&r1=577866&r2=577867&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/AbstractPropertyTest.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/AbstractPropertyTest.java
Thu Sep 20 11:45:13 2007
@@ -46,6 +46,12 @@
      * values defined in {@link javax.jcr.PropertyType}.
      */
     protected abstract int getPropertyType();
+    
+    /**
+     * Concrete subclasses return the multivalued-ness of property they test.
+     * (<code>null</code>: does not matter)
+     */
+    protected abstract Boolean getPropertyIsMultivalued();
 
     /**
      * Sets up the fixture for the tests.
@@ -55,7 +61,7 @@
         super.setUp();
         session = helper.getReadOnlySession();
 
-        prop = PropertyUtil.searchProp(session, session.getRootNode().getNode(testPath),
getPropertyType());
+        prop = PropertyUtil.searchProp(session, session.getRootNode().getNode(testPath),
getPropertyType(), getPropertyIsMultivalued());
         if (prop == null) {
             cleanUp();
             String msg = "Workspace does not contain a node with a " +

Modified: jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/BinaryPropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/BinaryPropertyTest.java?rev=577867&r1=577866&r2=577867&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/BinaryPropertyTest.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/BinaryPropertyTest.java
Thu Sep 20 11:45:13 2007
@@ -46,6 +46,14 @@
     }
 
     /**
+     * Returns "does not matter" (<code>null</code>).
+     * @return <code>null</code>.
+     */
+    protected Boolean getPropertyIsMultivalued() {
+        return null;
+    }
+
+    /**
      * Tests that when Value.getStream() is called a second time the same Stream
      * object is returned. Also tests that when a new Value object is requested
      * also a new Stream object is returned by calling getStream() on the new

Modified: jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/BooleanPropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/BooleanPropertyTest.java?rev=577867&r1=577866&r2=577867&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/BooleanPropertyTest.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/BooleanPropertyTest.java
Thu Sep 20 11:45:13 2007
@@ -46,6 +46,14 @@
     }
 
     /**
+     * Returns "does not matter" (<code>null</code>).
+     * @return <code>null</code>.
+     */
+    protected Boolean getPropertyIsMultivalued() {
+        return null;
+    }
+
+    /**
      * Tests that Property.getBoolean() delivers the same as Value.getBoolean()
      * and that in case of a multivalue property Property.getBoolean() throws a
      * ValueFormatException.

Modified: jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/DatePropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/DatePropertyTest.java?rev=577867&r1=577866&r2=577867&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/DatePropertyTest.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/DatePropertyTest.java
Thu Sep 20 11:45:13 2007
@@ -46,6 +46,14 @@
     }
 
     /**
+     * Returns "does not matter" (<code>null</code>).
+     * @return <code>null</code>.
+     */
+    protected Boolean getPropertyIsMultivalued() {
+        return null;
+    }
+
+    /**
      * Tests that Property.getDate() delivers the same as Value.getDate() and
      * that in case of a multivalue property a ValueFormatException is thrown.
      */

Modified: jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/DoublePropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/DoublePropertyTest.java?rev=577867&r1=577866&r2=577867&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/DoublePropertyTest.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/DoublePropertyTest.java
Thu Sep 20 11:45:13 2007
@@ -47,6 +47,14 @@
     }
 
     /**
+     * Returns "does not matter" (<code>null</code>).
+     * @return <code>null</code>.
+     */
+    protected Boolean getPropertyIsMultivalued() {
+        return null;
+    }
+
+    /**
      * tests that Property.getDouble() delivers the same as Value.getDouble()
      * and if in case of a multivalue property a ValueFormatException is
      * thrown.

Modified: jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/LongPropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/LongPropertyTest.java?rev=577867&r1=577866&r2=577867&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/LongPropertyTest.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/LongPropertyTest.java
Thu Sep 20 11:45:13 2007
@@ -47,6 +47,14 @@
     }
 
     /**
+     * Returns "does not matter" (<code>null</code>).
+     * @return <code>null</code>.
+     */
+    protected Boolean getPropertyIsMultivalued() {
+        return null;
+    }
+
+    /**
      * Tests that Property.getLong() delivers the same as Value.getLong() and if
      * in case of a multivalue property a ValueFormatException is thrown.
      */

Modified: jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamePropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamePropertyTest.java?rev=577867&r1=577866&r2=577867&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamePropertyTest.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamePropertyTest.java
Thu Sep 20 11:45:13 2007
@@ -43,6 +43,14 @@
     }
 
     /**
+     * Returns "does not matter" (<code>null</code>).
+     * @return <code>null</code>.
+     */
+    protected Boolean getPropertyIsMultivalued() {
+        return null;
+    }
+
+    /**
      * Tests conversion from Name type to String type.
      *
      * @throws RepositoryException

Modified: jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/PathPropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/PathPropertyTest.java?rev=577867&r1=577866&r2=577867&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/PathPropertyTest.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/PathPropertyTest.java
Thu Sep 20 11:45:13 2007
@@ -43,6 +43,14 @@
     }
 
     /**
+     * Returns "does not matter" (<code>null</code>).
+     * @return <code>null</code>.
+     */
+    protected Boolean getPropertyIsMultivalued() {
+        return null;
+    }
+
+    /**
      * Tests conversion from Path type to String type and if the resulting
      * string has correct format.
      */

Modified: jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/PropertyUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/PropertyUtil.java?rev=577867&r1=577866&r2=577867&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/PropertyUtil.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/PropertyUtil.java
Thu Sep 20 11:45:13 2007
@@ -146,9 +146,10 @@
      *
      * @param node the node to start traverse
      * @param type the property type to search for
+     * @param multiple whether the property should be multivalued (<code>null</code>:
does not matter)
      * @return the property found or null if no property is found
      */
-    public static Property searchProp(Session session, Node node, int type)
+    public static Property searchProp(Session session, Node node, int type, Boolean multiple)
             throws RepositoryException, ValueFormatException {
 
         Property prop = null;
@@ -157,7 +158,7 @@
             for (PropertyIterator props = node.getProperties(); props.hasNext();) {
                 Property property = props.nextProperty();
                 propType = property.getType();
-                if (propType == type) {
+                if (propType == type && (multiple == null || multiple.booleanValue()
== property.getDefinition().isMultiple())) {
                     prop = property;
                     break;
                 }
@@ -166,7 +167,7 @@
         if (prop == null) {
             for (NodeIterator nodes = node.getNodes(); nodes.hasNext();) {
                 Node n = nodes.nextNode();
-                prop = searchProp(session, n, type);
+                prop = searchProp(session, n, type, multiple);
                 if (prop != null) {
                     break;
                 }

Modified: jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ReferencePropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ReferencePropertyTest.java?rev=577867&r1=577866&r2=577867&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ReferencePropertyTest.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ReferencePropertyTest.java
Thu Sep 20 11:45:13 2007
@@ -56,6 +56,14 @@
     }
 
     /**
+     * Returns {@link Boolean#FALSE}.
+     * @return {@link Boolean#FALSE}.
+     */
+    protected Boolean getPropertyIsMultivalued() {
+        return Boolean.FALSE;
+    }
+
+    /**
      * Tests if the referenced node is of nodeType mix:referenceable.
      */
     public void testNodeType() throws RepositoryException {

Modified: jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/StringPropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/StringPropertyTest.java?rev=577867&r1=577866&r2=577867&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/StringPropertyTest.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/StringPropertyTest.java
Thu Sep 20 11:45:13 2007
@@ -77,6 +77,14 @@
     }
 
     /**
+     * Returns "does not matter" (<code>null</code>).
+     * @return <code>null</code>.
+     */
+    protected Boolean getPropertyIsMultivalued() {
+        return null;
+    }
+
+    /**
      * Tests that Property.getString() delivers a string equal to the string
      * received with Value.getString().
      */

Modified: jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/UndefinedPropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/UndefinedPropertyTest.java?rev=577867&r1=577866&r2=577867&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/UndefinedPropertyTest.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/UndefinedPropertyTest.java
Thu Sep 20 11:45:13 2007
@@ -44,12 +44,20 @@
     }
 
     /**
+     * Returns "does not matter" (<code>null</code>).
+     * @return <code>null</code>.
+     */
+    protected Boolean getPropertyIsMultivalued() {
+        return null;
+    }
+
+    /**
      * Tests that no actual property with type Undefined exists.
      */
     public void testUndefinedProperty() throws RepositoryException {
         Session session = helper.getReadOnlySession();
         try {
-            Property prop = PropertyUtil.searchProp(session, session.getRootNode().getNode(testPath),
PropertyType.UNDEFINED);
+            Property prop = PropertyUtil.searchProp(session, session.getRootNode().getNode(testPath),
PropertyType.UNDEFINED, null);
             assertNull("Property with type Undefined found.", prop);
         } finally {
             session.logout();

Modified: jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/DerefQueryLevel1Test.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/DerefQueryLevel1Test.java?rev=577867&r1=577866&r2=577867&view=diff
==============================================================================
--- jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/DerefQueryLevel1Test.java
(original)
+++ jackrabbit/branches/1.3/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/DerefQueryLevel1Test.java
Thu Sep 20 11:45:13 2007
@@ -68,7 +68,7 @@
      */
     public void testDerefSinglePropWithNodeTest()
             throws RepositoryException, NotExecutableException {
-        Property refProp = PropertyUtil.searchProp(session, testRootNode, PropertyType.REFERENCE);
+        Property refProp = PropertyUtil.searchProp(session, testRootNode, PropertyType.REFERENCE,
Boolean.FALSE);
         if (refProp == null) {
             throw new NotExecutableException("Workspace does not contain a node with a reference
property.");
         }
@@ -85,7 +85,7 @@
      */
     public void testDerefSinglePropWithNodeStar()
             throws RepositoryException, NotExecutableException {
-        Property refProp = PropertyUtil.searchProp(session, testRootNode, PropertyType.REFERENCE);
+        Property refProp = PropertyUtil.searchProp(session, testRootNode, PropertyType.REFERENCE,
Boolean.FALSE);
         if (refProp == null) {
             throw new NotExecutableException("Workspace does not contain a node with a reference
property.");
         }



Mime
View raw message