Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.Node


        String key = "Feature." + i;
        // ObjectId oid = ObjectId.forString(key);
        // ObjectId metadataId = ObjectId.forString("FeatureType");
        // Node ref = new Node(key, oid, metadataId, TYPE.FEATURE);

        Node ref = Node.create(key, FAKE_ID, FAKE_ID, TYPE.FEATURE, boundsOf(points1));
        tree.put(ref);
    }
View Full Code Here


     */
    private static Node node(int i) {
        String key = String.valueOf(i);
        ObjectId oid = ObjectId.forString(key);
        Envelope bounds = new Envelope(i, i + 1, i, i + 1);
        Node node = Node.create(key, oid, ObjectId.NULL, TYPE.FEATURE, bounds);
        return node;
    }
View Full Code Here

        assertNode(root.getChild("buildings").getChild("unknown"), id("a6"), id("d4"), "unknown");
    }

    @Test
    public void testSet() {
        Node node = treeNode("roads", id("a11"), id("d1"));
        root.setChild("", node);
        assertEquals(node, root.getChild("roads").getNode());

        node = treeNode("stores", id("a51"), id("d3"));
        root.setChild("buildings", node);
View Full Code Here

    private void assertNode(MutableTree mutableTree, ObjectId treeId, @Nullable ObjectId metadtaId,
            String nodeName) {

        assertNotNull(mutableTree);
        Node node = mutableTree.getNode();
        assertNotNull(node);

        assertEquals(treeId, node.getObjectId());
        if (metadtaId == null) {
            assertFalse(node.getMetadataId().isPresent());
        } else {
            assertEquals(metadtaId, node.getMetadataId().get());
        }
        assertEquals(nodeName, node.getName());
        assertEquals(TYPE.TREE, node.getType());

    }
View Full Code Here

    private NodeRef tree(String path, ObjectId treeId, ObjectId metadataId) {

        String parentPath = NodeRef.parentPath(path);
        String name = NodeRef.nodeFromPath(path);

        Node node = treeNode(name, treeId, metadataId);

        return new NodeRef(node, parentPath, ObjectId.NULL);
    }
View Full Code Here

        return new NodeRef(node, parentPath, ObjectId.NULL);
    }

    private Node treeNode(String name, ObjectId treeId, ObjectId metadataId) {
        Node node = Node.create(name, treeId, metadataId, TYPE.TREE, null);
        return node;
    }
View Full Code Here

        visitor.walk(consumer);

        when(consumer.tree(any(Node.class), any(Node.class))).thenReturn(false);

        final Node lNode = nodeFor(left);
        final Node rNode = nodeFor(right);

        ArgumentCaptor<Node> leftNode = ArgumentCaptor.forClass(Node.class);
        ArgumentCaptor<Node> rightNode = ArgumentCaptor.forClass(Node.class);

        verify(consumer, times(1)).tree(leftNode.capture(), rightNode.capture());
View Full Code Here

        // two leaf trees
        RevTree left = createFeaturesTree(leftSource, "f", 3).build();
        RevTree right = createFeaturesTree(rightSource, "f", 5).build();
        PreOrderDiffWalk visitor = new PreOrderDiffWalk(left, right, leftSource, rightSource);

        final Node lroot = nodeFor(left);
        final Node rroot = nodeFor(right);

        when(consumer.tree(eq(lroot), eq(rroot))).thenReturn(true);

        visitor.walk(consumer);

        verify(consumer, times(1)).tree(eq(lroot), eq(rroot));

        ArgumentCaptor<Node> larg = ArgumentCaptor.forClass(Node.class);
        ArgumentCaptor<Node> rarg = ArgumentCaptor.forClass(Node.class);

        verify(consumer, times(2)).feature(larg.capture(), rarg.capture());

        assertEquals(2, larg.getAllValues().size());
        assertNull(larg.getAllValues().get(0));
        assertNull(larg.getAllValues().get(1));

        Node n1 = featureNode("f", 3);// the two added nodes
        Node n2 = featureNode("f", 4);
        assertTrue(rarg.getAllValues().contains(n1));
        assertTrue(rarg.getAllValues().contains(n2));

        verify(consumer, times(1)).endTree(eq(lroot), eq(rroot));
        verifyNoMoreInteractions(consumer);
View Full Code Here

        // two leaf trees
        RevTree left = createFeaturesTree(leftSource, "f", 5).build();
        RevTree right = createFeaturesTree(rightSource, "f", 3).build();
        PreOrderDiffWalk visitor = new PreOrderDiffWalk(left, right, leftSource, rightSource);

        final Node lroot = nodeFor(left);
        final Node rroot = nodeFor(right);

        when(consumer.tree(eq(lroot), eq(rroot))).thenReturn(true);

        visitor.walk(consumer);

        verify(consumer, times(1)).tree(eq(lroot), eq(rroot));

        ArgumentCaptor<Node> larg = ArgumentCaptor.forClass(Node.class);
        ArgumentCaptor<Node> rarg = ArgumentCaptor.forClass(Node.class);

        verify(consumer, times(2)).feature(larg.capture(), rarg.capture());

        assertEquals(2, larg.getAllValues().size());
        assertNull(rarg.getAllValues().get(0));
        assertNull(rarg.getAllValues().get(1));

        Node n1 = featureNode("f", 3);// the two added nodes
        Node n2 = featureNode("f", 4);
        assertTrue(larg.getAllValues().contains(n1));
        assertTrue(larg.getAllValues().contains(n2));

        verify(consumer, times(1)).endTree(eq(lroot), eq(rroot));
        verifyNoMoreInteractions(consumer);
View Full Code Here

        ObjectId metadataId = ObjectId.forString("fake");
        RevTree left = createTreesTree(leftSource, 2, 100, metadataId).build();
        RevTree right = createTreesTree(rightSource, 3, 100, metadataId).build();
        PreOrderDiffWalk visitor = new PreOrderDiffWalk(left, right, leftSource, rightSource);

        final Node lroot = nodeFor(left);
        final Node rroot = nodeFor(right);

        // consume any tree diff
        when(consumer.tree(any(Node.class), any(Node.class))).thenReturn(true);

        visitor.walk(consumer);
View Full Code Here

TOP

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

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.