use of org.apache.jackrabbit.spi.QPropertyDefinition in project jackrabbit by apache.
the class TestAll method testPathProperty.
/** Test for the <code>path</code> property definition type. */
public void testPathProperty() {
QPropertyDefinition def = getPropDef("propertyNodeType", "pathProperty");
assertEquals("pathProperty requiredType", PropertyType.PATH, def.getRequiredType());
assertEquals("pathProperty valueConstraints", 1, def.getValueConstraints().length);
assertEquals("pathProperty valueConstraints[0]", "{}\t{http://www.apache.org/jackrabbit/test}testPath", (def.getValueConstraints())[0].getString());
assertNull("pathProperty defaultValues", def.getDefaultValues());
}
use of org.apache.jackrabbit.spi.QPropertyDefinition in project jackrabbit by apache.
the class TestAll method getPropDef.
/**
* Returns the named property definition from the named node type
* definition. If either of the definitions do not exist, an assertion
* failure is generated.
* <p>
* If the given property name is <code>null</code>, then the residual
* property definition (if one exists) is returned.
*
* @param typeName node type name
* @param propertyName property name, or <code>null</code>
* @return property definition
*/
private QPropertyDefinition getPropDef(String typeName, String propertyName) {
Name name;
if (propertyName != null) {
name = FACTORY.create(TEST_NAMESPACE, propertyName);
} else {
name = NameConstants.ANY_NAME;
}
QNodeTypeDefinition def = getNodeType(typeName);
QPropertyDefinition[] defs = def.getPropertyDefs();
for (int i = 0; i < defs.length; i++) {
if (name.equals(defs[i].getName())) {
return defs[i];
}
}
throw new AssertionFailedError("Property " + propertyName + " does not exist");
}
use of org.apache.jackrabbit.spi.QPropertyDefinition in project jackrabbit by apache.
the class TestAll method testLongProperty.
/** Test for the <code>long</code> property definition type. */
public void testLongProperty() {
QPropertyDefinition def = getPropDef("propertyNodeType", "longProperty");
assertEquals("longProperty requiredType", PropertyType.LONG, def.getRequiredType());
assertEquals("longProperty valueConstraints", 3, def.getValueConstraints().length);
assertEquals("longProperty valueConstraints[0]", "(-10,0]", (def.getValueConstraints())[0].getString());
assertEquals("longProperty valueConstraints[1]", "[1,2]", (def.getValueConstraints())[1].getString());
assertEquals("longProperty valueConstraints[2]", "[10,100)", (def.getValueConstraints())[2].getString());
assertEquals("longProperty defaultValues", 1, def.getDefaultValues().length);
assertEquals("longProperty defaultValues[0]", "25", getDefaultValue(def, 0));
}
use of org.apache.jackrabbit.spi.QPropertyDefinition in project jackrabbit by apache.
the class TestAll method testReferenceProperty.
/** Test for the <code>reference</code> property definition type. */
public void testReferenceProperty() {
QPropertyDefinition def = getPropDef("propertyNodeType", "referenceProperty");
assertEquals("referenceProperty requiredType", PropertyType.REFERENCE, def.getRequiredType());
assertEquals("referenceProperty valueConstraints", 1, def.getValueConstraints().length);
assertEquals("referenceProperty valueConstraints[0]", "{http://www.jcp.org/jcr/nt/1.0}base", (def.getValueConstraints())[0].getString());
assertNull("referenceProperty defaultValues", def.getDefaultValues());
}
use of org.apache.jackrabbit.spi.QPropertyDefinition in project jackrabbit by apache.
the class TestAll method testAbortItem.
/** Test for the <code>abort</code> parent version action. */
public void testAbortItem() {
QPropertyDefinition def = getPropDef("itemNodeType", "abortItem");
assertEquals("abortItem onParentVersion", OnParentVersionAction.ABORT, def.getOnParentVersion());
}
Aggregations