use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit-oak by apache.
the class ConcurrentHasPermissionTest2 method createDeepTree.
@Override
protected void createDeepTree() throws Exception {
UserManager uMgr = ((JackrabbitSession) adminSession).getUserManager();
for (int i = 0; i < 100; i++) {
Authorizable a = uMgr.getAuthorizable("group" + i);
if (a == null) {
a = uMgr.createGroup("group" + i);
principals.add(a.getPrincipal());
}
}
super.createDeepTree();
}
use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit-oak by apache.
the class ConcurrentReadAccessControlledTreeTest2 method createDeepTree.
@Override
protected void createDeepTree() throws Exception {
UserManager uMgr = ((JackrabbitSession) adminSession).getUserManager();
for (int i = 0; i < 100; i++) {
Authorizable a = uMgr.getAuthorizable("group" + i);
if (a == null) {
a = uMgr.createGroup("group" + i);
principals.add(a.getPrincipal());
}
}
super.createDeepTree();
}
use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit-oak by apache.
the class ConcurrentCreateNodesTest method beforeSuite.
@Override
protected void beforeSuite() throws Exception {
Session session = loginWriter();
if (DISABLE_INDEX) {
disableNodeTypeIndex(session);
}
Node rootNode = session.getRootNode();
if (rootNode.hasNode(ROOT_NODE_NAME)) {
Node root = rootNode.getNode(ROOT_NODE_NAME);
root.remove();
}
rootNode = session.getRootNode().addNode(ROOT_NODE_NAME, NODE_TYPE);
for (int i = 0; i < WORKER_COUNT; i++) {
rootNode.addNode("node" + i);
}
session.save();
for (int i = 1; i < WORKER_COUNT; i++) {
addBackgroundJob(new Writer(rootNode.getPath() + "/node" + i));
}
UserManager uMgr = ((JackrabbitSession) session).getUserManager();
String userId;
String password;
if (NON_ADMIN_LISTENER) {
userId = "user-" + System.currentTimeMillis();
password = "secret";
uMgr.createUser(userId, password);
session.save();
} else {
userId = "admin";
password = "admin";
}
createACLsForEveryone(session, ACL_COUNT);
for (int i = 0; i < LISTENER_COUNT; i++) {
Session s = login(new SimpleCredentials(userId, password.toCharArray()));
s.getWorkspace().getObservationManager().addEventListener(new Listener(), EVENT_TYPES, LISTENER_PATH, true, null, null, false);
}
writer = new Writer(rootNode.getPath() + "/node" + 0);
}
use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit-oak by apache.
the class GetGroupPrincipalsTest method runTest.
@Override
public void runTest() throws Exception {
PrincipalManager principalManager = ((JackrabbitSession) session).getPrincipalManager();
for (int i = 0; i < 1000; i++) {
Principal p = principalManager.getPrincipal(principalName);
PrincipalIterator principals = principalManager.getGroupMembership(p);
// while (principals.hasNext()) {
// Principal groupPrincipal = principals.nextPrincipal();
// }
}
}
use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit-oak by apache.
the class GetGroupPrincipalsTest method afterSuite.
@Override
public void afterSuite() throws Exception {
UserManager userMgr = ((JackrabbitSession) session).getUserManager();
Authorizable authorizable = userMgr.getAuthorizable(USER);
if (authorizable != null) {
authorizable.remove();
}
authorizable = userMgr.getAuthorizable(GROUP);
if (authorizable != null) {
Node n = session.getNode(Text.getRelativeParent(authorizable.getPath(), 1));
n.remove();
}
session.save();
}
Aggregations