Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.ObjectId


        // | o - commit9
        // |
        // o - commit10
        // |
        // o - commit11
        ObjectId rootId = ObjectId.forString("root commit");
        ImmutableList<ObjectId> parents = ImmutableList.of();
        database.put(rootId, parents);
        ObjectId commit1 = ObjectId.forString("commit1");
        parents = ImmutableList.of(rootId);
        database.put(commit1, parents);
        ObjectId commit2 = ObjectId.forString("commit2");
        parents = ImmutableList.of(commit1);
        database.put(commit2, parents);
        ObjectId commit3 = ObjectId.forString("commit3");
        parents = ImmutableList.of(commit2);
        database.put(commit3, parents);
        ObjectId commit4 = ObjectId.forString("commit4");
        parents = ImmutableList.of(commit3);
        database.put(commit4, parents);
        ObjectId commit5 = ObjectId.forString("commit5");
        parents = ImmutableList.of(commit3);
        database.put(commit5, parents);
        ObjectId commit6 = ObjectId.forString("commit6");
        parents = ImmutableList.of(commit5, commit4);
        database.put(commit6, parents);
        ObjectId commit7 = ObjectId.forString("commit7");
        parents = ImmutableList.of(rootId);
        database.put(commit7, parents);
        ObjectId commit8 = ObjectId.forString("commit8");
        parents = ImmutableList.of(commit2);
        database.put(commit8, parents);
        ObjectId commit9 = ObjectId.forString("commit9");
        parents = ImmutableList.of(commit7, commit8);
        database.put(commit9, parents);
        ObjectId commit10 = ObjectId.forString("commit10");
        parents = ImmutableList.of();
        database.put(commit10, parents);
        ObjectId commit11 = ObjectId.forString("commit11");
        parents = ImmutableList.of(commit10);
        database.put(commit11, parents);

        System.out.println("Testing depth");
        assertEquals(0, database.getDepth(rootId));
View Full Code Here


    protected ObjectId insert(GeoGIG geogig, Feature f) throws Exception {
        final WorkingTree workTree = geogig.getRepository().workingTree();
        Name name = f.getType().getName();
        String parentPath = name.getLocalPart();
        Node ref = workTree.insert(parentPath, f);
        ObjectId objectId = ref.getObjectId();
        return objectId;
    }
View Full Code Here

            commitId = currHead.get().getObjectId();
        }
        RevPerson tagger = resolveTagger();
        message = message == null ? "" : message;
        RevTag tag = new RevTagImpl(ObjectId.NULL, name, commitId, message, tagger);
        ObjectId id = command(HashObject.class).setObject(tag).call();
        tag = new RevTagImpl(id, name, commitId, message, tagger);
        objectDatabase().put(tag);
        Optional<Ref> branchRef = command(UpdateRef.class).setName(tagRefPath)
                .setNewValue(tag.getId()).call();
        checkState(branchRef.isPresent());
View Full Code Here

    }

    @Test
    public void testRoundTripBucketsFull() {

        ObjectId id = ObjectId.forString("fake");
        long size = 100000000;
        int childTreeCount = 0;
        Map<Integer, Bucket> bucketTrees = createBuckets(32);

        final RevTreeImpl tree = RevTreeImpl.createNodeTree(id, size, childTreeCount, bucketTrees);
View Full Code Here

    public void testDiffPreconditions() throws Exception {
        Iterator<DiffEntry> difflist = geogig.command(DiffOp.class).call();
        assertNotNull(difflist);
        assertFalse(difflist.hasNext());

        final ObjectId oid1 = insertAndAdd(points1);
        final RevCommit commit1_1 = geogig.command(CommitOp.class).call();
        try {
            diffOp.setOldVersion(oid1.toString()).setNewVersion(Ref.HEAD).call();
            fail("Expected IAE as oldVersion is not a commit");
        } catch (IllegalArgumentException e) {
            assertTrue(e.getMessage(), e.getMessage().contains(oid1.toString()));
            assertTrue(e.getMessage(),
                    e.getMessage().contains("doesn't resolve to a tree-ish object"));
        }
        try {
            diffOp.setOldVersion(commit1_1.getId().toString()).setNewVersion(oid1.toString())
                    .call();
            fail("Expected IAE as newVersion is not a commit");
        } catch (IllegalArgumentException e) {
            assertTrue(e.getMessage(), e.getMessage().contains(oid1.toString()));
            assertTrue(e.getMessage(),
                    e.getMessage().contains("doesn't resolve to a tree-ish object"));
        }
    }
View Full Code Here

    }

    @Test
    public void testSingleAddition() throws Exception {

        final ObjectId newOid = insertAndAdd(points1);
        geogig.command(CommitOp.class).setAll(true).call();

        List<DiffEntry> difflist = toList(diffOp.setOldVersion(ObjectId.NULL)
                .setNewVersion(Ref.HEAD).call());
View Full Code Here

    }

    @Test
    public void testSingleAdditionReverseOrder() throws Exception {

        final ObjectId newOid = insertAndAdd(points1);
        final RevCommit commit = geogig.command(CommitOp.class).setAll(true).call();

        List<DiffEntry> difflist = toList(diffOp.setOldVersion(commit.getId())
                .setNewVersion(ObjectId.NULL).call());
View Full Code Here

        assertFalse(de.getOldObject().getMetadataId().isNull());
    }

    @Test
    public void testSingleDeletion() throws Exception {
        final ObjectId featureContentId = insertAndAdd(points1);
        final RevCommit addCommit = geogig.command(CommitOp.class).setAll(true).call();

        assertTrue(deleteAndAdd(points1));
        final RevCommit deleteCommit = geogig.command(CommitOp.class).setAll(true).call();
View Full Code Here

    }

    @Test
    public void testSingleDeletionReverseOrder() throws Exception {

        final ObjectId featureContentId = insertAndAdd(points1);
        final RevCommit addCommit = geogig.command(CommitOp.class).setAll(true).call();

        assertTrue(deleteAndAdd(points1));
        final RevCommit deleteCommit = geogig.command(CommitOp.class).setAll(true).call();
View Full Code Here

    }

    @Test
    public void testSingleModification() throws Exception {

        final ObjectId oldOid = insertAndAdd(points1);
        final RevCommit insertCommit = geogig.command(CommitOp.class).setAll(true).call();

        final String featureId = points1.getIdentifier().getID();
        final Feature modifiedFeature = feature((SimpleFeatureType) points1.getType(), featureId,
                "changedProp", new Integer(1500), null);

        final ObjectId newOid = insertAndAdd(modifiedFeature);

        final RevCommit changeCommit = geogig.command(CommitOp.class).setAll(true).call();

        List<DiffEntry> difflist = toList(diffOp.setOldVersion(insertCommit.getId())
                .setNewVersion(changeCommit.getId()).call());
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.api.ObjectId

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.