public void testUnRegisterNodeType() throws Exception {
assertDefaultPrivileges(NameConstants.JCR_NODE_TYPE_DEFINITION_MANAGEMENT);
assertPermission(Permission.NODE_TYPE_DEF_MNGMT, false);
NodeTypeManager ntm = superuser.getWorkspace().getNodeTypeManager();
NodeTypeTemplate ntd = ntm.createNodeTypeTemplate();
ntd.setName("testNodeType");
ntd.setMixin(true);
ntm.registerNodeType(ntd, true);
Workspace testWsp = getTestWorkspace();
try {
try {
NodeTypeManager testNtm = testWsp.getNodeTypeManager();
testNtm.unregisterNodeType(ntd.getName());
fail("Namespace unregistration should be denied.");
} catch (AccessDeniedException e) {
// success
}
try {
NodeTypeManager testNtm = testWsp.getNodeTypeManager();
testNtm.unregisterNodeTypes(new String[] {ntd.getName()});
fail("Namespace unregistration should be denied.");
} catch (AccessDeniedException e) {
// success
}
} finally {
// clean up (not supported by jackrabbit-core)
try {
ntm.unregisterNodeType(ntd.getName());
} catch (Exception e) {
// ns unregistration is not supported by jackrabbit-core.
}
}