use of org.apache.jackrabbit.core.retention.RetentionRegistryImpl in project jackrabbit by apache.
the class RetentionRegistryImplTest method testReadRetentionFromFile.
public void testReadRetentionFromFile() throws RepositoryException {
SessionImpl s = (SessionImpl) getHelper().getSuperuserSession();
RetentionRegistryImpl re = new RetentionRegistryImpl(s, createFileSystem());
try {
assertTrue(re.hasEffectiveRetention(s.getQPath(childNPath), false));
assertTrue(re.hasEffectiveRetention(s.getQPath(childNPath + "/somechild"), true));
assertFalse(re.hasEffectiveRetention(s.getQPath(testNodePath), false));
assertFalse(re.hasEffectiveRetention(s.getQPath(childNPath + "/somechild"), false));
assertFalse(re.hasEffectiveRetention(s.getQPath(childNPath + "/somechild/deepchild"), true));
assertFalse(re.hasEffectiveRetention(s.getQPath(childP.getPath()), false));
} finally {
re.close();
s.logout();
}
}
use of org.apache.jackrabbit.core.retention.RetentionRegistryImpl in project jackrabbit by apache.
the class RetentionRegistryImplTest method testReadHoldFromFile.
public void testReadHoldFromFile() throws RepositoryException {
PathResolver resolver = (SessionImpl) superuser;
RetentionRegistryImpl re = new RetentionRegistryImpl((SessionImpl) superuser, createFileSystem());
try {
assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath), false));
assertTrue(re.hasEffectiveHold(resolver.getQPath(childN3.getPath()), false));
assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath + "/somechild"), false));
assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath + "/hold/is/deep"), false));
assertFalse(re.hasEffectiveHold(resolver.getQPath(testNodePath), false));
assertFalse(re.hasEffectiveHold(resolver.getQPath(childN2.getPath()), false));
} finally {
re.close();
}
}
use of org.apache.jackrabbit.core.retention.RetentionRegistryImpl in project jackrabbit by apache.
the class RetentionRegistryImplTest method testWriteFileWithChanges.
public void testWriteFileWithChanges() throws RepositoryException, NotExecutableException {
PathResolver resolver = (SessionImpl) superuser;
FileSystem fs = createFileSystem();
RetentionRegistryImpl re = new RetentionRegistryImpl((SessionImpl) superuser, fs);
String childN3Path = childN3.getPath();
try {
retentionMgr.removeRetentionPolicy(childNPath);
retentionMgr.removeHold(childNPath, retentionMgr.getHolds(childNPath)[0]);
superuser.save();
retentionMgr.setRetentionPolicy(childN3Path, getApplicableRetentionPolicy("retentionOnChild2"));
retentionMgr.addHold(childNPath, "holdOnChild", false);
superuser.save();
// write the changes to the fs
re.close();
// create a new dummy registry again.
re = new RetentionRegistryImpl((SessionImpl) superuser, fs);
// test holds
assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath), false));
assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath), true));
assertTrue(re.hasEffectiveHold(resolver.getQPath(childN3Path), true));
assertFalse(re.hasEffectiveHold(resolver.getQPath(childN3Path), false));
assertFalse(re.hasEffectiveHold(resolver.getQPath(childN3Path + "/child"), false));
assertFalse(re.hasEffectiveHold(resolver.getQPath(childN3Path + "/child"), true));
// test policies
assertTrue(re.hasEffectiveRetention(resolver.getQPath(childN3Path), false));
assertTrue(re.hasEffectiveRetention(resolver.getQPath(childN3Path + "/child"), true));
assertFalse(re.hasEffectiveRetention(resolver.getQPath(childN3Path + "/child/more"), true));
assertFalse(re.hasEffectiveRetention(resolver.getQPath(childNPath), true));
assertFalse(re.hasEffectiveRetention(resolver.getQPath(childNPath), false));
} finally {
re.close();
// remove the extra policy that is not cleared upon teardown
if (retentionMgr.getRetentionPolicy(childN3Path) != null) {
retentionMgr.removeRetentionPolicy(childN3.getPath());
}
superuser.save();
}
}
use of org.apache.jackrabbit.core.retention.RetentionRegistryImpl in project jackrabbit by apache.
the class RetentionRegistryImplTest method testWriteFile.
public void testWriteFile() throws RepositoryException {
PathResolver resolver = (SessionImpl) superuser;
FileSystem fs = createFileSystem();
RetentionRegistryImpl re = new RetentionRegistryImpl((SessionImpl) superuser, fs);
try {
// write the changes to the fs
re.close();
// create a new dummy registry again.
re = new RetentionRegistryImpl((SessionImpl) superuser, fs);
// test holds
assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath), false));
assertTrue(re.hasEffectiveHold(resolver.getQPath(childN3.getPath()), false));
assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath + "/somechild"), false));
assertTrue(re.hasEffectiveHold(resolver.getQPath(childNPath + "/hold/is/deep"), false));
// test policies
assertTrue(re.hasEffectiveRetention(resolver.getQPath(childNPath), false));
assertTrue(re.hasEffectiveRetention(resolver.getQPath(childNPath + "/somechild"), true));
} finally {
re.close();
}
}
Aggregations