use of javax.jcr.nodetype.NodeTypeExistsException in project jackrabbit by apache.
the class NodeTypeManagerImplTest method testRegisterNodeTypes.
public void testRegisterNodeTypes() throws RepositoryException {
NodeTypeTemplate test = ntMgr.createNodeTypeTemplate();
test.setName("testNodeType");
ntMgr.registerNodeType(test, true);
NodeType nt = ntMgr.getNodeType("testNodeType");
assertNotNull(nt);
assertEquals("testNodeType", nt.getName());
test.setOrderableChildNodes(true);
ntMgr.registerNodeType(test, true);
nt = ntMgr.getNodeType("testNodeType");
assertNotNull(nt);
assertEquals("testNodeType", nt.getName());
assertEquals(test.hasOrderableChildNodes(), nt.hasOrderableChildNodes());
test.setDeclaredSuperTypeNames(new String[] { "nt:unstructured" });
try {
ntMgr.registerNodeType(test, false);
fail("NodeTypeExistsException expected");
} catch (NodeTypeExistsException e) {
// success
}
}
Aggregations