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"));
}
}
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);
}
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);
}
Aggregations