Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.Node$TreeNode


        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

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

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

        // consume the root tree
        when(consumer.tree(eq(lroot), eq(rroot))).thenReturn(true);
        // but skip the added tree
        when(consumer.tree((Node) isNull(), any(Node.class))).thenReturn(false);
View Full Code Here

        assertDepth(left, leftSource, 2);
        assertDepth(right, rightSource, 2);

        PreOrderDiffWalk visitor = new PreOrderDiffWalk(left, right, leftSource, rightSource);

        final Node lroot = nodeFor(left);
        final Node rroot = nodeFor(right);
        // consume the root tree
        when(consumer.tree(eq(lroot), eq(rroot))).thenReturn(true);

        // skip all buckets of depth 0
        when(consumer.bucket(anyInt(), eq(0), any(Bucket.class), any(Bucket.class))).thenReturn(
View Full Code Here

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

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

        // consume the root tree
        when(consumer.tree(eq(lroot), eq(rroot))).thenReturn(true);
        // but skip the removed tree
        when(consumer.tree(any(Node.class), (Node) isNull())).thenReturn(false);
View Full Code Here

    @Test
    public void testLeafLeafChanged() {
        // two leaf trees
        final RevTree left;
        final RevTree right;
        final Node nodeChange1 = Node.create("f2", ObjectId.forString("forcechange"),
                ObjectId.NULL, TYPE.FEATURE, null);
        final Node nodeChange2 = Node.create("f3", ObjectId.forString("fakefake"), ObjectId.NULL,
                TYPE.FEATURE, null);
        {
            left = createFeaturesTree(leftSource, "f", 5).build();
            // change two nodes
            RevTreeBuilder builder = createFeaturesTree(rightSource, "f", 5);
            builder.put(nodeChange1);
            builder.put(nodeChange2);

            right = builder.build();
        }
        PreOrderDiffWalk visitor = new PreOrderDiffWalk(left, right, leftSource, rightSource);

        when(consumer.tree(any(Node.class), any(Node.class))).thenReturn(true);
        visitor.walk(consumer);
        // call of the root tree nodes
        verify(consumer, times(1)).tree(any(Node.class), any(Node.class));

        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());
        assertEquals(2, rarg.getAllValues().size());

        Node n1 = featureNode("f", 2);// the two added nodes
        Node n2 = featureNode("f", 3);

        assertTrue(larg.getAllValues().contains(n1));
        assertTrue(larg.getAllValues().contains(n2));

        assertTrue(rarg.getAllValues().contains(nodeChange1));
View Full Code Here

    private void createFeatureTypesTree(RevTreeBuilder rootBuilder, String treePath,
            RevTreeBuilder childBuilder) {
        RevTree childTree = childBuilder.build();
        odb.put(childTree);
        Node childRef = Node.create(treePath, childTree.getId(), ObjectId.NULL, TYPE.TREE, null);
        rootBuilder.put(childRef);
    }
View Full Code Here

        return tree;
    }

    private Node featureRef(String parentPath, int i) {
        String path = NodeRef.appendChild(parentPath, String.valueOf(i));
        Node ref = Node.create(path, FAKE_FEATURE_ID, ObjectId.NULL, TYPE.FEATURE, null);
        return ref;
    }
View Full Code Here

TOP

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

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.