You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2007/08/15 18:28:13 UTC

svn commit: r566247 - in /jackrabbit/trunk: jackrabbit-core/src/test/resources/repositoryStubImpl.properties jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetPropertyAssumeTypeTest.java

Author: reschke
Date: Wed Aug 15 09:28:11 2007
New Revision: 566247

URL: http://svn.apache.org/viewvc?view=rev&rev=566247
Log:
JCR-811: change various tests in SetPropertyAssumeTypeTest.java so that they use config variables instead of trying to dynamically find a property type to use (affects test config!).

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/resources/repositoryStubImpl.properties
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetPropertyAssumeTypeTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/resources/repositoryStubImpl.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/resources/repositoryStubImpl.properties?view=diff&rev=566247&r1=566246&r2=566247
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/resources/repositoryStubImpl.properties (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/resources/repositoryStubImpl.properties Wed Aug 15 09:28:11 2007
@@ -116,6 +116,12 @@
 javax.jcr.tck.SetValueValueFormatExceptionTest.testBoolean.propertyname1=Date
 javax.jcr.tck.SetValueValueFormatExceptionTest.testNode.propertyname1=Boolean
 
+# Test class: SetPropertyAssumeTypeTest
+javax.jcr.tck.SetPropertyAssumeTypeTest.nodetype=test:canSetProperty
+javax.jcr.tck.SetPropertyAssumeTypeTest.testStringConstraintViolationExceptionBecauseOfInvalidTypeParameter.propertyname1=String
+javax.jcr.tck.SetPropertyAssumeTypeTest.testValueConstraintViolationExceptionBecauseOfInvalidTypeParameter.propertyname1=String
+javax.jcr.tck.SetPropertyAssumeTypeTest.testValuesConstraintViolationExceptionBecauseOfInvalidTypeParameter.propertyname1=StringMultiple
+
 # Test class: UndefinedPropertyTest
 javax.jcr.tck.UndefinedPropertyTest.testroot=/testdata
 

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetPropertyAssumeTypeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetPropertyAssumeTypeTest.java?view=diff&rev=566247&r1=566246&r2=566247
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetPropertyAssumeTypeTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetPropertyAssumeTypeTest.java Wed Aug 15 09:28:11 2007
@@ -68,6 +68,7 @@
 
     public void setUp() throws Exception {
         super.setUp();
+        testNode = testRootNode.addNode(nodeName1, testNodeType);
 
         binaryValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.BINARY);
         booleanValue = NodeTypeUtil.getValueOfType(superuser, PropertyType.BOOLEAN);
@@ -432,24 +433,11 @@
     public void testValueConstraintViolationExceptionBecauseOfInvalidTypeParameter()
         throws NotExecutableException, RepositoryException {
 
-        // locate a property definition of type string
-        PropertyDefinition propDef =
-                NodeTypeUtil.locatePropertyDef(superuser, PropertyType.STRING, false, false, false, false);
-
-        if (propDef == null) {
-            throw new NotExecutableException("No testable property has been found.");
-        }
-
-        // create a node of type propDef.getDeclaringNodeType()
-        String nodeType = propDef.getDeclaringNodeType().getName();
-        Node testNode = testRootNode.addNode(nodeName1, nodeType);
-        String testPropName = propDef.getName();
-
         try {
             Calendar cal = Calendar.getInstance();
             cal.setTime(new Date(0));
             Value v = superuser.getValueFactory().createValue(ISO8601.format(cal));
-            testNode.setProperty(testPropName, v, PropertyType.DATE);
+            testNode.setProperty(propertyName1, v, PropertyType.DATE);
             testRootNode.save();
             fail("Node.setProperty(String, Value, int) must throw a " +
                  "ConstraintViolationExcpetion if the type parameter and the " +
@@ -469,23 +457,10 @@
     public void testStringConstraintViolationExceptionBecauseOfInvalidTypeParameter()
         throws NotExecutableException, RepositoryException {
 
-        // locate a property definition of type string
-        PropertyDefinition propDef =
-                NodeTypeUtil.locatePropertyDef(superuser, PropertyType.STRING, false, false, false, false);
-
-        if (propDef == null) {
-            throw new NotExecutableException("No testable property has been found.");
-        }
-
-        // create a node of type propDef.getDeclaringNodeType()
-        String nodeType = propDef.getDeclaringNodeType().getName();
-        Node testNode = testRootNode.addNode(nodeName1, nodeType);
-        String testPropName = propDef.getName();
-
         try {
             Calendar cal = Calendar.getInstance();
             cal.setTime(new Date(0));
-            testNode.setProperty(testPropName, ISO8601.format(cal), PropertyType.DATE);
+            testNode.setProperty(propertyName1, ISO8601.format(cal), PropertyType.DATE);
             testRootNode.save();
             fail("Node.setProperty(String, Value, int) must throw a " +
                  "ConstraintViolationExcpetion if the type parameter and the " +
@@ -505,21 +480,8 @@
     public void testValuesConstraintViolationExceptionBecauseOfInvalidTypeParameter()
         throws NotExecutableException, RepositoryException {
 
-        // locate a property definition of type string
-        PropertyDefinition propDef =
-                NodeTypeUtil.locatePropertyDef(superuser, PropertyType.STRING, true, false, false, false);
-
-        if (propDef == null) {
-            throw new NotExecutableException("No testable property has been found.");
-        }
-
-        // create a node of type propDef.getDeclaringNodeType()
-        String nodeType = propDef.getDeclaringNodeType().getName();
-        Node testNode = testRootNode.addNode(nodeName1, nodeType);
-        String testPropName = propDef.getName();
-
         try {
-            testNode.setProperty(testPropName, stringValues, PropertyType.DATE);
+            testNode.setProperty(propertyName1, stringValues, PropertyType.DATE);
             testRootNode.save();
             fail("Node.setProperty(String, Value, int) must throw a " +
                     "ConstraintViolationExcpetion or a ValueFormatException if " +