Package org.locationtech.geogig.repository

Examples of org.locationtech.geogig.repository.WorkingTree


    public void testMappingNodes() throws Exception {
        // import and check that we have nodes
        String filename = OSMImportOp.class.getResource("nodes.xml").getFile();
        File file = new File(filename);
        geogig.command(OSMImportOp.class).setDataSource(file.getAbsolutePath()).call();
        WorkingTree workTree = geogig.getRepository().workingTree();
        long unstaged = workTree.countUnstaged("node").count();
        assertTrue(unstaged > 0);
        geogig.command(AddOp.class).call();
        geogig.command(CommitOp.class).setMessage("msg").call();
        // Define mapping
        Map<String, AttributeDefinition> fields = Maps.newHashMap();
View Full Code Here


    public void testMappingWithExclusion() throws Exception {
        // import and check that we have nodes
        String filename = OSMImportOp.class.getResource("nodes.xml").getFile();
        File file = new File(filename);
        geogig.command(OSMImportOp.class).setDataSource(file.getAbsolutePath()).call();
        WorkingTree workTree = geogig.getRepository().workingTree();
        long unstaged = workTree.countUnstaged("node").count();
        assertTrue(unstaged > 0);
        geogig.command(AddOp.class).call();
        geogig.command(CommitOp.class).setMessage("msg").call();
        // Define mapping
        Map<String, AttributeDefinition> fields = Maps.newHashMap();
View Full Code Here

    public void testMappingNodesWithAlias() throws Exception {
        // import and check that we have nodes
        String filename = OSMImportOp.class.getResource("nodes.xml").getFile();
        File file = new File(filename);
        geogig.command(OSMImportOp.class).setDataSource(file.getAbsolutePath()).call();
        WorkingTree workTree = geogig.getRepository().workingTree();
        long unstaged = workTree.countUnstaged("node").count();
        assertTrue(unstaged > 0);
        geogig.command(AddOp.class).call();
        geogig.command(CommitOp.class).setMessage("msg").call();

        // Define mapping
View Full Code Here

        // Test that an exception is thrown when the mapping does not contain a geometry field

        String filename = OSMImportOp.class.getResource("ways.xml").getFile();
        File file = new File(filename);
        geogig.command(OSMImportOp.class).setDataSource(file.getAbsolutePath()).call();
        WorkingTree workTree = geogig.getRepository().workingTree();
        long unstaged = workTree.countUnstaged("way").count();
        assertTrue(unstaged > 0);
        unstaged = workTree.countUnstaged("node").count();
        assertTrue(unstaged > 0);
        geogig.command(AddOp.class).call();
        geogig.command(CommitOp.class).setMessage("msg").call();
        // Define a wrong mapping without geometry
        Map<String, AttributeDefinition> fields = Maps.newHashMap();
View Full Code Here

        // Test that if no filter is specified in a mapping rule, all entities pass the filter

        String filename = OSMImportOp.class.getResource("ways.xml").getFile();
        File file = new File(filename);
        geogig.command(OSMImportOp.class).setDataSource(file.getAbsolutePath()).call();
        WorkingTree workTree = geogig.getRepository().workingTree();
        long unstaged = workTree.countUnstaged("way").count();
        assertTrue(unstaged > 0);
        geogig.command(AddOp.class).call();
        geogig.command(CommitOp.class).setMessage("msg").call();
        Map<String, AttributeDefinition> fields = Maps.newHashMap();
        Map<String, List<String>> filters = Maps.newHashMap();
View Full Code Here

        // Test that when no tags are specified, all entities pass the filter

        String filename = OSMImportOp.class.getResource("ways.xml").getFile();
        File file = new File(filename);
        geogig.command(OSMImportOp.class).setDataSource(file.getAbsolutePath()).call();
        WorkingTree workTree = geogig.getRepository().workingTree();
        long unstaged = workTree.countUnstaged("way").count();
        assertTrue(unstaged > 0);
        geogig.command(AddOp.class).call();
        geogig.command(CommitOp.class).setMessage("msg").call();
        Map<String, AttributeDefinition> fields = Maps.newHashMap();
        Map<String, List<String>> filters = Maps.newHashMap();
View Full Code Here

    public void testMappingAndUnmappingOfWays() throws Exception {
        // Import
        String filename = OSMImportOp.class.getResource("ways.xml").getFile();
        File file = new File(filename);
        geogig.command(OSMImportOp.class).setDataSource(file.getAbsolutePath()).call();
        WorkingTree workTree = geogig.getRepository().workingTree();
        long unstaged = workTree.countUnstaged("node").count();
        assertTrue(unstaged > 0);
        unstaged = workTree.countUnstaged("way").count();
        assertTrue(unstaged > 0);
        geogig.command(AddOp.class).call();
        geogig.command(CommitOp.class).setMessage("msg").call();

        // map
View Full Code Here

    public void testMappingAndUnmappingOfWaysFromPolygons() throws Exception {
        // import and check that we have both ways and nodes
        String filename = OSMImportOp.class.getResource("ways_restriction.xml").getFile();
        File file = new File(filename);
        geogig.command(OSMImportOp.class).setDataSource(file.getAbsolutePath()).call();
        WorkingTree workTree = geogig.getRepository().workingTree();
        long unstaged = workTree.countUnstaged("way").count();
        assertTrue(unstaged > 0);
        unstaged = workTree.countUnstaged("node").count();
        assertTrue(unstaged > 0);
        geogig.command(AddOp.class).call();
        geogig.command(CommitOp.class).setMessage("msg").call();

        // Define mapping
View Full Code Here

        assertEquals(507464799l, values.get(0).get());

        // unmap without having made any changes and check that the canonical folders are not
        // modified
        geogig.command(OSMUnmapOp.class).setPath("busstops").call();
        WorkingTree workTree = geogig.getRepository().workingTree();
        long unstaged = workTree.countUnstaged("way").count();
        assertEquals(0, unstaged);
        unstaged = workTree.countUnstaged("node").count();
        assertEquals(0, unstaged);

        // Modify a node
        GeometryFactory gf = new GeometryFactory();
        SimpleFeatureBuilder fb = new SimpleFeatureBuilder((SimpleFeatureType) featureType.get()
                .type());
        fb.set("geom", gf.createPoint(new Coordinate(0, 1)));
        fb.set("name_alias", "newname");
        fb.set("id", 507464799l);
        SimpleFeature newFeature = fb.buildFeature("507464799");
        geogig.getRepository().workingTree().insert("busstops", newFeature);

        // check that it was correctly inserted in the working tree
        Optional<RevFeature> mapped = geogig.command(RevObjectParse.class)
                .setRefSpec("WORK_HEAD:busstops/507464799").call(RevFeature.class);
        assertTrue(mapped.isPresent());
        values = mapped.get().getValues();
        assertEquals("POINT (0 1)", values.get(2).get().toString());
        assertEquals(507464799l, ((Long) values.get(0).get()).longValue());
        assertEquals("newname", values.get(1).get().toString());

        // unmap
        geogig.command(OSMUnmapOp.class).setPath("busstops").call();

        unstaged = workTree.countUnstaged("node").featureCount();
        assertEquals(1, unstaged);

        // check that the unmapped node has the changes we introduced
        Optional<RevFeature> unmapped = geogig.command(RevObjectParse.class)
                .setRefSpec("WORK_HEAD:node/507464799").call(RevFeature.class);
View Full Code Here

                values.get(1).get().toString());

        // unmap
        geogig.command(OSMUnmapOp.class).setPath("busstops").call();

        WorkingTree workTree = geogig.getRepository().workingTree();
        long unstaged = workTree.countUnstaged("node").featureCount();
        assertEquals(1, unstaged);

        // check that the unmapped node has the changes we introduced
        Optional<RevFeature> unmapped = geogig.command(RevObjectParse.class)
                .setRefSpec("WORK_HEAD:node/507464799").call(RevFeature.class);
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.repository.WorkingTree

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.