* returns true if all values and its types are convertible to DoubleValue.
*/
public void testConversionsMultiple()
throws NotExecutableException, RepositoryException {
PropertyDefinition propDef =
NodeTypeUtil.locatePropertyDef(session, PropertyType.DOUBLE, true, false, false, false);
if (propDef == null) {
throw new NotExecutableException("No multiple double property def that meets the " +
"requirements of the test has been found");
}
NodeType nodeType = propDef.getDeclaringNodeType();
Value doubleValue = NodeTypeUtil.getValueOfType(session, PropertyType.DOUBLE);
Value anyStringValue = NodeTypeUtil.getValueOfType(session, PropertyType.STRING);
Value anyStringValues[] = new Value[] {doubleValue, anyStringValue};
assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
"false if the property is of type Double and values are of type StringValue " +
"that are not convertible to DoubleValues",
nodeType.canSetProperty(propDef.getName(), anyStringValues));
Value doubleStringValue =
superuser.getValueFactory().createValue(NodeTypeUtil.getValueOfType(session, PropertyType.DOUBLE).getString());
Value doubleStringValues[] = new Value[] {doubleStringValue};
assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
"true if the property is of type Double and values are of type StringValue " +
"that are convertible to DoubleValues",
nodeType.canSetProperty(propDef.getName(), doubleStringValues));
Value anyBinaryValue = NodeTypeUtil.getValueOfType(session, PropertyType.BINARY);
Value anyBinaryValues[] = new Value[] {doubleValue, anyBinaryValue};
assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
"false if the property is of type Double and values are of type BinaryValue " +
"that are not convertible to DoubleValues",
nodeType.canSetProperty(propDef.getName(), anyBinaryValues));
Value doubleBinaryValue =
superuser.getValueFactory().createValue(NodeTypeUtil.getValueOfType(session, PropertyType.DOUBLE).getString(), PropertyType.BINARY);
Value doubleBinaryValues[] = new Value[] {doubleBinaryValue};
assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
"true if the property is of type Double and values are of type BinaryValue " +
"that are convertible to DoubleValues",
nodeType.canSetProperty(propDef.getName(), doubleBinaryValues));
Value dateValue = NodeTypeUtil.getValueOfType(session, PropertyType.DATE);
Value dateValues[] = new Value[] {dateValue};
assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
"true if the property is of type Double and values are of type DateValue",
nodeType.canSetProperty(propDef.getName(), dateValues));
Value doubleValues[] = new Value[] {doubleValue};
assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
"true if the property is of type Double and values are of type DoubleValue",
nodeType.canSetProperty(propDef.getName(), doubleValues));
Value longValue = NodeTypeUtil.getValueOfType(session, PropertyType.LONG);
Value longValues[] = new Value[] {longValue};
assertTrue("canSetProperty(String propertyName, Value[] values) must return " +
"true if the property is of type Double and values are of type LongValue",
nodeType.canSetProperty(propDef.getName(), longValues));
Value booleanValue = NodeTypeUtil.getValueOfType(session, PropertyType.BOOLEAN);
Value booleanValues[] = new Value[] {doubleValue, booleanValue};
assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
"false if the property is of type Double and values are of type BooleanValue",
nodeType.canSetProperty(propDef.getName(), booleanValues));
Value nameValue = NodeTypeUtil.getValueOfType(session, PropertyType.NAME);
Value nameValues[] = new Value[] {doubleValue, nameValue};
assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
"false if the property is of type Double and values are of type NameValue",
nodeType.canSetProperty(propDef.getName(), nameValues));
Value pathValue = NodeTypeUtil.getValueOfType(session, PropertyType.PATH);
Value pathValues[] = new Value[] {doubleValue, pathValue};
assertFalse("canSetProperty(String propertyName, Value[] values) must return " +
"false if the property is of type Double and values are of type PathValue",
nodeType.canSetProperty(propDef.getName(), pathValues));
}