use of javax.jcr.ValueFormatException in project jackrabbit by apache.
the class MultiValuedPropertyTest method testGetStreamFromMultivalued.
/**
* Tests if Property.getStream() fails with ValueFormatException for
* multivalued properties.
*
* @throws RepositoryException
* @throws NotExecutableException
*/
public void testGetStreamFromMultivalued() throws RepositoryException, NotExecutableException {
Property prop = PropertyUtil.searchMultivalProp(testRootNode);
if (prop == null) {
throw new NotExecutableException("No multivalued property found.");
} else {
try {
prop.getStream();
fail("Property.getStream() must fail with ValueFormatException for any multivalued property.");
} catch (ValueFormatException vfe) {
// ok
}
}
}
use of javax.jcr.ValueFormatException in project jackrabbit by apache.
the class MultiValuedPropertyTest method testGetDateFromMultivalued.
/**
* Tests if Property.getDate() fails multivalued properties.
*
* @throws RepositoryException
* @throws NotExecutableException
*/
public void testGetDateFromMultivalued() throws RepositoryException, NotExecutableException {
Property prop = PropertyUtil.searchMultivalProp(testRootNode);
if (prop == null) {
throw new NotExecutableException("No multivalued property found.");
} else {
try {
prop.getDate();
fail("Property.getDate() must fail with ValueFormatException for any multivalued property.");
} catch (ValueFormatException vfe) {
// ok
}
}
}
use of javax.jcr.ValueFormatException in project jackrabbit by apache.
the class MultiValuedPropertyTest method testGetLongFromMultivalued.
/**
* Tests if Property.getLong() fails for multivalued properties.
*
* @throws RepositoryException
* @throws NotExecutableException
*/
public void testGetLongFromMultivalued() throws RepositoryException, NotExecutableException {
Property prop = PropertyUtil.searchMultivalProp(testRootNode);
if (prop == null) {
throw new NotExecutableException("No multivalued property found.");
} else {
try {
prop.getLong();
fail("Property.getLong() must fail with ValueFormatException for any multivalued property.");
} catch (ValueFormatException vfe) {
// ok
}
}
}
use of javax.jcr.ValueFormatException in project jackrabbit-oak by apache.
the class PropertyTest method testLongRequiredTypeBoolean.
public void testLongRequiredTypeBoolean() throws Exception {
try {
Property p = node.setProperty(BOOLEAN_PROP_NAME, 12345);
fail("Conversion from LONG to BOOLEAN must throw ValueFormatException");
} catch (ValueFormatException e) {
// success
}
}
use of javax.jcr.ValueFormatException in project jackrabbit-oak by apache.
the class PropertyTest method testRequiredTypeBooleanChangeDouble.
public void testRequiredTypeBooleanChangeDouble() throws Exception {
Property p = node.setProperty(BOOLEAN_PROP_NAME, true);
assertEquals(PropertyType.BOOLEAN, p.getType());
assertEquals(PropertyType.BOOLEAN, p.getValue().getType());
assertTrue(p.getBoolean());
PropertyDefinition def = p.getDefinition();
assertEquals(PropertyType.BOOLEAN, def.getRequiredType());
assertEquals(NT_NAME, def.getDeclaringNodeType().getName());
superuser.save();
try {
p.setValue(24.4);
fail("Conversion from DOUBLE to BOOLEAN must throw ValueFormatException");
} catch (ValueFormatException e) {
// success
}
try {
node.setProperty(BOOLEAN_PROP_NAME, 24.4);
fail("Conversion from DOUBLE to BOOLEAN must throw ValueFormatException");
} catch (ValueFormatException e) {
// success
}
}
Aggregations