use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit-oak by apache.
the class IsMemberTest method runTest.
@Override
public void runTest() throws Exception {
Session s = null;
try {
// use system session login to avoid measuring the login-performance here
s = systemLogin();
UserManager userManager = ((JackrabbitSession) s).getUserManager();
for (int i = 0; i <= 1000; i++) {
Group g = getRandomGroup(userManager);
boolean isMember = isMember(g, getRandomUser(userManager));
//System.out.println(USER + i + " is " + (isMember? "" : "not ")+ "member of " +groupId);
}
} catch (RepositoryException e) {
System.out.println(e.getMessage());
} finally {
if (s != null) {
s.logout();
}
}
}
use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit-oak by apache.
the class LoginWithMembersTest method afterSuite.
@Override
public void afterSuite() throws Exception {
Session s = loginAdministrative();
try {
Authorizable authorizable = ((JackrabbitSession) s).getUserManager().getAuthorizable(GROUP);
if (authorizable != null) {
Node n = s.getNode(Text.getRelativeParent(authorizable.getPath(), 1));
n.remove();
}
s.save();
} finally {
s.logout();
}
}
use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit-oak by apache.
the class LoginWithMembersTest method beforeSuite.
@Override
public void beforeSuite() throws Exception {
super.beforeSuite();
Session s = loginAdministrative();
try {
UserManager userManager = ((JackrabbitSession) s).getUserManager();
Authorizable user = userManager.getAuthorizable(USER);
Group gr = userManager.createGroup(new PrincipalImpl(GROUP), "test");
gr.addMember(user);
// add other members to this group which the test user is not member of.
for (int i = 1; i < numberOfMembers; i++) {
Group g = userManager.createGroup(new PrincipalImpl(GROUP + i), "test");
gr.addMember(g);
}
s.save();
} finally {
s.logout();
}
}
use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit-oak by apache.
the class GetAuthorizableByIdTest method runTest.
@Override
protected void runTest() throws Exception {
Session s = loginWriter();
UserManager userManager = ((JackrabbitSession) s).getUserManager();
for (int i = 0; i < 1000; i++) {
Authorizable a = userManager.getAuthorizable(getUserId());
}
}
use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit-oak by apache.
the class GetAuthorizableByIdTest method beforeSuite.
@Override
protected void beforeSuite() throws Exception {
Session s = loginWriter();
UserManager userManager = ((JackrabbitSession) s).getUserManager();
for (int i = 0; i < numberOfUsers; i++) {
String id = (flat) ? "user" + i : UUID.randomUUID().toString();
User user = userManager.createUser(id, id);
ids.add(id);
}
s.save();
System.out.println("Setup " + numberOfUsers + " users");
}
Aggregations