Package org.apache.jackrabbit.oak.plugins.document

Examples of org.apache.jackrabbit.oak.plugins.document.Revision$RevisionRange


*/
public class UtilsTest {

    @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));
    }
View Full Code Here


    }

    @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);
        }
View Full Code Here

    }

    @Ignore("Performance test")
    @Test
    public void performance_revisionToString() {
        Revision r = new Revision(System.currentTimeMillis(), 0, 0);
        // warm up
        for (int i = 0; i < 1 * 1000 * 1000; i++) {
            r.toString();
        }
        long time = System.currentTimeMillis();
        for (int i = 0; i < 30 * 1000 * 1000; i++) {
            r.toString();
        }
        time = System.currentTimeMillis() - time;
        System.out.println(time);
    }
View Full Code Here

                    case INCREMENT: {
                        inserts[i].put(k.toString(), op.value);
                        break;
                    }
                    case SET_MAP_ENTRY: {
                        Revision r = k.getRevision();
                        if (r == null) {
                            throw new IllegalStateException(
                                    "SET_MAP_ENTRY must not have null revision");
                        }
                        DBObject value = new RevisionEntry(r, op.value);
View Full Code Here

    @Test
    public void comparator() {
        MapFactory factory = new MapDBMapFactory();

        Revision r = new Revision(1, 0, 1);
        Map<String, Revision> map = factory.create(PathComparator.INSTANCE);

        map.put("/", r);
        map.put("/foo", r);
        map.put("/foo/bar", r);
View Full Code Here

            o.writeBoolean(r.isBranch());

        }

        public Revision deserialize(DataInput i, int available) throws IOException {
            return new Revision(
                    i.readLong(), //timestamp
                    i.readInt()//counter
                    i.readInt()//clusterId
                    i.readBoolean()); //branch
        }
View Full Code Here

                    case INCREMENT: {
                        inserts[i].put(k.toString(), op.value);
                        break;
                    }
                    case SET_MAP_ENTRY: {
                        Revision r = k.getRevision();
                        if (r == null) {
                            throw new IllegalStateException(
                                    "SET_MAP_ENTRY must not have null revision");
                        }
                        DBObject value = new RevisionEntry(r, op.value);
View Full Code Here

                JSONArray update = (JSONArray) ob;
                for (int o = 0; o < update.size(); o++) {
                    JSONArray op = (JSONArray) update.get(o);
                    String opcode = op.get(0).toString();
                    String key = op.get(1).toString();
                    Revision rev = null;
                    Object value = null;
                    if (op.size() == 3) {
                        value = op.get(2);
                    } else {
                        rev = Revision.fromString(op.get(2).toString());
View Full Code Here

*/
public class UtilsTest {

    @Test
    public void getPreviousIdFor() {
        Revision r = new Revision(System.currentTimeMillis(), 0, 0);
        String p = Utils.getIdFromPath("/");
        assertEquals("1:p/" + r.toString(), Utils.getPreviousIdFor(p, r));
        p = Utils.getIdFromPath("/test");
        assertEquals("2:p/test/" + r.toString(), Utils.getPreviousIdFor(p, r));
        p = Utils.getIdFromPath("/a/b/c/d/e/f/g/h/i/j/k/l/m");
        assertEquals("14:p/a/b/c/d/e/f/g/h/i/j/k/l/m/" + r.toString(), Utils.getPreviousIdFor(p, r));
    }
View Full Code Here

    }

    @Ignore("Performance test")
    @Test
    public void performance_getPreviousIdFor() {
        Revision r = new Revision(System.currentTimeMillis(), 0, 0);
        String id = Utils.getIdFromPath("/some/test/path/foo");
        // warm up
        for (int i = 0; i < 1 * 1000 * 1000; i++) {
            Utils.getPreviousIdFor(id, r);
        }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.plugins.document.Revision$RevisionRange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.