Search in sources :

Example 11 with JackrabbitSession

use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit by apache.

the class GetOrNullTest method testGetItemOrNullNonExistingNode.

public void testGetItemOrNullNonExistingNode() throws RepositoryException {
    JackrabbitSession js = (JackrabbitSession) superuser;
    Item item = js.getItemOrNull(PATH_NON_EXISTING_NODE);
    assertNull(item);
}
Also used : Item(javax.jcr.Item) JackrabbitSession(org.apache.jackrabbit.api.JackrabbitSession)

Example 12 with JackrabbitSession

use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit by apache.

the class GetOrNullTest method testGetNodeOrNullExisting.

public void testGetNodeOrNullExisting() throws RepositoryException {
    JackrabbitSession js = (JackrabbitSession) superuser;
    Node node = js.getNodeOrNull(PATH_EXISTING_NODE);
    assertNotNull(node);
    assertEquals(node.getPath(), PATH_EXISTING_NODE);
}
Also used : Node(javax.jcr.Node) JackrabbitSession(org.apache.jackrabbit.api.JackrabbitSession)

Example 13 with JackrabbitSession

use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit by apache.

the class GetOrNullTest method testGetItemOrNullExistingProperty.

public void testGetItemOrNullExistingProperty() throws RepositoryException {
    JackrabbitSession js = (JackrabbitSession) superuser;
    Item item = js.getItemOrNull(PATH_EXISTING_PROPERTY);
    assertNotNull(item);
    assertTrue(item instanceof Property);
    assertEquals(item.getPath(), PATH_EXISTING_PROPERTY);
}
Also used : Item(javax.jcr.Item) JackrabbitSession(org.apache.jackrabbit.api.JackrabbitSession) Property(javax.jcr.Property)

Example 14 with JackrabbitSession

use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit by apache.

the class GetOrNullTest method testGetPropertyOrNullNonExisting.

public void testGetPropertyOrNullNonExisting() throws RepositoryException {
    JackrabbitSession js = (JackrabbitSession) superuser;
    Property property = js.getPropertyOrNull(PATH_NON_EXISTING_PROPERTY);
    assertNull(property);
}
Also used : JackrabbitSession(org.apache.jackrabbit.api.JackrabbitSession) Property(javax.jcr.Property)

Example 15 with JackrabbitSession

use of org.apache.jackrabbit.api.JackrabbitSession in project jackrabbit by apache.

the class AbstractACLTemplateTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    if (!(superuser instanceof JackrabbitSession)) {
        throw new NotExecutableException();
    }
    principalMgr = ((JackrabbitSession) superuser).getPrincipalManager();
    PrincipalIterator it = principalMgr.getPrincipals(PrincipalManager.SEARCH_TYPE_NOT_GROUP);
    if (it.hasNext()) {
        testPrincipal = it.nextPrincipal();
    } else {
        throw new NotExecutableException();
    }
    privilegeMgr = (PrivilegeManagerImpl) ((JackrabbitWorkspace) superuser.getWorkspace()).getPrivilegeManager();
}
Also used : NotExecutableException(org.apache.jackrabbit.test.NotExecutableException) PrincipalIterator(org.apache.jackrabbit.api.security.principal.PrincipalIterator) JackrabbitWorkspace(org.apache.jackrabbit.api.JackrabbitWorkspace) JackrabbitSession(org.apache.jackrabbit.api.JackrabbitSession)

Aggregations

JackrabbitSession (org.apache.jackrabbit.api.JackrabbitSession)114 UserManager (org.apache.jackrabbit.api.security.user.UserManager)51 Session (javax.jcr.Session)50 Authorizable (org.apache.jackrabbit.api.security.user.Authorizable)34 Node (javax.jcr.Node)25 Group (org.apache.jackrabbit.api.security.user.Group)25 User (org.apache.jackrabbit.api.security.user.User)24 Principal (java.security.Principal)19 NotExecutableException (org.apache.jackrabbit.test.NotExecutableException)17 Test (org.junit.Test)16 SimpleCredentials (javax.jcr.SimpleCredentials)15 PrincipalImpl (org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl)11 RepositoryException (javax.jcr.RepositoryException)10 PrincipalIterator (org.apache.jackrabbit.api.security.principal.PrincipalIterator)9 PrincipalManager (org.apache.jackrabbit.api.security.principal.PrincipalManager)9 Privilege (javax.jcr.security.Privilege)8 LoginException (javax.jcr.LoginException)6 Property (javax.jcr.Property)6 ItemBasedPrincipal (org.apache.jackrabbit.api.security.principal.ItemBasedPrincipal)6 Item (javax.jcr.Item)5