Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.NodeRef


        }
    }

    @Test
    public void testCreateTypeTree() throws Exception {
        NodeRef treeRef = workTree.createTypeTree("points2", pointsType);
        assertNotNull(treeRef);
        assertEquals("points2", treeRef.path());
        assertEquals("", treeRef.getParentPath());
        assertTrue(treeRef.getNode().getMetadataId().isPresent());
        assertSame(treeRef.getMetadataId(), treeRef.getNode().getMetadataId().get());

        RevFeatureType featureType = repo.stagingDatabase().getFeatureType(treeRef.getMetadataId());
        assertEquals(pointsType, featureType.type());
    }
View Full Code Here


        assertEquals(pointsType, featureType.type());
    }

    @Test
    public void testCreateTypeNestedNonExistingParent() throws Exception {
        NodeRef treeRef = workTree.createTypeTree("path/to/nested/type", pointsType);
        assertNotNull(treeRef);
        assertEquals("path/to/nested/type", treeRef.path());
        assertEquals("path/to/nested", treeRef.getParentPath());
        assertTrue(treeRef.getNode().getMetadataId().isPresent());
        assertSame(treeRef.getMetadataId(), treeRef.getNode().getMetadataId().get());

        RevFeatureType featureType = repo.stagingDatabase().getFeatureType(treeRef.getMetadataId());
        assertEquals(pointsType, featureType.type());
    }
View Full Code Here

        Iterator<NodeRef> iter = command(LsTreeOp.class).setReference(path)
                .setStrategy(Strategy.FEATURES_ONLY).call();

        FeatureMapFlusher flusher = new FeatureMapFlusher(workingTree());
        while (iter.hasNext()) {
            NodeRef node = iter.next();
            RevFeature revFeature = command(RevObjectParse.class).setObjectId(node.objectId())
                    .call(RevFeature.class).get();
            RevFeatureType revFeatureType = command(RevObjectParse.class)
                    .setObjectId(node.getMetadataId()).call(RevFeatureType.class).get();
            List<PropertyDescriptor> descriptors = revFeatureType.sortedDescriptors();
            ImmutableList<Optional<Object>> values = revFeature.getValues();
            SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(
                    (SimpleFeatureType) revFeatureType.type());
            String id = null;
View Full Code Here

        RevCommit commit = geogig.command(CommitOp.class).setMessage("Removed lines").call();
        Iterator<NodeRef> nodes = geogig.command(LsTreeOp.class).call();

        while (nodes.hasNext()) {
            NodeRef node = nodes.next();
            assertNotNull(node);
        }

        geogig.command(ResetOp.class).setMode(ResetMode.HARD).call();

        nodes = geogig.command(LsTreeOp.class).call();
        while (nodes.hasNext()) {
            NodeRef node = nodes.next();
            assertNotNull(node);
        }
    }
View Full Code Here

        for (FeatureId id : ids) {
            assertFalse("ResourceId is a query object", id instanceof ResourceId);
            assertNotNull(id.getID());
            assertNotNull(id + " has no featureVersion set", id.getFeatureVersion());
            NodeRef ref = expected.get(id.getID());
            assertNotNull(ref);
            assertEquals(ref.objectId().toString(), id.getFeatureVersion());
        }
    }
View Full Code Here

            RevFeatureType featureType = getFeatureTypeFromRefSpec();
            RevFeature feat = feature.get();
            Envelope bounds = SpatialOps.boundsOf(feat);
            Node node = Node.create(NodeRef.nodeFromPath(ref), feat.getId(), featureType.getId(),
                    TYPE.FEATURE, bounds);
            return Optional.of(new NodeRef(node, NodeRef.parentPath(ref), featureType.getId()));

        } else {
            return Optional.absent();
            /*
             * new NodeRef(Node.create("", ObjectId.NULL, ObjectId.NULL, TYPE.FEATURE), "",
View Full Code Here

        System.err.println("traversing with DepthTreeIterator...");
        sw.reset().start();
        int counted = 0;
        for (DepthTreeIterator it = new DepthTreeIterator("", ObjectId.NULL, tree, odb,
                Strategy.CHILDREN); it.hasNext(); counted++) {
            NodeRef ref = it.next();
            if ((counted + 1) % (numEntries / 10) == 0) {
                System.err.print("#" + (counted + 1));
            } else if ((counted + 1) % (numEntries / 100) == 0) {
                System.err.print('.');
            }
        }
        sw.stop();
        System.err.println("\nTraversed " + counted + " in " + sw + " ("
                + Math.round(counted / (sw.elapsed(TimeUnit.MILLISECONDS) / 1000D)) + "/s)\n");

        System.err.println("traversing with DepthTreeIterator...");
        sw.reset().start();
        counted = 0;
        for (DepthTreeIterator it = new DepthTreeIterator("", ObjectId.NULL, tree, odb,
                Strategy.CHILDREN); it.hasNext(); counted++) {
            NodeRef ref = it.next();
            if ((counted + 1) % (numEntries / 10) == 0) {
                System.err.print("#" + (counted + 1));
            } else if ((counted + 1) % (numEntries / 100) == 0) {
                System.err.print('.');
            }
View Full Code Here

        {
            int i = 0;
            DepthTreeIterator it = new DepthTreeIterator("", ObjectId.NULL, tree, odb,
                    Strategy.CHILDREN);
            for (; it.hasNext(); i++) {
                NodeRef entry = it.next();
                if (i % 10 == 0) {
                    removedKeys.add(entry.path());
                }
            }
            assertEquals(100, removedKeys.size());
        }
View Full Code Here

        {
            int i = 0;
            DepthTreeIterator it = new DepthTreeIterator("", ObjectId.NULL, tree, odb,
                    Strategy.CHILDREN);
            for (; it.hasNext(); i++) {
                NodeRef entry = it.next();
                if (i % 10 == 0) {
                    removedKeys.add(entry.path());
                }
            }
            assertTrue(removedKeys.size() > 0);
        }
View Full Code Here

        Optional<NodeRef> node = geogig.command(FindTreeChild.class)
                .setParent(geogig.workingTree().getTree()).setIndex(true).setChildPath(path)
                .call();
        if (node.isPresent()) {
            NodeRef nodeRef = node.get();
            if (nodeRef.getType() == TYPE.TREE) {
                if (!recursive) {
                    throw new CommandSpecException(
                            "Recursive option must be used to remove a tree.");
                }
            }
View Full Code Here

TOP

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

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.