use of org.apache.jackrabbit.spi.QNodeTypeDefinition in project jackrabbit by apache.
the class LostFromCacheIssueTest method setUp.
public void setUp() throws Exception {
super.setUp();
Workspace workspace = superuser.getWorkspace();
NamespaceRegistry namespaceRegistry = workspace.getNamespaceRegistry();
NodeTypeManager ntmgr = workspace.getNodeTypeManager();
NodeTypeRegistry nodetypeRegistry = ((NodeTypeManagerImpl) ntmgr).getNodeTypeRegistry();
try {
namespaceRegistry.registerNamespace(NAMESPACE_PREFIX, NAMESPACE_URI);
} catch (NamespaceException ignore) {
//already exists
}
QNodeTypeDefinition nodeTypeDefinition = new QNodeTypeDefinitionImpl(((SessionImpl) superuser).getQName(NODETYPE_1), Name.EMPTY_ARRAY, Name.EMPTY_ARRAY, true, false, true, false, null, QPropertyDefinition.EMPTY_ARRAY, QNodeDefinition.EMPTY_ARRAY);
try {
nodetypeRegistry.registerNodeType(nodeTypeDefinition);
} catch (InvalidNodeTypeDefException ignore) {
//already exists
}
nodeTypeDefinition = new QNodeTypeDefinitionImpl(((SessionImpl) superuser).getQName(NODETYPE_2), Name.EMPTY_ARRAY, Name.EMPTY_ARRAY, true, false, true, false, null, QPropertyDefinition.EMPTY_ARRAY, QNodeDefinition.EMPTY_ARRAY);
try {
nodetypeRegistry.registerNodeType(nodeTypeDefinition);
} catch (InvalidNodeTypeDefException ignore) {
//already exists
}
getOrCreate(superuser.getRootNode(), TESTNODE_PATH);
superuser.save();
}
use of org.apache.jackrabbit.spi.QNodeTypeDefinition in project jackrabbit by apache.
the class TestAll method testMixinNodeType.
/** Test for the <code>mixin</code> node type attribute. */
public void testMixinNodeType() {
QNodeTypeDefinition def = getNodeType("mixinNodeType");
assertEquals("mixinNodeType mixin", true, def.isMixin());
}
use of org.apache.jackrabbit.spi.QNodeTypeDefinition 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.QNodeTypeDefinition in project jackrabbit by apache.
the class TestAll method testEmptyNodeType.
/** Test for the empty node type. */
public void testEmptyNodeType() {
QNodeTypeDefinition def = getNodeType("emptyNodeType");
assertNotNull("emptyNodeType exists", def);
assertEquals("emptyNodeType mixin", false, def.isMixin());
assertEquals("emptyNodeType hasOrderableChildNodes", false, def.hasOrderableChildNodes());
assertEquals("emptyNodeType primaryItemName", null, def.getPrimaryItemName());
assertEquals("emptyNodeType childNodeDefs", 0, def.getChildNodeDefs().length);
assertEquals("emptyNodeType propertyDefs", 0, def.getPropertyDefs().length);
}
use of org.apache.jackrabbit.spi.QNodeTypeDefinition in project jackrabbit by apache.
the class TestAll method testChildNodeType.
/** Test for node type child node definitions. */
public void testChildNodeType() {
QNodeTypeDefinition def = getNodeType("childNodeType");
assertEquals("childNodeType childNodeDefs", 4, def.getChildNodeDefs().length);
}
Aggregations