use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit by apache.
the class GetOrNullTest method testGetNodeOrNullNonExisting.
public void testGetNodeOrNullNonExisting() throws RepositoryException {
JackrabbitSession js = (JackrabbitSession) superuser;
Node node = js.getNodeOrNull(PATH_NON_EXISTING_NODE);
assertNull(node);
}
use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit by apache.
the class GetOrNullTest method testGetItemOrNullNonExistingProperty.
public void testGetItemOrNullNonExistingProperty() throws RepositoryException {
JackrabbitSession js = (JackrabbitSession) superuser;
Item item = js.getItemOrNull(PATH_NON_EXISTING_PROPERTY);
assertNull(item);
}
use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit by apache.
the class GetOrNullTest method testGetPropertyOrNullExisting.
public void testGetPropertyOrNullExisting() throws RepositoryException {
JackrabbitSession js = (JackrabbitSession) superuser;
Property property = js.getPropertyOrNull(PATH_EXISTING_PROPERTY);
assertNotNull(property);
assertEquals(property.getPath(), PATH_EXISTING_PROPERTY);
}
use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit by apache.
the class GetOrNullTest method testGetItemOrNullExistingNode.
public void testGetItemOrNullExistingNode() throws RepositoryException {
JackrabbitSession js = (JackrabbitSession) superuser;
Item item = js.getItemOrNull(PATH_EXISTING_NODE);
assertNotNull(item);
assertTrue(item instanceof Node);
assertEquals(item.getPath(), PATH_EXISTING_NODE);
}
use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit by apache.
the class AuthorizableTest method testRecreateUser.
public void testRecreateUser() throws RepositoryException, NotExecutableException {
String id = "bla";
Authorizable auth = userMgr.getAuthorizable(id);
if (auth == null) {
auth = userMgr.createUser(id, id);
}
auth.remove();
save(superuser);
assertNull(userMgr.getAuthorizable(id));
// recreate the user using another session.
Session s2 = getHelper().getSuperuserSession();
User u2 = null;
try {
UserManager umgr = ((JackrabbitSession) s2).getUserManager();
assertNull(umgr.getAuthorizable(id));
// recreation must succeed
u2 = umgr.createUser(id, id);
// must be present with both session.
assertNotNull(umgr.getAuthorizable(id));
assertNotNull(userMgr.getAuthorizable(id));
} finally {
if (u2 != null) {
u2.remove();
save(s2);
}
s2.logout();
}
}
Aggregations