@Override public void close() { properties.close(); baseGraph.close(); for (CHGraphImpl cg : chGraphs) { cg.close(); } }
@Test public void testStore() { String dir = "./target/test"; Helper.removeDir(new File(dir)); StorableProperties instance = new StorableProperties(createDir(dir, true)); instance.create(1000); instance.put("test.min", 123); instance.put("test.max", 321); instance.flush(); instance.close(); instance = new StorableProperties(createDir(dir, true)); assertTrue(instance.loadExisting()); assertEquals("123", instance.get("test.min")); assertEquals("321", instance.get("test.max")); instance.close(); Helper.removeDir(new File(dir)); }
@Test public void testLoad() { StorableProperties instance = new StorableProperties(createDir("", false)); // an in-memory storage does not load anything assertFalse(instance.loadExisting()); instance = new StorableProperties(createDir("", true)); assertFalse(instance.loadExisting()); instance.close(); }
@Test public void testVersionCheck() { StorableProperties instance = new StorableProperties(createDir("", false)); instance.putCurrentVersions(); assertTrue(instance.checkVersions(true)); instance.put("nodes.version", 0); assertFalse(instance.checkVersions(true)); try { instance.checkVersions(false); assertTrue(false); } catch (Exception ex) { } instance.close(); }
@Override public void close() { properties.close(); baseGraph.close(); for (CHGraphImpl cg : chGraphs) { cg.close(); } }
@Override public void close() { properties.close(); baseGraph.close(); for (CHGraphImpl cg : chGraphs) { cg.close(); } }
@Override public void close() { properties.close(); baseGraph.close(); for (CHGraphImpl cg : chGraphs) { cg.close(); } }
StorableProperties properties = new StorableProperties(dir); if (!properties.loadExisting()) { properties.close(); throw new RuntimeException("Cannot find properties file"); properties.close(); throw new RuntimeException("Unsupported vehicle type"); properties.close(); throw new RuntimeException("Graph was built with wrong encoder version - probably built using an older version of the graphhopper library?"); properties.close();