use of org.apache.jackrabbit.core.persistence.check.ConsistencyReport in project jackrabbit by apache.
the class ConsistencyCheck method runCheck.
private void runCheck() throws Exception {
log.print("running consistency check on repository " + getHelper().getRepository());
ConsistencyReport rep = TestHelper.checkConsistency(testRootNode.getSession(), false, null);
assertEquals("Found broken nodes in repository: " + rep, 0, rep.getItems().size());
rep = TestHelper.checkVersionStoreConsistency(testRootNode.getSession(), false, null);
assertEquals("Found broken nodes in version storage: " + rep, 0, rep.getItems().size());
}
use of org.apache.jackrabbit.core.persistence.check.ConsistencyReport in project jackrabbit by apache.
the class ConcurrentAddMoveRemoveTest method tearDown.
@Override
public void tearDown() throws Exception {
ConsistencyReport consistencyReport = TestHelper.checkConsistency(testRootNode.getSession(), false, null);
//for (ReportItem item : consistencyReport.getItems()) {
// System.out.println(item.getMessage());
//}
assertTrue(consistencyReport.getItems().size() == 0);
super.tearDown();
}
use of org.apache.jackrabbit.core.persistence.check.ConsistencyReport in project jackrabbit by apache.
the class MoveRemoveTest method testMoveRemove.
public void testMoveRemove() throws RepositoryException, NotExecutableException {
Session session1 = getHelper().getSuperuserSession();
Session session2 = getHelper().getSuperuserSession();
session1.move(folder1Path + "/node", folder2Path + "/node");
session2.getNode(folder1Path + "/node").remove();
session1.save();
try {
session2.save();
} catch (InvalidItemStateException e) {
if (e.getCause() == null || e.getCause().getClass() != StaleItemStateException.class) {
throw e;
}
}
ConsistencyReport consistencyReport = TestHelper.checkConsistency(testRootNode.getSession(), false, null);
//for (ReportItem item : consistencyReport.getItems()) {
// System.out.println(item.getMessage());
//}
assertTrue(consistencyReport.getItems().size() == 0);
}
use of org.apache.jackrabbit.core.persistence.check.ConsistencyReport in project jackrabbit by apache.
the class ConcurrentImportTest method checkConsistency.
private void checkConsistency() throws RepositoryException {
try {
ConsistencyReport rep = TestHelper.checkConsistency(testRootNode.getSession(), false, null);
assertEquals("Found broken nodes in repository: " + rep, 0, rep.getItems().size());
} catch (NotExecutableException ex) {
// ignore
}
}
use of org.apache.jackrabbit.core.persistence.check.ConsistencyReport in project jackrabbit by apache.
the class AutoFixCorruptNode method testMissingRootVersion2.
// similar to above, but disconnects version history before damaging the repository
public void testMissingRootVersion2() throws Exception {
// new repository
TransientRepository rep = new TransientRepository(new File(TEST_DIR));
Session s = openSession(rep, false);
String oldVersionRecoveryProp = System.getProperty("org.apache.jackrabbit.version.recovery");
try {
Node root = s.getRootNode();
// add nodes /test and /test/missing
Node test = root.addNode("test");
test.addMixin("mix:versionable");
s.save();
Node vhr = s.getWorkspace().getVersionManager().getVersionHistory(test.getPath());
assertNotNull(vhr);
Node brokenNode = vhr.getNode("jcr:rootVersion");
String vhrId = vhr.getIdentifier();
UUID destroy = UUID.fromString(brokenNode.getIdentifier());
// disable versioning
test.removeMixin("mix:versionable");
s.save();
s.logout();
destroyBundle(destroy, "version");
s = openSession(rep, false);
ConsistencyReport report = TestHelper.checkVersionStoreConsistency(s, false, null);
assertTrue("Report should have reported broken nodes", !report.getItems().isEmpty());
s.logout();
System.setProperty("org.apache.jackrabbit.version.recovery", "true");
s = openSession(rep, false);
s.logout();
s = openSession(rep, false);
test = s.getRootNode().getNode("test");
// versioning should still be disabled
assertFalse(test.isNodeType("mix:versionable"));
// try to enable versioning again
test.addMixin("mix:versionable");
s.save();
Node oldVHR = s.getNodeByIdentifier(vhrId);
Node newVHR = s.getWorkspace().getVersionManager().getVersionHistory(test.getPath());
assertTrue("old and new version history path should be different: " + oldVHR.getPath() + " vs " + newVHR.getPath(), !oldVHR.getPath().equals(newVHR.getPath()));
// name should be same plus suffix
assertTrue(oldVHR.getName().startsWith(newVHR.getName()));
// try a checkout / checkin
s.getWorkspace().getVersionManager().checkout(test.getPath());
s.getWorkspace().getVersionManager().checkin(test.getPath());
validateDisconnectedVHR(oldVHR);
} finally {
s.logout();
System.setProperty("org.apache.jackrabbit.version.recovery", oldVersionRecoveryProp == null ? "" : oldVersionRecoveryProp);
}
}
Aggregations