You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by tr...@apache.org on 2005/04/28 18:27:49 UTC

svn commit: r165159 [2/2] - in /incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit: core/query/ init/ test/api/ test/api/nodetype/ test/api/observation/ test/api/query/ test/api/version/

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyLongTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyLongTest.java?rev=165159&r1=165158&r2=165159&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyLongTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyLongTest.java Thu Apr 28 09:27:46 2005
@@ -19,11 +19,9 @@
 import org.apache.jackrabbit.test.AbstractJCRTest;
 import org.apache.jackrabbit.test.NotExecutableException;
 
-import javax.jcr.BinaryValue;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
-import javax.jcr.StringValue;
 import javax.jcr.Value;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.PropertyDefinition;
@@ -84,58 +82,58 @@
         NodeType nodeType = propDef.getDeclaringNodeType();
 
 
-        Value anyStringValue = NodeTypeUtil.getValueOfType(PropertyType.STRING);
+        Value anyStringValue = NodeTypeUtil.getValueOfType(session, PropertyType.STRING);
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Long and value is a StringValue " +
                 "that is not convertible to a LongValue",
                 nodeType.canSetProperty(propDef.getName(), anyStringValue));
 
         Value longStringValue =
-                new StringValue(NodeTypeUtil.getValueOfType(PropertyType.LONG).getString());
+                superuser.getValueFactory().createValue(NodeTypeUtil.getValueOfType(session, PropertyType.LONG).getString());
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type Long and value is a StringValue " +
                 "that is convertible to a LongValue",
                 nodeType.canSetProperty(propDef.getName(), longStringValue));
 
-        Value anyBinaryValue = NodeTypeUtil.getValueOfType(PropertyType.BINARY);
+        Value anyBinaryValue = NodeTypeUtil.getValueOfType(session, PropertyType.BINARY);
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Long and value is a UTF-8 " +
                 "BinaryValue that is not convertible to a LongValue",
                 nodeType.canSetProperty(propDef.getName(), anyBinaryValue));
 
         Value longBinaryValue =
-                new BinaryValue(NodeTypeUtil.getValueOfType(PropertyType.LONG).getString());
+                superuser.getValueFactory().createValue(NodeTypeUtil.getValueOfType(session, PropertyType.LONG).getString(), PropertyType.BINARY);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type Long and value is a UTF-8 " +
                 "BinaryValue that is convertible to a LongValue",
                 nodeType.canSetProperty(propDef.getName(), longBinaryValue));
 
-        Value dateValue = NodeTypeUtil.getValueOfType(PropertyType.DATE);
+        Value dateValue = NodeTypeUtil.getValueOfType(session, PropertyType.DATE);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type Long and value is a DateValue",
                 nodeType.canSetProperty(propDef.getName(), dateValue));
 
-        Value doubleValue = NodeTypeUtil.getValueOfType(PropertyType.DOUBLE);
+        Value doubleValue = NodeTypeUtil.getValueOfType(session, PropertyType.DOUBLE);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type Long and value is a DoubleValue",
                 nodeType.canSetProperty(propDef.getName(), doubleValue));
 
-        Value longValue = NodeTypeUtil.getValueOfType(PropertyType.LONG);
+        Value longValue = NodeTypeUtil.getValueOfType(session, PropertyType.LONG);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type Long and value is a LongValue",
                 nodeType.canSetProperty(propDef.getName(), longValue));
 
-        Value booleanValue = NodeTypeUtil.getValueOfType(PropertyType.BOOLEAN);
+        Value booleanValue = NodeTypeUtil.getValueOfType(session, PropertyType.BOOLEAN);
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Long and value is a BooleanValue",
                 nodeType.canSetProperty(propDef.getName(), booleanValue));
 
-        Value nameValue = NodeTypeUtil.getValueOfType(PropertyType.NAME);
+        Value nameValue = NodeTypeUtil.getValueOfType(session, PropertyType.NAME);
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Long and value is a NameValue",
                 nodeType.canSetProperty(propDef.getName(), nameValue));
 
-        Value pathValue = NodeTypeUtil.getValueOfType(PropertyType.PATH);
+        Value pathValue = NodeTypeUtil.getValueOfType(session, PropertyType.PATH);
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Long and value is a PathValue",
                 nodeType.canSetProperty(propDef.getName(), pathValue));
@@ -159,9 +157,9 @@
         NodeType nodeType = propDef.getDeclaringNodeType();
 
 
-        Value longValue = NodeTypeUtil.getValueOfType(PropertyType.LONG);
+        Value longValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.LONG);
 
-        Value anyStringValue = NodeTypeUtil.getValueOfType(PropertyType.STRING);
+        Value anyStringValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.STRING);
         Value anyStringValues[] = new Value[] {longValue, anyStringValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Long and values are of type StringValue " +
@@ -169,14 +167,14 @@
                 nodeType.canSetProperty(propDef.getName(), anyStringValues));
 
         Value longStringValue =
-                new StringValue(NodeTypeUtil.getValueOfType(PropertyType.LONG).getString());
+                superuser.getValueFactory().createValue(NodeTypeUtil.getValueOfType(superuser, PropertyType.LONG).getString());
         Value longStringValues[] = new Value[] {longStringValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type Long and values are of type StringValue " +
                 "that are convertible to LongValues",
                 nodeType.canSetProperty(propDef.getName(), longStringValues));
 
-        Value anyBinaryValue = NodeTypeUtil.getValueOfType(PropertyType.BINARY);
+        Value anyBinaryValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.BINARY);
         Value anyBinaryValues[] = new Value[] {longValue, anyBinaryValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Long and values are of type BinaryValue " +
@@ -184,20 +182,20 @@
                 nodeType.canSetProperty(propDef.getName(), anyBinaryValues));
 
         Value longBinaryValue =
-                new BinaryValue(NodeTypeUtil.getValueOfType(PropertyType.LONG).getString());
+                superuser.getValueFactory().createValue(NodeTypeUtil.getValueOfType(superuser, PropertyType.LONG).getString(), PropertyType.BINARY);
         Value longBinaryValues[] = new Value[] {longBinaryValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type Long and values are of type BinaryValue " +
                 "that are convertible to LongValues",
                 nodeType.canSetProperty(propDef.getName(), longBinaryValues));
 
-        Value dateValue = NodeTypeUtil.getValueOfType(PropertyType.DATE);
+        Value dateValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.DATE);
         Value dateValues[] = new Value[] {dateValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type Long and values are of type DateValue",
                 nodeType.canSetProperty(propDef.getName(), dateValues));
 
-        Value doubleValue = NodeTypeUtil.getValueOfType(PropertyType.DOUBLE);
+        Value doubleValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.DOUBLE);
         Value doubleValues[] = new Value[] {doubleValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type Long and values are of type DoubleValue",
@@ -208,19 +206,19 @@
                 "true if the property is of type Long and values are of type LongValue",
                 nodeType.canSetProperty(propDef.getName(), longValues));
 
-        Value booleanValue = NodeTypeUtil.getValueOfType(PropertyType.BOOLEAN);
+        Value booleanValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.BOOLEAN);
         Value booleanValues[] = new Value[] {longValue, booleanValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Long and values are of type BooleanValue",
                 nodeType.canSetProperty(propDef.getName(), booleanValues));
 
-        Value nameValue = NodeTypeUtil.getValueOfType(PropertyType.NAME);
+        Value nameValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.NAME);
         Value nameValues[] = new Value[] {longValue, nameValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Long and values are of type NameValue",
                 nodeType.canSetProperty(propDef.getName(), nameValues));
 
-        Value pathValue = NodeTypeUtil.getValueOfType(PropertyType.PATH);
+        Value pathValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.PATH);
         Value pathValues[] = new Value[] {longValue, pathValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Long and values are of type PathValue",
@@ -242,7 +240,7 @@
                     "testable value constraints has been found");
         }
 
-        Value value = NodeTypeUtil.getValueAccordingToValueConstraints(propDef, false);
+        Value value = NodeTypeUtil.getValueAccordingToValueConstraints(superuser, propDef, false);
         if (value == null) {
             throw new NotExecutableException("No long property def with " +
                     "testable value constraints has been found");
@@ -270,7 +268,7 @@
                     "testable value constraints has been found");
         }
 
-        Value value = NodeTypeUtil.getValueAccordingToValueConstraints(propDef, false);
+        Value value = NodeTypeUtil.getValueAccordingToValueConstraints(superuser, propDef, false);
         if (value == null) {
             throw new NotExecutableException("No multiple long property def with " +
                     "testable value constraints has been found");

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyMultipleTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyMultipleTest.java?rev=165159&r1=165158&r2=165159&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyMultipleTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyMultipleTest.java Thu Apr 28 09:27:46 2005
@@ -78,7 +78,7 @@
         }
 
         NodeType nodeType = propDef.getDeclaringNodeType();
-        Value value = NodeTypeUtil.getValueOfType(propDef.getRequiredType());
+        Value value = NodeTypeUtil.getValueOfType(superuser, propDef.getRequiredType());
         Value values[] = new Value[] {value, value};
 
         assertFalse("canSetProperty(String propertyName, Value[] values) must " +
@@ -102,7 +102,7 @@
         }
 
         NodeType nodeType = propDef.getDeclaringNodeType();
-        Value value = NodeTypeUtil.getValueOfType(propDef.getRequiredType());
+        Value value = NodeTypeUtil.getValueOfType(superuser, propDef.getRequiredType());
         Value values[] = new Value[] {value};
 
         assertFalse("canSetProperty(String propertyName, Value[] values) must " +

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyNameTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyNameTest.java?rev=165159&r1=165158&r2=165159&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyNameTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyNameTest.java Thu Apr 28 09:27:46 2005
@@ -19,12 +19,9 @@
 import org.apache.jackrabbit.test.AbstractJCRTest;
 import org.apache.jackrabbit.test.NotExecutableException;
 
-import javax.jcr.BinaryValue;
-import javax.jcr.PathValue;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
-import javax.jcr.StringValue;
 import javax.jcr.Value;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.PropertyDefinition;
@@ -85,62 +82,62 @@
         NodeType nodeType = propDef.getDeclaringNodeType();
 
 
-        Value nameStringValue = new StringValue("abc");
+        Value nameStringValue = superuser.getValueFactory().createValue("abc");
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type Name and value is a StringValue " +
                 "that is convertible to a NameValue",
                 nodeType.canSetProperty(propDef.getName(), nameStringValue));
 
-        Value noNameStringValue = new StringValue("a:b:c");
+        Value noNameStringValue = superuser.getValueFactory().createValue("a:b:c");
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Name and value is a StringValue " +
                 "that is not convertible to a NameValue",
                 nodeType.canSetProperty(propDef.getName(), noNameStringValue));
 
-        Value nameBinaryValue = new BinaryValue("abc");
+        Value nameBinaryValue = superuser.getValueFactory().createValue("abc", PropertyType.BINARY);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type Name and value is a UTF-8 " +
                 "BinaryValue that is convertible to a NameValue",
                 nodeType.canSetProperty(propDef.getName(), nameBinaryValue));
 
-        Value noNameBinaryValue = new BinaryValue("a:b:c");
+        Value noNameBinaryValue = superuser.getValueFactory().createValue("a:b:c", PropertyType.BINARY);
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Name and value is a UTF-8 " +
                 "BinaryValue that is not convertible to a NameValue",
                 nodeType.canSetProperty(propDef.getName(), noNameBinaryValue));
 
-        Value dateValue = NodeTypeUtil.getValueOfType(PropertyType.DATE);
+        Value dateValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.DATE);
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Name and value is a DateValue",
                 nodeType.canSetProperty(propDef.getName(), dateValue));
 
-        Value doubleValue = NodeTypeUtil.getValueOfType(PropertyType.DOUBLE);
+        Value doubleValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.DOUBLE);
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Name and value is a DoubleValue",
                 nodeType.canSetProperty(propDef.getName(), doubleValue));
 
-        Value longValue = NodeTypeUtil.getValueOfType(PropertyType.LONG);
+        Value longValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.LONG);
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Name and value is a LongValue",
                 nodeType.canSetProperty(propDef.getName(), longValue));
 
-        Value booleanValue = NodeTypeUtil.getValueOfType(PropertyType.BOOLEAN);
+        Value booleanValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.BOOLEAN);
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Name and value is a BooleanValue",
                 nodeType.canSetProperty(propDef.getName(), booleanValue));
 
-        Value nameValue = NodeTypeUtil.getValueOfType(PropertyType.NAME);
+        Value nameValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.NAME);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type Name and value is a NameValue",
                 nodeType.canSetProperty(propDef.getName(), nameValue));
 
-        Value namePathValue = PathValue.valueOf("abc");
+        Value namePathValue = superuser.getValueFactory().createValue("abc", PropertyType.PATH);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type Name and value is a PathValue " +
                 "if Path is relative, is one element long and has no index",
                 nodeType.canSetProperty(propDef.getName(), namePathValue));
 
-        Value noNamePathValue = PathValue.valueOf("/abc");
+        Value noNamePathValue = superuser.getValueFactory().createValue("/abc", PropertyType.PATH);
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Name and value is a PathValue " +
                 "if Path is not relative, is more than one element long or has an index",
@@ -165,55 +162,55 @@
         NodeType nodeType = propDef.getDeclaringNodeType();
 
 
-        Value nameValue = NodeTypeUtil.getValueOfType(PropertyType.NAME);
+        Value nameValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.NAME);
 
-        Value nameStringValue = new StringValue("abc");
+        Value nameStringValue = superuser.getValueFactory().createValue("abc");
         Value nameStringValues[] = new Value[] {nameStringValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type Name and values are of type StringValue " +
                 "that are convertible to NameValues",
                 nodeType.canSetProperty(propDef.getName(), nameStringValues));
 
-        Value notNameStringValue = new StringValue("a:b:c");
+        Value notNameStringValue = superuser.getValueFactory().createValue("a:b:c");
         Value notNameStringValues[] = new Value[] {nameValue, notNameStringValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Name and values are of type StringValue " +
                 "that are not convertible to NameValues ",
                 nodeType.canSetProperty(propDef.getName(), notNameStringValues));
 
-        Value nameBinaryValue = new BinaryValue("abc");
+        Value nameBinaryValue = superuser.getValueFactory().createValue("abc", PropertyType.BINARY);
         Value nameBinaryValues[] = new Value[] {nameBinaryValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type Name and values are of type BinaryValue " +
                 "that are convertible to NameValues",
                 nodeType.canSetProperty(propDef.getName(), nameBinaryValues));
 
-        Value notNameBinaryValue = new BinaryValue("a:b:c");
+        Value notNameBinaryValue = superuser.getValueFactory().createValue("a:b:c", PropertyType.BINARY);
         Value notNameBinaryValues[] = new Value[] {nameValue, notNameBinaryValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Name and values are of type BinaryValue " +
                 "that are not convertible to NameValues",
                 nodeType.canSetProperty(propDef.getName(), notNameBinaryValues));
 
-        Value dateValue = NodeTypeUtil.getValueOfType(PropertyType.DATE);
+        Value dateValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.DATE);
         Value dateValues[] = new Value[] {nameValue, dateValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Name and values are of type DateValue",
                 nodeType.canSetProperty(propDef.getName(), dateValues));
 
-        Value doubleValue = NodeTypeUtil.getValueOfType(PropertyType.DOUBLE);
+        Value doubleValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.DOUBLE);
         Value doubleValues[] = new Value[] {nameValue, doubleValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Name and values are of type DoubleValue",
                 nodeType.canSetProperty(propDef.getName(), doubleValues));
 
-        Value longValue = NodeTypeUtil.getValueOfType(PropertyType.LONG);
+        Value longValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.LONG);
         Value longValues[] = new Value[] {nameValue, longValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Name and values are of type LongValue",
                 nodeType.canSetProperty(propDef.getName(), longValues));
 
-        Value booleanValue = NodeTypeUtil.getValueOfType(PropertyType.BOOLEAN);
+        Value booleanValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.BOOLEAN);
         Value booleanValues[] = new Value[] {booleanValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Name and values are of type BooleanValue",
@@ -224,14 +221,14 @@
                 "true if the property is of type Name and values are of type NameValue",
                 nodeType.canSetProperty(propDef.getName(), nameValues));
 
-        Value namePathValue = PathValue.valueOf("abc");
+        Value namePathValue = superuser.getValueFactory().createValue("abc", PropertyType.PATH);
         Value namePathValues[] = new Value[] {namePathValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type Name and values are of type PathValue " +
                 "if Path is relative, is one element long and has no index",
                 nodeType.canSetProperty(propDef.getName(), namePathValues));
 
-        Value notNamePathValue = PathValue.valueOf("/abc");
+        Value notNamePathValue =superuser.getValueFactory().createValue("/abc", PropertyType.PATH);
         Value notNamePathValues[] = new Value[] {nameValue, notNamePathValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Name and values are of type PathValue " +
@@ -254,7 +251,7 @@
                     "testable value constraints has been found");
         }
 
-        Value value = NodeTypeUtil.getValueAccordingToValueConstraints(propDef, false);
+        Value value = NodeTypeUtil.getValueAccordingToValueConstraints(superuser, propDef, false);
         if (value == null) {
             throw new NotExecutableException("No name property def with " +
                     "testable value constraints has been found");
@@ -282,7 +279,7 @@
                     "testable value constraints has been found");
         }
 
-        Value value = NodeTypeUtil.getValueAccordingToValueConstraints(propDef, false);
+        Value value = NodeTypeUtil.getValueAccordingToValueConstraints(superuser, propDef, false);
         if (value == null) {
             throw new NotExecutableException("No multiple name property def with " +
                     "testable value constraints has been found");

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyPathTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyPathTest.java?rev=165159&r1=165158&r2=165159&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyPathTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyPathTest.java Thu Apr 28 09:27:46 2005
@@ -25,9 +25,6 @@
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
-import javax.jcr.StringValue;
-import javax.jcr.BinaryValue;
-import javax.jcr.PathValue;
 import java.text.ParseException;
 
 /**
@@ -85,61 +82,61 @@
         NodeType nodeType = propDef.getDeclaringNodeType();
 
 
-        Value pathStringValue = new StringValue("abc");
+        Value pathStringValue = superuser.getValueFactory().createValue("abc");
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type Path and value is a StringValue " +
                 "that is convertible to a PathValue",
                 nodeType.canSetProperty(propDef.getName(), pathStringValue));
 
-        Value noPathStringValue = new StringValue("a:b:c");
+        Value noPathStringValue = superuser.getValueFactory().createValue("a:b:c");
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Path and value is a StringValue " +
                 "that is not convertible to a PathValue",
                 nodeType.canSetProperty(propDef.getName(), noPathStringValue));
 
-        Value pathBinaryValue = new BinaryValue("abc");
+        Value pathBinaryValue = superuser.getValueFactory().createValue("abc", PropertyType.BINARY);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type Path and value is a UTF-8 " +
                 "BinaryValue that is convertible to a PathValue",
                 nodeType.canSetProperty(propDef.getName(), pathBinaryValue));
 
-        Value noPathBinaryValue = new BinaryValue("a:b:c");
+        Value noPathBinaryValue = superuser.getValueFactory().createValue("a:b:c", PropertyType.BINARY);
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Path and value is a BinaryValue" +
                 "that is not convertible to a PathValue",
                 nodeType.canSetProperty(propDef.getName(), noPathBinaryValue));
 
-        Value dateValue = NodeTypeUtil.getValueOfType(PropertyType.DATE);
+        Value dateValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.DATE);
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Path and value is a DateValue",
                 nodeType.canSetProperty(propDef.getName(), dateValue));
 
-        Value doubleValue = NodeTypeUtil.getValueOfType(PropertyType.DOUBLE);
+        Value doubleValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.DOUBLE);
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Path and value is a DoubleValue",
                 nodeType.canSetProperty(propDef.getName(), doubleValue));
 
-        Value longValue = NodeTypeUtil.getValueOfType(PropertyType.LONG);
+        Value longValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.LONG);
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Path and value is a LongValue",
                 nodeType.canSetProperty(propDef.getName(), longValue));
 
-        Value booleanValue = NodeTypeUtil.getValueOfType(PropertyType.BOOLEAN);
+        Value booleanValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.BOOLEAN);
         assertFalse("canSetProperty(String propertyName, Value value) must return " +
                 "false if the property is of type Path and value is a BooleanValue",
                 nodeType.canSetProperty(propDef.getName(), booleanValue));
 
-        Value pathValue = NodeTypeUtil.getValueOfType(PropertyType.NAME);
+        Value pathValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.NAME);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type Path and value is a NameValue",
                 nodeType.canSetProperty(propDef.getName(), pathValue));
 
-        Value relPathValue = PathValue.valueOf("abc");
+        Value relPathValue = superuser.getValueFactory().createValue("abc", PropertyType.PATH);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type Path and value is a PathValue",
                 nodeType.canSetProperty(propDef.getName(), relPathValue));
 
-        Value absPathValue = PathValue.valueOf("/abc");
+        Value absPathValue = superuser.getValueFactory().createValue("/abc", PropertyType.PATH);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type Path and value is a PathValue",
                 nodeType.canSetProperty(propDef.getName(), absPathValue));
@@ -163,61 +160,61 @@
         NodeType nodeType = propDef.getDeclaringNodeType();
 
 
-        Value pathValue = NodeTypeUtil.getValueOfType(PropertyType.PATH);
+        Value pathValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.PATH);
 
-        Value pathStringValue = new StringValue("abc");
+        Value pathStringValue = superuser.getValueFactory().createValue("abc");
         Value pathStringValues[] = new Value[] {pathStringValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type Path and values are of type StringValue " +
                 "that are convertible to PathValues",
                 nodeType.canSetProperty(propDef.getName(), pathStringValues));
 
-        Value notPathStringValue = new StringValue("a:b:c");
+        Value notPathStringValue = superuser.getValueFactory().createValue("a:b:c");
         Value notPathStringValues[] = new Value[] {pathValue, notPathStringValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Path and values are of type StringValue " +
                 "that are not convertible to PathValues ",
                 nodeType.canSetProperty(propDef.getName(), notPathStringValues));
 
-        Value pathBinaryValue = new BinaryValue("abc");
+        Value pathBinaryValue = superuser.getValueFactory().createValue("abc", PropertyType.BINARY);
         Value pathBinaryValues[] = new Value[] {pathBinaryValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type Path and values are of type BinaryValue " +
                 "that are convertible to PathValues",
                 nodeType.canSetProperty(propDef.getName(), pathBinaryValues));
 
-        Value notPathBinaryValue = new BinaryValue("a:b:c");
+        Value notPathBinaryValue = superuser.getValueFactory().createValue("a:b:c", PropertyType.BINARY);
         Value notPathBinaryValues[] = new Value[] {pathValue, notPathBinaryValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Path and values are of type BinaryValue " +
                 "that are not convertible to PathValues",
                 nodeType.canSetProperty(propDef.getName(), notPathBinaryValues));
 
-        Value dateValue = NodeTypeUtil.getValueOfType(PropertyType.DATE);
+        Value dateValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.DATE);
         Value dateValues[] = new Value[] {pathValue, dateValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Path and values are of type DateValue",
                 nodeType.canSetProperty(propDef.getName(), dateValues));
 
-        Value doubleValue = NodeTypeUtil.getValueOfType(PropertyType.DOUBLE);
+        Value doubleValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.DOUBLE);
         Value doubleValues[] = new Value[] {pathValue, doubleValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Path and values are of type DoubleValue",
                 nodeType.canSetProperty(propDef.getName(), doubleValues));
 
-        Value longValue = NodeTypeUtil.getValueOfType(PropertyType.LONG);
+        Value longValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.LONG);
         Value longValues[] = new Value[] {pathValue, longValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Path and values are of type LongValue",
                 nodeType.canSetProperty(propDef.getName(), longValues));
 
-        Value booleanValue = NodeTypeUtil.getValueOfType(PropertyType.BOOLEAN);
+        Value booleanValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.BOOLEAN);
         Value booleanValues[] = new Value[] {booleanValue};
         assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
                 "false if the property is of type Path and values are of type BooleanValue",
                 nodeType.canSetProperty(propDef.getName(), booleanValues));
 
-        Value nameValue = NodeTypeUtil.getValueOfType(PropertyType.NAME);
+        Value nameValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.NAME);
         Value nameValues[] = new Value[] {nameValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type Path and values are of type NameValue",
@@ -244,7 +241,7 @@
                     "testable value constraints has been found");
         }
 
-        Value value = NodeTypeUtil.getValueAccordingToValueConstraints(propDef, false);
+        Value value = NodeTypeUtil.getValueAccordingToValueConstraints(superuser, propDef, false);
         if (value == null) {
             throw new NotExecutableException("No path property def with " +
                     "testable value constraints has been found");
@@ -272,7 +269,7 @@
                     "testable value constraints has been found");
         }
 
-        Value value = NodeTypeUtil.getValueAccordingToValueConstraints(propDef, false);
+        Value value = NodeTypeUtil.getValueAccordingToValueConstraints(superuser, propDef, false);
         if (value == null) {
             throw new NotExecutableException("No multiple path property def with " +
                     "testable value constraints has been found");

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyStringTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyStringTest.java?rev=165159&r1=165158&r2=165159&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyStringTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyStringTest.java Thu Apr 28 09:27:46 2005
@@ -82,44 +82,44 @@
         NodeType nodeType = propDef.getDeclaringNodeType();
 
 
-        Value stringValue = NodeTypeUtil.getValueOfType(PropertyType.STRING);
+        Value stringValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.STRING);
 
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type String and value is a StringValue",
                 nodeType.canSetProperty(propDef.getName(), stringValue));
 
-        Value binaryValue = NodeTypeUtil.getValueOfType(PropertyType.BINARY);
+        Value binaryValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.BINARY);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type String and value is a BinaryValue " +
                 "and is UTF-8",
                 nodeType.canSetProperty(propDef.getName(), binaryValue));
 
-        Value dateValue = NodeTypeUtil.getValueOfType(PropertyType.DATE);
+        Value dateValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.DATE);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type String and value is a DateValue",
                 nodeType.canSetProperty(propDef.getName(), dateValue));
 
-        Value doubleValue = NodeTypeUtil.getValueOfType(PropertyType.DOUBLE);
+        Value doubleValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.DOUBLE);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type String and value is a DoubleValue",
                 nodeType.canSetProperty(propDef.getName(), doubleValue));
 
-        Value longValue = NodeTypeUtil.getValueOfType(PropertyType.LONG);
+        Value longValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.LONG);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type String and value is a LongValue",
                 nodeType.canSetProperty(propDef.getName(), longValue));
 
-        Value booleanValue = NodeTypeUtil.getValueOfType(PropertyType.BOOLEAN);
+        Value booleanValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.BOOLEAN);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type String and value is a BooleanValue",
                 nodeType.canSetProperty(propDef.getName(), booleanValue));
 
-        Value nameValue = NodeTypeUtil.getValueOfType(PropertyType.NAME);
+        Value nameValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.NAME);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type String and value is a NameValue",
                 nodeType.canSetProperty(propDef.getName(), nameValue));
 
-        Value pathValue = NodeTypeUtil.getValueOfType(PropertyType.PATH);
+        Value pathValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.PATH);
         assertTrue("canSetProperty(String propertyName, Value value) must return " +
                 "true if the property is of type String and value is a PathValue",
                 nodeType.canSetProperty(propDef.getName(), pathValue));
@@ -143,50 +143,50 @@
         NodeType nodeType = propDef.getDeclaringNodeType();
 
 
-        Value stringValue = NodeTypeUtil.getValueOfType(PropertyType.STRING);
+        Value stringValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.STRING);
         Value stringValues[] = new Value[] {stringValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type String and values are of type StringValue",
                 nodeType.canSetProperty(propDef.getName(), stringValues));
 
-        Value binaryValue = NodeTypeUtil.getValueOfType(PropertyType.BINARY);
+        Value binaryValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.BINARY);
         Value binaryValues[] = new Value[] {binaryValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type String and values are of type BinaryValue " +
                 "and is UTF-8",
                 nodeType.canSetProperty(propDef.getName(), binaryValues));
 
-        Value dateValue = NodeTypeUtil.getValueOfType(PropertyType.DATE);
+        Value dateValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.DATE);
         Value dateValues[] = new Value[] {dateValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type String and values are of type DateValue",
                 nodeType.canSetProperty(propDef.getName(), dateValues));
 
-        Value doubleValue = NodeTypeUtil.getValueOfType(PropertyType.DOUBLE);
+        Value doubleValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.DOUBLE);
         Value doubleValues[] = new Value[] {doubleValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type String and values are of type DoubleValue",
                 nodeType.canSetProperty(propDef.getName(), doubleValues));
 
-        Value longValue = NodeTypeUtil.getValueOfType(PropertyType.LONG);
+        Value longValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.LONG);
         Value longValues[] = new Value[] {longValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type String and values are of type LongValue",
                 nodeType.canSetProperty(propDef.getName(), longValues));
 
-        Value booleanValue = NodeTypeUtil.getValueOfType(PropertyType.BOOLEAN);
+        Value booleanValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.BOOLEAN);
         Value booleanValues[] = new Value[] {booleanValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type String and values are of type BooleanValue",
                 nodeType.canSetProperty(propDef.getName(), booleanValues));
 
-        Value nameValue = NodeTypeUtil.getValueOfType(PropertyType.NAME);
+        Value nameValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.NAME);
         Value nameValues[] = new Value[] {nameValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type String and values are of type NameValue",
                 nodeType.canSetProperty(propDef.getName(), nameValues));
 
-        Value pathValue = NodeTypeUtil.getValueOfType(PropertyType.PATH);
+        Value pathValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.PATH);
         Value pathValues[] = new Value[] {pathValue};
         assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
                 "true if the property is of type String and values are of type PathValue",
@@ -208,7 +208,7 @@
                     "testable value constraints has been found");
         }
 
-        Value value = NodeTypeUtil.getValueAccordingToValueConstraints(propDef, false);
+        Value value = NodeTypeUtil.getValueAccordingToValueConstraints(superuser, propDef, false);
         if (value == null) {
             throw new NotExecutableException("No string property def with " +
                     "testable value constraints has been found");
@@ -236,7 +236,7 @@
                     "testable value constraints has been found");
         }
 
-        Value value = NodeTypeUtil.getValueAccordingToValueConstraints(propDef, false);
+        Value value = NodeTypeUtil.getValueAccordingToValueConstraints(superuser, propDef, false);
         if (value == null) {
             throw new NotExecutableException("No multiple string property def with " +
                     "testable value constraints has been found");

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyTest.java?rev=165159&r1=165158&r2=165159&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/CanSetPropertyTest.java Thu Apr 28 09:27:46 2005
@@ -77,7 +77,7 @@
         }
 
         NodeType nodeType = propDef.getDeclaringNodeType();
-        Value value = NodeTypeUtil.getValueOfType(propDef.getRequiredType());
+        Value value = NodeTypeUtil.getValueOfType(superuser, propDef.getRequiredType());
 
         assertFalse("canSetProperty(String propertyName, Value value) must " +
                 "return false if the property is protected.",
@@ -100,7 +100,7 @@
         }
 
         NodeType nodeType = propDef.getDeclaringNodeType();
-        Value value = NodeTypeUtil.getValueOfType(propDef.getRequiredType());
+        Value value = NodeTypeUtil.getValueOfType(superuser, propDef.getRequiredType());
 
         assertFalse("canSetProperty(String propertyName, Value value) must " +
                 "return false if the property is multiple.",

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/NodeTypeUtil.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/NodeTypeUtil.java?rev=165159&r1=165158&r2=165159&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/NodeTypeUtil.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/nodetype/NodeTypeUtil.java Thu Apr 28 09:27:46 2005
@@ -16,17 +16,11 @@
  */
 package org.apache.jackrabbit.test.api.nodetype;
 
-import javax.jcr.BinaryValue;
-import javax.jcr.BooleanValue;
-import javax.jcr.DateValue;
-import javax.jcr.DoubleValue;
-import javax.jcr.LongValue;
-import javax.jcr.NameValue;
-import javax.jcr.PathValue;
+import org.apache.jackrabbit.core.util.ISO8601;
+
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
-import javax.jcr.StringValue;
 import javax.jcr.Value;
 import javax.jcr.ValueFormatException;
 import javax.jcr.nodetype.NodeDefinition;
@@ -34,7 +28,6 @@
 import javax.jcr.nodetype.NodeTypeIterator;
 import javax.jcr.nodetype.NodeTypeManager;
 import javax.jcr.nodetype.PropertyDefinition;
-import javax.jcr.util.ISO8601;
 import java.util.Calendar;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -353,27 +346,28 @@
     /**
      * Returns any value of the requested type
      */
-    public static Value getValueOfType(int type) throws ValueFormatException {
+    public static Value getValueOfType(Session session, int type)
+            throws ValueFormatException, UnsupportedOperationException, RepositoryException {
         switch (type) {
             case (PropertyType.BINARY):
                 // note: If binary is not UTF-8 behavior is implementation-specific
-                return new BinaryValue("abc");
+                return session.getValueFactory().createValue("abc", PropertyType.BINARY);
             case (PropertyType.BOOLEAN):
-                return new BooleanValue(true);
+                return session.getValueFactory().createValue(true);
             case (PropertyType.DATE):
-                return new DateValue(Calendar.getInstance());
+                return session.getValueFactory().createValue(Calendar.getInstance());
             case (PropertyType.DOUBLE):
-                return new DoubleValue(1.0);
+                return session.getValueFactory().createValue(1.0);
             case (PropertyType.LONG):
-                return new LongValue(1);
+                return session.getValueFactory().createValue(1);
             case (PropertyType.NAME):
-                return NameValue.valueOf("abc");
+                return session.getValueFactory().createValue("abc", PropertyType.NAME);
             case (PropertyType.PATH):
-                return PathValue.valueOf("/abc");
+                return session.getValueFactory().createValue("/abc", PropertyType.PATH);
             default:
                 // STRING and UNDEFINED
                 // note: REFERENCE is not testable since its format is implementation-specific
-                return new StringValue("abc");
+                return session.getValueFactory().createValue("abc");
         }
     }
 
@@ -391,7 +385,8 @@
      *         <code>propDef</code> will be returned. Null will be returned if
      *         no accordant <code>Value</code> could be build.
      */
-    public static Value getValueAccordingToValueConstraints(PropertyDefinition propDef,
+    public static Value getValueAccordingToValueConstraints(Session session,
+                                                            PropertyDefinition propDef,
                                                             boolean satisfied)
             throws ValueFormatException, RepositoryException {
 
@@ -457,19 +452,19 @@
                         if (!maxBoundless && content.length() >= absMax) {
                             return null;
                         } else {
-                            return new BinaryValue(content.toString());
+                            return session.getValueFactory().createValue(content.toString(), PropertyType.BINARY);
                         }
                     } else {
                         if (!minBoundless && absMin > 1) {
                             // return a value of size < absMin
-                            return new BinaryValue("0");
+                            return session.getValueFactory().createValue("0", PropertyType.BINARY);
                         } else if (!maxBoundless) {
                             // build a binary value of size > absMax
                             StringBuffer content = new StringBuffer();
                             for (int i = 0; i <= absMax; i = i + 10) {
                                 content.append("0123456789");
                             }
-                            return new BinaryValue(content.toString());
+                            return session.getValueFactory().createValue(content.toString(), PropertyType.BINARY);
                         } else {
                             return null;
                         }
@@ -483,9 +478,9 @@
                     }
                     boolean value = Boolean.valueOf(constraints[0]).booleanValue();
                     if (satisfied) {
-                        return new BooleanValue(value);
+                        return session.getValueFactory().createValue(value);
                     } else {
-                        return new BooleanValue(!value);
+                        return session.getValueFactory().createValue(!value);
                     }
                 }
 
@@ -530,24 +525,24 @@
                             if (absMin.after(absMax)) {
                                 return null;
                             }
-                            return new DateValue(absMin);
+                            return session.getValueFactory().createValue(absMin);
                         } else if (absMax != null) {
                             absMax.setTimeInMillis(absMax.getTimeInMillis() - 1);
                             if (absMax.before(absMin)) {
                                 return null;
                             }
-                            return new DateValue(absMax);
+                            return session.getValueFactory().createValue(absMax);
                         } else {
                             // neither min nor max set: return "now"
-                            return new DateValue(Calendar.getInstance());
+                            return session.getValueFactory().createValue(Calendar.getInstance());
                         }
                     } else {
                         if (!minBoundless) {
                             absMin.setTimeInMillis(absMin.getTimeInMillis() - 1);
-                            return new DateValue(absMin);
+                            return session.getValueFactory().createValue(absMin);
                         } else if (!maxBoundless) {
                             absMax.setTimeInMillis(absMax.getTimeInMillis() + 1);
-                            return new DateValue(absMax);
+                            return session.getValueFactory().createValue(absMax);
                         } else {
                             return null;
                         }
@@ -601,20 +596,20 @@
                     }
                     if (satisfied) {
                         if (minBoundless) {
-                            return new DoubleValue(absMax - 1);
+                            return session.getValueFactory().createValue(absMax - 1.0);
                         } else if (maxBoundless) {
-                            return new DoubleValue(absMin + 1);
+                            return session.getValueFactory().createValue(absMin + 1.0);
                         } else if (absMin < absMax) {
                             double d = (absMin + absMax) / 2;
-                            return new DoubleValue(d);
+                            return session.getValueFactory().createValue(d);
                         } else {
                             return null;
                         }
                     } else {
                         if (!minBoundless) {
-                            return new DoubleValue(absMin - 1);
+                            return session.getValueFactory().createValue(absMin - 1.0);
                         } else if (!maxBoundless) {
-                            return new DoubleValue(absMax + 1);
+                            return session.getValueFactory().createValue(absMax + 1.0);
                         } else {
                             return null;
                         }
@@ -668,20 +663,20 @@
                     }
                     if (satisfied) {
                         if (minBoundless) {
-                            return new LongValue(absMax - 1);
+                            return session.getValueFactory().createValue(absMax - 1);
                         } else if (maxBoundless) {
-                            return new LongValue(absMin + 1);
+                            return session.getValueFactory().createValue(absMin + 1);
                         } else if (absMin < absMax - 1) {
                             long x = (absMin + absMax) / 2;
-                            return new LongValue(x);
+                            return session.getValueFactory().createValue(x);
                         } else {
                             return null;
                         }
                     } else {
                         if (!minBoundless) {
-                            return new LongValue(absMin - 1);
+                            return session.getValueFactory().createValue(absMin - 1);
                         } else if (!maxBoundless) {
-                            return new LongValue(absMax + 1);
+                            return session.getValueFactory().createValue(absMax + 1);
                         } else {
                             return null;
                         }
@@ -699,7 +694,7 @@
                         for (int i = 0; i < constraints.length; i++) {
                             name.append(constraints[i].replaceAll(":", ""));
                         }
-                        return NameValue.valueOf(name.toString());
+                        return session.getValueFactory().createValue(name.toString(), PropertyType.NAME);
                     }
                 }
 
@@ -722,7 +717,7 @@
                         pathStr = pathStr.replaceAll("\\*", "");
                         pathStr = pathStr.replaceAll("//", "/");
 
-                        return PathValue.valueOf(pathStr);
+                        return session.getValueFactory().createValue(pathStr, PropertyType.PATH);
                     }
                 }
 
@@ -751,7 +746,7 @@
                                 return null;
                             }
                         }
-                        return new StringValue(value.toString());
+                        return session.getValueFactory().createValue(value.toString());
                     }
                 }
         }

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/observation/PropertyChangedTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/observation/PropertyChangedTest.java?rev=165159&r1=165158&r2=165159&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/observation/PropertyChangedTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/observation/PropertyChangedTest.java Thu Apr 28 09:27:46 2005
@@ -21,8 +21,7 @@
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.PropertyType;
-import javax.jcr.StringValue;
-import javax.jcr.LongValue;
+import javax.jcr.Value;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.observation.Event;
 
@@ -116,8 +115,8 @@
             throws RepositoryException, NotExecutableException {
         Node n = testRootNode.addNode(nodeName1, testNodeType);
         NodeType nt = superuser.getWorkspace().getNodeTypeManager().getNodeType(testNodeType);
-        StringValue v1 = new StringValue("foo");
-        LongValue v2 = new LongValue(System.currentTimeMillis());
+        Value v1 = superuser.getValueFactory().createValue("foo");
+        Value v2 = superuser.getValueFactory().createValue(System.currentTimeMillis());
         if (!nt.canSetProperty(propertyName1, v1) || !nt.canSetProperty(propertyName1, v2)) {
             throw new NotExecutableException("Property " + propertyName1 + " is not of type UNDEFINED");
         }

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/AbstractQueryLevel2Test.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/AbstractQueryLevel2Test.java?rev=165159&r1=165158&r2=165159&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/AbstractQueryLevel2Test.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/query/AbstractQueryLevel2Test.java Thu Apr 28 09:27:46 2005
@@ -24,7 +24,6 @@
 import javax.jcr.Value;
 import javax.jcr.RepositoryException;
 import javax.jcr.Node;
-import javax.jcr.StringValue;
 
 /**
  * Implements common setup methods for level 2 queries.
@@ -76,7 +75,7 @@
     protected void setUpMultiValueTest() throws RepositoryException, NotExecutableException {
         // check if NodeType supports mvp
         NodeType nt = superuser.getWorkspace().getNodeTypeManager().getNodeType(testNodeType);
-        Value[] testValue = new Value[]{new StringValue("one"), new StringValue("two"), new StringValue("three")};
+        Value[] testValue = new Value[]{superuser.getValueFactory().createValue("one"), superuser.getValueFactory().createValue("two"), superuser.getValueFactory().createValue("three")};
         if (!nt.canSetProperty(propertyName2, testValue)) {
             throw new NotExecutableException("Property " + propertyName2 + " of NodeType " + testNodeType + " does not allow multi values");
         }

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/CheckinTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/CheckinTest.java?rev=165159&r1=165158&r2=165159&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/CheckinTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/CheckinTest.java Thu Apr 28 09:27:46 2005
@@ -19,7 +19,6 @@
 import javax.jcr.version.Version;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
-import javax.jcr.ReferenceValue;
 import javax.jcr.InvalidItemStateException;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import java.util.Arrays;
@@ -105,9 +104,9 @@
      */
     public void testBaseVersionAfterCheckin() throws RepositoryException {
         Version v = versionableNode.checkin();
-        ReferenceValue baseVersionRef = (ReferenceValue) versionableNode.getProperty(jcrBaseVersion).getValue();
+        Value baseVersionRef = versionableNode.getProperty(jcrBaseVersion).getValue();
 
-        assertEquals("Checked-in node's jcr:baseVersion property is set to refer to the version created on checkin.", new ReferenceValue(v), baseVersionRef);
+        assertEquals("Checked-in node's jcr:baseVersion property is set to refer to the version created on checkin.", superuser.getValueFactory().createValue(v), baseVersionRef);
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/RemoveVersionTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/RemoveVersionTest.java?rev=165159&r1=165158&r2=165159&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/RemoveVersionTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/RemoveVersionTest.java Thu Apr 28 09:27:46 2005
@@ -21,7 +21,6 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.Node;
-import javax.jcr.ReferenceValue;
 import javax.jcr.ReferentialIntegrityException;
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionException;
@@ -180,7 +179,7 @@
     public void testReferentialIntegrityException() throws RepositoryException {
         // create reference: n1.p1 -> version
         Node n1 = testRootNode.addNode(nodeName2, testNodeType);
-        n1.setProperty(propertyName1, new ReferenceValue(version));
+        n1.setProperty(propertyName1, superuser.getValueFactory().createValue(version));
         testRootNode.save();
 
         try {

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionGraphTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionGraphTest.java?rev=165159&r1=165158&r2=165159&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionGraphTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionGraphTest.java Thu Apr 28 09:27:46 2005
@@ -20,7 +20,6 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.Property;
 import javax.jcr.Value;
-import javax.jcr.ReferenceValue;
 import javax.jcr.UnsupportedRepositoryOperationException;
 
 /**
@@ -64,9 +63,9 @@
             fail("The jcr:predecessors property of a versionable node must be initialized to contain a single value");
         }
 
-        ReferenceValue initialVal = (ReferenceValue) values[0];
+        Value initialVal = values[0];
 
-        assertTrue("The jcr:predecessors property of a versionable node is initialized to contain a single UUID, that of the root version", initialVal.equals(new ReferenceValue(rV)));
+        assertTrue("The jcr:predecessors property of a versionable node is initialized to contain a single UUID, that of the root version", initialVal.equals(superuser.getValueFactory().createValue(rV)));
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionHistoryTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionHistoryTest.java?rev=165159&r1=165158&r2=165159&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionHistoryTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionHistoryTest.java Thu Apr 28 09:27:46 2005
@@ -27,7 +27,6 @@
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.PropertyIterator;
-import javax.jcr.StringValue;
 import javax.jcr.Value;
 import javax.jcr.PropertyType;
 import javax.jcr.PathNotFoundException;
@@ -731,9 +730,9 @@
 
         // create Value[] object
         Value[] vArray = new Value[3];
-        vArray[0] = new StringValue("abc");
-        vArray[1] = new StringValue("xyz");
-        vArray[2] = new StringValue("123");
+        vArray[0] = superuser.getValueFactory().createValue("abc");
+        vArray[1] = superuser.getValueFactory().createValue("xyz");
+        vArray[2] = superuser.getValueFactory().createValue("123");
 
         // create String array
         String[] s = {"abc", "xyz", "123"};
@@ -802,7 +801,7 @@
         } catch (ConstraintViolationException success) {
         }
         try {
-            Value v = new StringValue("abc");
+            Value v = superuser.getValueFactory().createValue("abc");
             vHistory.setProperty(propertyName1, v);
             vHistory.save();
             fail("VersionHistory should be read-only: VersionHistory.setProperty(String,Value) did not throw a ConstraintViolationException");

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionTest.java?rev=165159&r1=165158&r2=165159&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionTest.java Thu Apr 28 09:27:46 2005
@@ -26,10 +26,8 @@
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.PropertyIterator;
-import javax.jcr.StringValue;
 import javax.jcr.Value;
 import javax.jcr.PropertyType;
-import javax.jcr.ReferenceValue;
 
 import java.util.GregorianCalendar;
 import java.util.Calendar;
@@ -403,7 +401,7 @@
      */
     public void testGetUUID() throws Exception {
         List successorValues = Arrays.asList(versionableNode.getVersionHistory().getRootVersion().getProperty(jcrSuccessors).getValues());
-        assertTrue("Version.getUUID() did not return the right UUID", successorValues.contains(new ReferenceValue(version)));
+        assertTrue("Version.getUUID() did not return the right UUID", successorValues.contains(superuser.getValueFactory().createValue(version)));
     }
 
     /**
@@ -636,9 +634,9 @@
 
         // create Value[] object
         Value[] vArray = new Value[3];
-        vArray[0] = new StringValue("abc");
-        vArray[1] = new StringValue("xyz");
-        vArray[2] = new StringValue("123");
+        vArray[0] = superuser.getValueFactory().createValue("abc");
+        vArray[1] = superuser.getValueFactory().createValue("xyz");
+        vArray[2] = superuser.getValueFactory().createValue("123");
 
         // create String array
         String[] s = {"abc", "xyz", "123"};
@@ -707,7 +705,7 @@
         } catch (ConstraintViolationException success) {
         }
         try {
-            Value v = new StringValue("abc");
+            Value v = superuser.getValueFactory().createValue("abc");
             version.setProperty(propertyName1, v);
             version.save();
             fail("Version should be read-only: Version.setProperty(String,Value) did not throw a ConstraintViolationException");