use of javax.jcr.nodetype.NodeTypeManager in project jackrabbit-oak by apache.
the class RepositorySidegradeTest method verifyNewBuiltinNodeTypes.
@Test
public void verifyNewBuiltinNodeTypes() throws Exception {
Session session = createAdminSession();
try {
NodeTypeManager manager = session.getWorkspace().getNodeTypeManager();
assertTrue(manager.hasNodeType(UserConstants.NT_REP_MEMBER_REFERENCES));
assertTrue(manager.hasNodeType(IndexConstants.INDEX_DEFINITIONS_NODE_TYPE));
} finally {
session.logout();
}
}
use of javax.jcr.nodetype.NodeTypeManager in project jackrabbit-oak by apache.
the class RepositorySidegradeTest method verifyReplacedBuiltinNodeTypes.
@Test
public void verifyReplacedBuiltinNodeTypes() throws Exception {
Session session = createAdminSession();
try {
NodeTypeManager manager = session.getWorkspace().getNodeTypeManager();
NodeType nt = manager.getNodeType(UserConstants.NT_REP_GROUP);
assertTrue("Migrated repository must have new nodetype definitions", nt.isNodeType(UserConstants.NT_REP_MEMBER_REFERENCES));
} finally {
session.logout();
}
}
use of javax.jcr.nodetype.NodeTypeManager in project jackrabbit-oak by apache.
the class RepositoryUpgradeTest method verifyNewBuiltinNodeTypes.
@Test
public void verifyNewBuiltinNodeTypes() throws Exception {
Session session = createAdminSession();
try {
NodeTypeManager manager = session.getWorkspace().getNodeTypeManager();
assertTrue(manager.hasNodeType(UserConstants.NT_REP_MEMBER_REFERENCES));
assertTrue(manager.hasNodeType(IndexConstants.INDEX_DEFINITIONS_NODE_TYPE));
} finally {
session.logout();
}
}
use of javax.jcr.nodetype.NodeTypeManager in project jackrabbit-oak by apache.
the class NodeTypeDefinitionManagementTest method testRegisterNodeType.
@Test
public void testRegisterNodeType() throws Exception {
Workspace testWsp = testSession.getWorkspace();
NodeTypeManager ntm = testWsp.getNodeTypeManager();
NodeTypeTemplate ntd = ntm.createNodeTypeTemplate();
ntd.setName("testRegisterNodeType");
ntd.setMixin(true);
try {
ntm.registerNodeType(ntd, true);
fail("Node type registration should be denied.");
} catch (AccessDeniedException e) {
// success
}
try {
ntm.registerNodeType(ntd, false);
fail("Node type registration should be denied.");
} catch (AccessDeniedException e) {
// success
}
NodeTypeTemplate[] ntds = new NodeTypeTemplate[2];
ntds[0] = ntd;
ntds[1] = ntm.createNodeTypeTemplate();
ntds[1].setName("anotherRegisterNodeType");
ntds[1].setDeclaredSuperTypeNames(new String[] { "nt:file" });
try {
ntm.registerNodeTypes(ntds, true);
fail("Node type registration should be denied.");
} catch (AccessDeniedException e) {
// success
}
try {
ntm.registerNodeTypes(ntds, false);
fail("Node type registration should be denied.");
} catch (AccessDeniedException e) {
// success
}
}
use of javax.jcr.nodetype.NodeTypeManager in project jackrabbit-oak by apache.
the class NodeTypeDefinitionManagementTest method testRegisterNodeTypeWithPrivilege.
@Test
public void testRegisterNodeTypeWithPrivilege() throws Exception {
modify(null, JCR_NODE_TYPE_DEFINITION_MANAGEMENT.toString(), true);
try {
Workspace testWsp = testSession.getWorkspace();
NodeTypeManager ntm = testWsp.getNodeTypeManager();
NodeTypeTemplate ntd = ntm.createNodeTypeTemplate();
ntd.setName("testRegisterNodeTypeWithPrivilege");
ntd.setMixin(true);
ntm.registerNodeType(ntd, true);
NodeTypeTemplate[] ntds = new NodeTypeTemplate[2];
ntds[0] = ntd;
ntds[1] = ntm.createNodeTypeTemplate();
ntds[1].setName("anotherRegisterNodeTypeWithPrivilege");
ntds[1].setDeclaredSuperTypeNames(new String[] { "nt:file" });
ntm.registerNodeTypes(ntds, true);
} finally {
modify(null, JCR_NODE_TYPE_DEFINITION_MANAGEMENT.toString(), false);
}
}
Aggregations