use of org.apache.jackrabbit.oak.plugins.document.Revision in project jackrabbit-oak by apache.
the class UtilsTest method previousDoc.
@Test
public void previousDoc() throws Exception {
Revision r = new Revision(System.currentTimeMillis(), 0, 0);
assertTrue(Utils.isPreviousDocId(Utils.getPreviousIdFor("/", r, 0)));
assertTrue(Utils.isPreviousDocId(Utils.getPreviousIdFor("/a/b/c/d/e/f/g/h/i/j/k/l/m", r, 3)));
assertFalse(Utils.isPreviousDocId(Utils.getIdFromPath("/a/b")));
assertFalse(Utils.isPreviousDocId("foo"));
assertFalse(Utils.isPreviousDocId("0:"));
}
use of org.apache.jackrabbit.oak.plugins.document.Revision in project jackrabbit-oak by apache.
the class UtilsTest method getMinTimestampForDiff.
@Test
public void getMinTimestampForDiff() {
RevisionVector from = new RevisionVector(new Revision(17, 0, 1));
RevisionVector to = new RevisionVector(new Revision(19, 0, 1));
assertEquals(17, Utils.getMinTimestampForDiff(from, to, new RevisionVector()));
assertEquals(17, Utils.getMinTimestampForDiff(to, from, new RevisionVector()));
RevisionVector minRevs = new RevisionVector(new Revision(7, 0, 1), new Revision(4, 0, 2));
assertEquals(17, Utils.getMinTimestampForDiff(from, to, minRevs));
assertEquals(17, Utils.getMinTimestampForDiff(to, from, minRevs));
to = to.update(new Revision(15, 0, 2));
// must return min revision of clusterId 2
assertEquals(4, Utils.getMinTimestampForDiff(from, to, minRevs));
assertEquals(4, Utils.getMinTimestampForDiff(to, from, minRevs));
}
Aggregations