Search in sources :

Example 11 with RetentionManager

use of javax.jcr.retention.RetentionManager in project jackrabbit by apache.

the class HoldTest method testReadOnlySession.

public void testReadOnlySession() throws NotExecutableException, RepositoryException {
    javax.jcr.Session s = getHelper().getReadOnlySession();
    try {
        RetentionManager rmgr = getRetentionManager(s);
        try {
            rmgr.getHolds(testNodePath);
            fail("Read-only session doesn't have sufficient privileges to retrieve holds.");
        } catch (AccessDeniedException e) {
        // success
        }
        try {
            rmgr.addHold(testNodePath, getHoldName(), false);
            fail("Read-only session doesn't have sufficient privileges to retrieve holds.");
        } catch (AccessDeniedException e) {
        // success
        }
    } finally {
        s.logout();
    }
}
Also used : RetentionManager(javax.jcr.retention.RetentionManager) AccessDeniedException(javax.jcr.AccessDeniedException)

Aggregations

RetentionManager (javax.jcr.retention.RetentionManager)11 Node (javax.jcr.Node)7 RepositoryException (javax.jcr.RepositoryException)5 Session (javax.jcr.Session)5 LockException (javax.jcr.lock.LockException)4 Hold (javax.jcr.retention.Hold)4 VersionException (javax.jcr.version.VersionException)4 AccessDeniedException (javax.jcr.AccessDeniedException)2 ArrayList (java.util.ArrayList)1 StringTokenizer (java.util.StringTokenizer)1 NodeIterator (javax.jcr.NodeIterator)1 UnsupportedRepositoryOperationException (javax.jcr.UnsupportedRepositoryOperationException)1 ConstraintViolationException (javax.jcr.nodetype.ConstraintViolationException)1 NodeDefinition (javax.jcr.nodetype.NodeDefinition)1