destroyBundle(destroy, "version");
s = openSession(rep, false);
ConsistencyReport report = TestHelper.checkVersionStoreConsistency(s, false, null);
assertTrue("Report should have reported broken nodes", !report.getItems().isEmpty());
try {
test = s.getRootNode().getNode("test");
vhr = s.getWorkspace().getVersionManager()
.getVersionHistory(test.getPath());
fail("should not get here");
} catch (Exception ex) {
// expected
}
s.logout();
System.setProperty("org.apache.jackrabbit.version.recovery", "true");
s = openSession(rep, false);
test = s.getRootNode().getNode("test");
// versioning should be disabled now
assertFalse(test.isNodeType("mix:versionable"));
try {
// try to enable versioning again
test.addMixin("mix:versionable");
s.save();
fail("enabling versioning succeeded unexpectedly");
}
catch (Exception e) {
// we expect this to fail
}
s.logout();
// now redo after running fixup on versioning storage
s = openSession(rep, false);
report = TestHelper.checkVersionStoreConsistency(s, true, null);
assertTrue("Report should have reported broken nodes", !report.getItems().isEmpty());
int reportitems = report.getItems().size();
// problems should now be fixed
report = TestHelper.checkVersionStoreConsistency(s, false, null);
assertTrue("Some problems should have been fixed but are not: " + report, report.getItems().size() < reportitems);
test = s.getRootNode().getNode("test");
// versioning should be disabled now
assertFalse(test.isNodeType("mix:versionable"));
// jcr:uuid property should still be present