Search in sources :

Example 11 with CmdArgs

use of com.graphhopper.util.CmdArgs in project graphhopper by graphhopper.

the class GraphHopperOSMTest method testFailsForWrongConfig.

@Test
public void testFailsForWrongConfig() throws IOException {
    instance = new GraphHopperOSM().init(new CmdArgs().put("datareader.file", testOsm3).put("datareader.dataaccess", "RAM").put("graph.flag_encoders", "foot,car").put(Parameters.CH.PREPARE + "weightings", "no")).setGraphHopperLocation(ghLoc);
    instance.importOrLoad();
    assertEquals(5, instance.getGraphHopperStorage().getNodes());
    instance.close();
    // different config (flagEncoder list)
    try {
        GraphHopper tmpGH = new GraphHopperOSM().init(new CmdArgs().put("datareader.file", testOsm3).put("datareader.dataaccess", "RAM").put("graph.flag_encoders", "foot").put(Parameters.CH.PREPARE + "weightings", "no")).setDataReaderFile(testOsm3);
        tmpGH.load(ghLoc);
        assertTrue(false);
    } catch (Exception ex) {
        assertTrue(ex.getMessage(), ex.getMessage().startsWith("Encoding does not match"));
    }
    // different bytesForFlags should fail to load
    instance = new GraphHopperOSM().init(new CmdArgs().put("datareader.file", testOsm3).put("datareader.dataaccess", "RAM").put("graph.flag_encoders", "foot,car").put("graph.bytes_for_flags", 8).put(Parameters.CH.PREPARE + "weightings", "no")).setDataReaderFile(testOsm3);
    try {
        instance.load(ghLoc);
        assertTrue(false);
    } catch (Exception ex) {
        assertTrue(ex.getMessage(), ex.getMessage().startsWith("Configured graph.bytes_for_flags (8) is not equal to loaded 4"));
    }
    // different order is no longer okay, see #350
    try {
        GraphHopper tmpGH = new GraphHopperOSM().init(new CmdArgs().put("datareader.file", testOsm3).put("datareader.dataaccess", "RAM").put(Parameters.CH.PREPARE + "weightings", "no").put("graph.flag_encoders", "car,foot")).setDataReaderFile(testOsm3);
        tmpGH.load(ghLoc);
        assertTrue(false);
    } catch (Exception ex) {
        assertTrue(ex.getMessage(), ex.getMessage().startsWith("Encoding does not match"));
    }
}
Also used : CmdArgs(com.graphhopper.util.CmdArgs) GraphHopper(com.graphhopper.GraphHopper) IOException(java.io.IOException) Test(org.junit.Test)

Example 12 with CmdArgs

use of com.graphhopper.util.CmdArgs in project graphhopper by graphhopper.

the class GraphHopperServletWithEleIT method setUp.

@Before
public void setUp() {
    CmdArgs args = new CmdArgs().put("graph.elevation.provider", "srtm").put("graph.elevation.cachedir", "../core/files/").put(Parameters.CH.PREPARE + "weightings", "no").put("prepare.min_one_way_network_size", "0").put("config", "../config-example.properties").put("datareader.file", "../core/files/monaco.osm.gz").put("graph.location", dir);
    setUpJetty(args);
}
Also used : CmdArgs(com.graphhopper.util.CmdArgs) Before(org.junit.Before)

Example 13 with CmdArgs

use of com.graphhopper.util.CmdArgs in project graphhopper by graphhopper.

the class NearestServletWithEleIT method setUp.

@Before
public void setUp() {
    CmdArgs args = new CmdArgs().put("graph.elevation.provider", "srtm").put("graph.elevation.cachedir", "../core/files/").put(Parameters.CH.PREPARE + "weightings", "no").put("prepare.min_one_way_network_size", "0").put("config", "../config-example.properties").put("datareader.file", "../core/files/monaco.osm.gz").put("graph.location", dir);
    setUpJetty(args);
}
Also used : CmdArgs(com.graphhopper.util.CmdArgs) Before(org.junit.Before)

Aggregations

CmdArgs (com.graphhopper.util.CmdArgs)13 Before (org.junit.Before)7 Test (org.junit.Test)5 GHRequest (com.graphhopper.GHRequest)3 GraphHopper (com.graphhopper.GraphHopper)3 GHResponse (com.graphhopper.GHResponse)2 PathWrapper (com.graphhopper.PathWrapper)1 GraphHopperOSM (com.graphhopper.reader.osm.GraphHopperOSM)1 PrepareContractionHierarchies (com.graphhopper.routing.ch.PrepareContractionHierarchies)1 GHPoint (com.graphhopper.util.shapes.GHPoint)1 IOException (java.io.IOException)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1