use of org.apache.jackrabbit.oak.plugins.document.Revision in project jackrabbit-oak by apache.
the class UtilsTest method getPreviousIdFor.
@Test
public void getPreviousIdFor() {
Revision r = new Revision(System.currentTimeMillis(), 0, 0);
assertEquals("2:p/" + r.toString() + "/0", Utils.getPreviousIdFor("/", r, 0));
assertEquals("3:p/test/" + r.toString() + "/1", Utils.getPreviousIdFor("/test", r, 1));
assertEquals("15:p/a/b/c/d/e/f/g/h/i/j/k/l/m/" + r.toString() + "/3", Utils.getPreviousIdFor("/a/b/c/d/e/f/g/h/i/j/k/l/m", r, 3));
}
use of org.apache.jackrabbit.oak.plugins.document.Revision in project jackrabbit-oak by apache.
the class SecondaryStoreCacheTest method basicTest.
@Test
public void basicTest() throws Exception {
SecondaryStoreCache cache = createCache(new PathFilter(of("/a"), empty));
NodeBuilder nb = primary.getRoot().builder();
create(nb, "/a/b", "/a/c", "/x/y/z");
merge(nb);
RevisionVector rv1 = new RevisionVector(new Revision(1, 0, 1));
RevisionVector rv2 = new RevisionVector(new Revision(1, 0, 3));
assertNull(cache.getDocumentNodeState("/a/b", rv1, rv2));
assertNull(cache.getDocumentNodeState("/x", rv1, rv2));
}
use of org.apache.jackrabbit.oak.plugins.document.Revision in project jackrabbit-oak by apache.
the class UtilsTest method performance_getPreviousIdFor.
@Ignore("Performance test")
@Test
public void performance_getPreviousIdFor() {
Revision r = new Revision(System.currentTimeMillis(), 0, 0);
String path = "/some/test/path/foo";
// warm up
for (int i = 0; i < 1 * 1000 * 1000; i++) {
Utils.getPreviousIdFor(path, r, 0);
}
long time = System.currentTimeMillis();
for (int i = 0; i < 10 * 1000 * 1000; i++) {
Utils.getPreviousIdFor(path, r, 0);
}
time = System.currentTimeMillis() - time;
System.out.println(time);
}
use of org.apache.jackrabbit.oak.plugins.document.Revision in project jackrabbit-oak by apache.
the class UtilsTest method min.
@Test
public void min() {
Revision a = new Revision(42, 1, 1);
Revision b = new Revision(43, 0, 1);
assertSame(a, Utils.min(a, b));
Revision a1 = new Revision(42, 0, 1);
assertSame(a1, Utils.min(a, a1));
assertSame(a, Utils.min(a, null));
assertSame(a, Utils.min(null, a));
assertNull(Utils.max(null, null));
}
use of org.apache.jackrabbit.oak.plugins.document.Revision in project jackrabbit-oak by apache.
the class UtilsTest method max.
@Test
public void max() {
Revision a = new Revision(42, 0, 1);
Revision b = new Revision(43, 0, 1);
assertSame(b, Utils.max(a, b));
Revision a1 = new Revision(42, 1, 1);
assertSame(a1, Utils.max(a, a1));
assertSame(a, Utils.max(a, null));
assertSame(a, Utils.max(null, a));
assertNull(Utils.max(null, null));
}
Aggregations