Examples of Commit


Examples of org.apache.jackrabbit.mongomk.api.model.Commit

        assertEquals(1, instructions.size());
        InstructionAssert.assertSetPropertyInstruction((SetPropertyInstruction) instructions.get(0), "/", "a", "b");
    }

    private Commit buildAndAssertCommit(String commitString) throws Exception {
        Commit commit = CommitBuilder.build(ROOT, commitString, MESSAGE);

        assertNotNull(commit);
        assertEquals(MESSAGE, commit.getMessage());
        assertNull(commit.getRevisionId());
        return commit;
    }
View Full Code Here

Examples of org.apache.jackrabbit.mongomk.api.model.Commit

        // create the commands
        List<CommitCommandMongo> commands = new ArrayList<CommitCommandMongo>(numOfConcurrentThreads);
        for (int i = 0; i < numOfConcurrentThreads; ++i) {
            List<Instruction> instructions = new LinkedList<Instruction>();
            instructions.add(new AddNodeInstructionImpl("/", String.valueOf(i)));
            Commit commit = new CommitImpl("/", "+" + i + " : {}",
                    "This is a concurrent commit", instructions);
            CommitCommandMongo command = new CommitCommandMongo(mongoConnection, commit) {
                @Override
                protected boolean saveAndSetHeadRevision() throws Exception {
                    try {
View Full Code Here

Examples of org.apache.jackrabbit.mongomk.api.model.Commit

        instructions.add(new AddNodeInstructionImpl("/", "a"));
        instructions.add(new AddNodeInstructionImpl("/a", "b"));
        instructions.add(new AddNodeInstructionImpl("/a/b", "c"));
        instructions.add(new AddNodeInstructionImpl("/a/b/c", "d"));

        Commit commit = new CommitImpl("/", "TODO", "Add nodes", instructions);
        CommitCommandMongo command = new CommitCommandMongo(mongoConnection,
                commit);
        command.execute();

        // Remove b.
View Full Code Here

Examples of org.apache.jackrabbit.mongomk.api.model.Commit

        List<Instruction> instructions = new LinkedList<Instruction>();

        // Add /a
        instructions.add(new AddNodeInstructionImpl("/", "a"));
        Commit commit1 = new CommitImpl("/", "+a : {}", "Add node a",
                instructions);
        CommitCommandMongo command = new CommitCommandMongo(mongoConnection,
                commit1);
        command.execute();

        // Add /a/b
        instructions = new LinkedList<Instruction>();
        instructions.add(new AddNodeInstructionImpl("/a", "b"));
        Commit commit2 = new CommitImpl("/a", "+b : {}", "Add node a/b",
                instructions);
        command = new CommitCommandMongo(mongoConnection, commit2);
        command.execute();

        // Verify /a is visible in the head revision
View Full Code Here

Examples of org.apache.jackrabbit.mongomk.api.model.Commit

    @Override
    public String commit(String path, String jsonDiff, String revisionId, String message) throws MicroKernelException {
        String newRevisionId = null;

        try {
            Commit commit = CommitBuilder.build(path, jsonDiff, message);
            newRevisionId = nodeStore.commit(commit);
        } catch (Exception e) {
            throw new MicroKernelException(e);
        }
View Full Code Here

Examples of org.apache.jackrabbit.mongomk.api.model.Commit

    @Test
    public void addNewNodesToSameParent() throws Exception {
        List<Instruction> instructions = new LinkedList<Instruction>();
        instructions.add(new AddNodeInstructionImpl("/", "1"));

        Commit commit = new CommitImpl("/", "+1 : {}", "This is the 1st commit", instructions);
        CommitCommandMongo command = new CommitCommandMongo(mongoConnection, commit);
        String firstRevisionId = command.execute();

        instructions = new LinkedList<Instruction>();
        instructions.add(new AddNodeInstructionImpl("/", "2"));
View Full Code Here

Examples of org.apache.jackrabbit.mongomk.api.model.Commit

        List<Instruction> instructions = new LinkedList<Instruction>();
        instructions.add(new AddNodeInstructionImpl("/", "a"));
        instructions.add(new AddNodeInstructionImpl("/a", "b"));
        instructions.add(new AddNodeInstructionImpl("/a", "c"));

        Commit commit = new CommitImpl("/", "+a : { b : {} , c : {} }",
                "This is a simple commit", instructions);
        CommitCommandMongo command = new CommitCommandMongo(mongoConnection, commit);
        String revisionId = command.execute();

        Assert.assertNotNull(revisionId);
        MongoAssert.assertNodesExist("", NodeBuilder.build(String.format(
                "{ \"/#%1$s\" : { \"a#%1$s\" : { \"b#%1$s\" : {} , \"c#%1$s\" : {} } } }", revisionId)));

        MongoAssert.assertCommitExists(commit);
        MongoAssert.assertCommitContainsAffectedPaths(commit.getRevisionId(), "/", "/a", "/a/b", "/a/c");
        MongoAssert.assertHeadRevision(1);
        MongoAssert.assertNextRevision(2);
    }
View Full Code Here

Examples of org.apache.jackrabbit.mongomk.api.model.Commit

        instructions.add(new AddNodeInstructionImpl("/a", "b"));
        instructions.add(new AddPropertyInstructionImpl("/a/b", "key2", "value2"));
        instructions.add(new AddPropertyInstructionImpl("/a/c", "key3", "value3"));
        instructions.add(new AddNodeInstructionImpl("/a", "c"));

        Commit commit = new CommitImpl("/",
                "+a : { \"key1\" : \"value1\" , \"key2\" : \"value2\" , \"key3\" : \"value3\" }",
                "This is a simple commit", instructions);
        CommitCommandMongo command = new CommitCommandMongo(mongoConnection, commit);
        String revisionId = command.execute();

        Assert.assertNotNull(revisionId);
        MongoAssert
                .assertNodesExist(
                        "",
                        NodeBuilder.build(String
                                .format("{ \"/#%1$s\" : { \"a#%1$s\" : { \"key1\" : \"value1\", \"b#%1$s\" : { \"key2\" : \"value2\" } , \"c#%1$s\" : { \"key3\" : \"value3\" } } } }",
                                        revisionId)));

        MongoAssert.assertCommitExists(commit);
        MongoAssert.assertCommitContainsAffectedPaths(commit.getRevisionId(), "/", "/a", "/a/b", "/a/c");
        MongoAssert.assertHeadRevision(1);
        MongoAssert.assertNextRevision(2);
    }
View Full Code Here

Examples of org.apache.jackrabbit.mongomk.api.model.Commit

        instructions.add(new AddNodeInstructionImpl("/a", "b"));
        instructions.add(new AddPropertyInstructionImpl("/a/b", "key2", "value2"));
        instructions.add(new AddNodeInstructionImpl("/a", "c"));
        instructions.add(new AddPropertyInstructionImpl("/a/c", "key3", "value3"));

        Commit commit = new CommitImpl("/",
                "+a : { \"key1\" : \"value1\" , \"key2\" : \"value2\" , \"key3\" : \"value3\" }",
                "This is a simple commit", instructions);
        CommitCommandMongo command = new CommitCommandMongo(mongoConnection, commit);
        String revisionId = command.execute();

        Assert.assertNotNull(revisionId);
        MongoAssert
                .assertNodesExist(
                        "",
                        NodeBuilder.build(String
                                .format("{ \"/#%1$s\" : { \"a#%1$s\" : {  \"int\" : 1 , \"key1\" : \"value1\", \"b#%1$s\" : { \"string\" : \"foo\" , \"key2\" : \"value2\" } , \"c#%1$s\" : { \"bool\" : true , \"key3\" : \"value3\" } } } }",
                                        revisionId)));

        MongoAssert.assertCommitExists(commit);
        // MongoAssert.assertCommitContainsAffectedPaths(commit.getRevisionId(), "/a", "/a/b", "/a/c"); TODO think about
        // whether / should really be included since it already contained /a
        MongoAssert.assertCommitContainsAffectedPaths(commit.getRevisionId(), "/", "/a", "/a/b", "/a/c");
    }
View Full Code Here

Examples of org.apache.jackrabbit.mongomk.api.model.Commit

        List<Instruction> instructions = new LinkedList<Instruction>();
        instructions.add(new AddNodeInstructionImpl("/", "a"));
        instructions.add(new AddNodeInstructionImpl("/a", "b"));
        instructions.add(new AddNodeInstructionImpl("/a", "c"));

        Commit commit = new CommitImpl("/", "+a : { b : {} , c : {} }",
                "This is a simple commit", instructions);
        CommitCommandMongo command = new CommitCommandMongo(mongoConnection, commit);
        String revisionId = command.execute();
        Assert.assertNotNull(revisionId);

        instructions = new LinkedList<Instruction>();
        instructions.add(new RemoveNodeInstructionImpl("/", "a"));

        commit = new CommitImpl("/", "-a", "This is a simple commit", instructions);
        command = new CommitCommandMongo(mongoConnection, commit);
        revisionId = command.execute();
        Assert.assertNotNull(revisionId);

        MongoAssert.assertNodesExist("",
                NodeBuilder.build(String.format("{ \"/#%1$s\" : {} }", revisionId)));

        MongoAssert.assertCommitExists(commit);
        MongoAssert.assertCommitContainsAffectedPaths(commit.getRevisionId(), "/");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.