use of org.apache.jackrabbit.spi.QNodeTypeDefinition in project jackrabbit by apache.
the class ClusterRecordTest method testNodeTypeReregistration.
/**
* Test producing and consuming a node type reregistration.
* @throws Exception
*/
public void testNodeTypeReregistration() throws Exception {
QNodeTypeDefinitionBuilder ntd = new QNodeTypeDefinitionBuilder();
ntd.setName(NameFactoryImpl.getInstance().create("", "test"));
ntd.setSupertypes(new Name[] { NameConstants.NT_BASE });
ArrayList<QNodeTypeDefinition> list = new ArrayList<QNodeTypeDefinition>();
list.add(ntd.build());
NodeTypeEvent event = new NodeTypeEvent(NodeTypeEvent.REREGISTER, list);
master.reregistered(ntd.build());
SimpleEventListener listener = new SimpleEventListener();
slave.setListener((NodeTypeEventListener) listener);
slave.sync();
assertEquals(1, listener.getClusterEvents().size());
assertEquals(listener.getClusterEvents().get(0), event);
}
use of org.apache.jackrabbit.spi.QNodeTypeDefinition in project jackrabbit by apache.
the class TestAll method testItemNodeType.
/**
* Test for node type item definitions.
*/
public void testItemNodeType() {
QNodeTypeDefinition def = getNodeType("itemNodeType");
assertEquals("itemNodeType primaryItemName", FACTORY.create(TEST_NAMESPACE, "emptyItem"), def.getPrimaryItemName());
assertEquals("itemNodeType propertyDefs", 10, def.getPropertyDefs().length);
QPropertyDefinition pdef = getPropDef("itemNodeType", null);
assertTrue("itemNodeType wildcard property", pdef.definesResidual());
}
use of org.apache.jackrabbit.spi.QNodeTypeDefinition in project jackrabbit by apache.
the class TestAll method testPropertyNodeType.
/**
* Test for node type property definitions.
*/
public void testPropertyNodeType() {
QNodeTypeDefinition def = getNodeType("propertyNodeType");
assertEquals("propertyNodeType propertyDefs", 13, def.getPropertyDefs().length);
}
use of org.apache.jackrabbit.spi.QNodeTypeDefinition in project jackrabbit by apache.
the class TestAll method testOrderedNodeType.
/**
* Test for the <code>hasOrderableChildNodes</code> node type attribute.
*/
public void testOrderedNodeType() {
QNodeTypeDefinition def = getNodeType("orderedNodeType");
assertEquals("orderedNodeType hasOrderableChildNodes", true, def.hasOrderableChildNodes());
}
use of org.apache.jackrabbit.spi.QNodeTypeDefinition in project jackrabbit by apache.
the class TestAll method getChildNode.
/**
* Returns the named child node definition from the named node type
* definition. If either of the definitions do not exist, an assertion
* failure is generated.
*
* @param typeName node type name
* @param nodeName child node name
* @return child node definition
*/
private QNodeDefinition getChildNode(String typeName, String nodeName) {
Name name = FACTORY.create(TEST_NAMESPACE, nodeName);
QNodeTypeDefinition def = getNodeType(typeName);
QNodeDefinition[] defs = def.getChildNodeDefs();
for (int i = 0; i < defs.length; i++) {
if (name.equals(defs[i].getName())) {
return defs[i];
}
}
throw new AssertionFailedError("Child node " + nodeName + " does not exist");
}
Aggregations