Search in sources :

Example 11 with Hold

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

the class HoldTest method tearDown.

@Override
protected void tearDown() throws Exception {
    try {
        superuser.refresh(false);
        Hold[] holds = retentionMgr.getHolds(testNodePath);
        for (Hold hold : holds) {
            retentionMgr.removeHold(testNodePath, hold);
        }
        superuser.save();
    } catch (RepositoryException e) {
        log.error(e.getMessage());
    }
    super.tearDown();
}
Also used : RepositoryException(javax.jcr.RepositoryException) Hold(javax.jcr.retention.Hold)

Example 12 with Hold

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

the class HoldTest method testRemoveInvalidHold.

public void testRemoveInvalidHold() throws RepositoryException, NotExecutableException {
    final Hold h = retentionMgr.addHold(testNodePath, getHoldName(), true);
    try {
        Hold invalidH = new Hold() {

            public boolean isDeep() throws RepositoryException {
                return h.isDeep();
            }

            public String getName() throws RepositoryException {
                return h.getName();
            }
        };
        retentionMgr.removeHold(testNodePath, invalidH);
        fail("An invalid hold impl. should not be removable.");
    } catch (RepositoryException e) {
    // success
    }
}
Also used : RepositoryException(javax.jcr.RepositoryException) Hold(javax.jcr.retention.Hold)

Example 13 with Hold

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

the class HoldTest method testRemoveInvalidHold2.

public void testRemoveInvalidHold2() throws RepositoryException, NotExecutableException {
    final Hold h = retentionMgr.addHold(testNodePath, getHoldName(), true);
    try {
        Hold invalidH = new Hold() {

            public boolean isDeep() throws RepositoryException {
                return h.isDeep();
            }

            public String getName() throws RepositoryException {
                return "anyName";
            }
        };
        retentionMgr.removeHold(testNodePath, invalidH);
        fail("An invalid hold impl. should not be removable.");
    } catch (RepositoryException e) {
    // success
    }
}
Also used : RepositoryException(javax.jcr.RepositoryException) Hold(javax.jcr.retention.Hold)

Example 14 with Hold

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

the class HoldTest method testAddHoldTwice.

public void testAddHoldTwice() throws RepositoryException, NotExecutableException {
    Hold h = retentionMgr.addHold(testNodePath, getHoldName(), true);
    try {
        retentionMgr.addHold(testNodePath, getHoldName(), true);
        fail("cannot add the same hold twice");
    } catch (RepositoryException e) {
    // success
    }
    superuser.save();
    try {
        retentionMgr.addHold(testNodePath, getHoldName(), true);
        fail("cannot add the same hold twice");
    } catch (RepositoryException e) {
    // success
    }
}
Also used : RepositoryException(javax.jcr.RepositoryException) Hold(javax.jcr.retention.Hold)

Example 15 with Hold

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

the class HoldTest method testRemoveInvalidHold3.

public void testRemoveInvalidHold3() throws RepositoryException, NotExecutableException {
    final Hold h = retentionMgr.addHold(testNodePath, getHoldName(), true);
    try {
        Hold invalidH = new Hold() {

            public boolean isDeep() throws RepositoryException {
                return !h.isDeep();
            }

            public String getName() throws RepositoryException {
                return h.getName();
            }
        };
        retentionMgr.removeHold(testNodePath, invalidH);
        fail("An invalid hold impl. should not be removable.");
    } catch (RepositoryException e) {
    // success
    }
}
Also used : RepositoryException(javax.jcr.RepositoryException) Hold(javax.jcr.retention.Hold)

Aggregations

Hold (javax.jcr.retention.Hold)26 RepositoryException (javax.jcr.RepositoryException)9 Node (javax.jcr.Node)4 RetentionManager (javax.jcr.retention.RetentionManager)4 RetentionRegistry (org.apache.jackrabbit.core.retention.RetentionRegistry)3 PathNotFoundException (javax.jcr.PathNotFoundException)2 LockException (javax.jcr.lock.LockException)2 VersionException (javax.jcr.version.VersionException)2 ArrayList (java.util.ArrayList)1 PropertyIterator (javax.jcr.PropertyIterator)1 NodeImpl (org.apache.jackrabbit.core.NodeImpl)1 NotExecutableException (org.apache.jackrabbit.test.NotExecutableException)1