Search in sources :

Example 56 with UnsupportedRepositoryOperationException

use of javax.jcr.UnsupportedRepositoryOperationException in project jackrabbit-oak by apache.

the class UserManagerTest method testGetAuthorizableByPath.

@Test
public void testGetAuthorizableByPath() throws RepositoryException, NotExecutableException {
    String uid = superuser.getUserID();
    Authorizable a = userMgr.getAuthorizable(uid);
    if (a == null) {
        throw new NotExecutableException();
    }
    try {
        String path = a.getPath();
        Authorizable a2 = userMgr.getAuthorizableByPath(path);
        assertNotNull(a2);
        assertEquals(a.getID(), a2.getID());
    } catch (UnsupportedRepositoryOperationException e) {
        throw new NotExecutableException();
    }
}
Also used : UnsupportedRepositoryOperationException(javax.jcr.UnsupportedRepositoryOperationException) NotExecutableException(org.apache.jackrabbit.test.NotExecutableException) Authorizable(org.apache.jackrabbit.api.security.user.Authorizable) Test(org.junit.Test)

Example 57 with UnsupportedRepositoryOperationException

use of javax.jcr.UnsupportedRepositoryOperationException in project jackrabbit-oak by apache.

the class UserTest method testLoginWithGetCredentials.

@Test
public void testLoginWithGetCredentials() throws RepositoryException, NotExecutableException {
    try {
        Credentials creds = user.getCredentials();
        Session s = getHelper().getRepository().login(creds);
        s.logout();
        fail("Login using credentials exposed on user must fail.");
    } catch (UnsupportedRepositoryOperationException e) {
        throw new NotExecutableException(e.getMessage());
    } catch (LoginException e) {
    // success
    }
}
Also used : UnsupportedRepositoryOperationException(javax.jcr.UnsupportedRepositoryOperationException) NotExecutableException(org.apache.jackrabbit.test.NotExecutableException) LoginException(javax.jcr.LoginException) SimpleCredentials(javax.jcr.SimpleCredentials) Credentials(javax.jcr.Credentials) Session(javax.jcr.Session) JackrabbitSession(org.apache.jackrabbit.api.JackrabbitSession) Test(org.junit.Test)

Aggregations

UnsupportedRepositoryOperationException (javax.jcr.UnsupportedRepositoryOperationException)57 RepositoryException (javax.jcr.RepositoryException)17 Node (javax.jcr.Node)14 NotExecutableException (org.apache.jackrabbit.test.NotExecutableException)12 NodeId (org.apache.jackrabbit.core.id.NodeId)8 ArrayList (java.util.ArrayList)7 Workspace (javax.jcr.Workspace)5 ConstraintViolationException (javax.jcr.nodetype.ConstraintViolationException)5 Session (javax.jcr.Session)4 VersionManager (javax.jcr.version.VersionManager)4 NodeState (org.apache.jackrabbit.core.state.NodeState)4 Name (org.apache.jackrabbit.spi.Name)4 Path (org.apache.jackrabbit.spi.Path)4 IOException (java.io.IOException)3 ItemExistsException (javax.jcr.ItemExistsException)3 ItemNotFoundException (javax.jcr.ItemNotFoundException)3 NodeType (javax.jcr.nodetype.NodeType)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 AccessDeniedException (javax.jcr.AccessDeniedException)2