Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.Context.command()


        StagingDatabase mockIndexDb = mock(StagingDatabase.class);
        Context mockCommands = mock(Context.class);
        RefParse mockRefParse = mock(RefParse.class);

        when(mockRefParse.setName(anyString())).thenReturn(mockRefParse);
        when(mockCommands.command(eq(RefParse.class))).thenReturn(mockRefParse);
        Optional<Ref> ref = Optional.absent();
        when(mockRefParse.call()).thenReturn(ref);

        List<ObjectId> oIds = Arrays.asList(ObjectId.forString("Object 1"),
                ObjectId.forString("Object 2"));
View Full Code Here


        Context mockCommandLocator = mock(Context.class);
        when(mockCommandLocator.refDatabase()).thenReturn(mockRefDb);
        command.setContext(mockCommandLocator);
        ResolveObjectType mockResolveObjectType = mock(ResolveObjectType.class);
        when(mockCommandLocator.command(eq(ResolveObjectType.class))).thenReturn(
                mockResolveObjectType);

        when(mockResolveObjectType.setObjectId((ObjectId) anyObject())).thenReturn(
                mockResolveObjectType);
        when(mockResolveObjectType.call()).thenReturn(TYPE.COMMIT);
View Full Code Here

        hashCommand = new HashObject();

        Context mockCommandLocator = mock(Context.class);
        hashCommand.setContext(mockCommandLocator);
        when(mockCommandLocator.command(eq(DescribeFeatureType.class))).thenReturn(
                new DescribeFeatureType());
    }

    @Test
    public void testHashNullObject() throws Exception {
View Full Code Here

                    "No transaction was specified, commit requires a transaction to preserve the stability of the repository.");
        }
        final Context geogig = this.getCommandLocator(context);
        RevCommit commit;
        try {
            commit = geogig.command(CommitOp.class)
                    .setAuthor(authorName.orNull(), authorEmail.orNull()).setMessage(message)
                    .setAllowEmpty(true).setAll(all).call();
            assert commit != null;
        } catch (NothingToCommitException noChanges) {
            context.setResponseContent(CommandResponse.warning("Nothing to commit"));
View Full Code Here

            commit = null;
        }
        if (commit != null) {
            final RevCommit commitToWrite = commit;
            final ObjectId parentId = commit.parentN(0).or(ObjectId.NULL);
            final Iterator<DiffEntry> diff = geogig.command(DiffOp.class).setOldVersion(parentId)
                    .setNewVersion(commit.getId()).call();

            context.setResponseContent(new CommandResponse() {
                @Override
                public void write(ResponseWriter out) throws Exception {
View Full Code Here

        Optional<RevTree> newTree = Optional.absent();
        Optional<RevTree> oldTree = Optional.absent();

        // get tree from new commit
        Optional<ObjectId> treeId = geogig.command(ResolveTreeish.class).setTreeish(newCommitId)
                .call();

        Preconditions.checkState(treeId.isPresent(),
                "New commit id did not resolve to a valid tree.");
        newTree = geogig.command(RevObjectParse.class).setRefSpec(treeId.get().toString())
View Full Code Here

        Optional<ObjectId> treeId = geogig.command(ResolveTreeish.class).setTreeish(newCommitId)
                .call();

        Preconditions.checkState(treeId.isPresent(),
                "New commit id did not resolve to a valid tree.");
        newTree = geogig.command(RevObjectParse.class).setRefSpec(treeId.get().toString())
                .call(RevTree.class);
        Preconditions.checkState(newTree.isPresent(), "Unable to read the new commit tree.");

        // get tree from old commit
        treeId = geogig.command(ResolveTreeish.class).setTreeish(oldCommitId).call();
View Full Code Here

        newTree = geogig.command(RevObjectParse.class).setRefSpec(treeId.get().toString())
                .call(RevTree.class);
        Preconditions.checkState(newTree.isPresent(), "Unable to read the new commit tree.");

        // get tree from old commit
        treeId = geogig.command(ResolveTreeish.class).setTreeish(oldCommitId).call();

        Preconditions.checkState(treeId.isPresent(),
                "Old commit id did not resolve to a valid tree.");
        oldTree = geogig.command(RevObjectParse.class).setRefSpec(treeId.get().toString())
                .call(RevTree.class);
View Full Code Here

        // get tree from old commit
        treeId = geogig.command(ResolveTreeish.class).setTreeish(oldCommitId).call();

        Preconditions.checkState(treeId.isPresent(),
                "Old commit id did not resolve to a valid tree.");
        oldTree = geogig.command(RevObjectParse.class).setRefSpec(treeId.get().toString())
                .call(RevTree.class);
        Preconditions.checkState(newTree.isPresent(), "Unable to read the old commit tree.");

        // get feature from old tree
        Optional<NodeRef> node = geogig.command(FindTreeChild.class).setParent(oldTree.get())
View Full Code Here

        oldTree = geogig.command(RevObjectParse.class).setRefSpec(treeId.get().toString())
                .call(RevTree.class);
        Preconditions.checkState(newTree.isPresent(), "Unable to read the old commit tree.");

        // get feature from old tree
        Optional<NodeRef> node = geogig.command(FindTreeChild.class).setParent(oldTree.get())
                .setIndex(true).setChildPath(featurePath).call();
        boolean delete = false;
        if (!node.isPresent()) {
            delete = true;
            node = geogig.command(FindTreeChild.class).setParent(newTree.get()).setIndex(true)
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.