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();
}
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
}
}
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
}
}
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
}
}
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
}
}
Aggregations