@Test public void testNameIndex() { graph = createGraph(); EdgeIteratorState iter1 = graph.edge(0, 1, 10, true); iter1.setName("named street1"); EdgeIteratorState iter2 = graph.edge(0, 1, 10, true); iter2.setName("named street2"); assertEquals( "named street1", graph.getEdgeProps(iter1.getEdge(), iter1.getAdjNode()).getName()); assertEquals( "named street2", graph.getEdgeProps(iter2.getEdge(), iter2.getAdjNode()).getName()); }
@Test public void testSave_and_fileFormat() throws IOException { graph = newGHStorage(new RAMDirectory(defaultGraphLoc, true), true).create(defaultSize); NodeAccess na = graph.getNodeAccess(); assertTrue(na.is3D()); na.setNode(0, 10, 10, 0); na.setNode(1, 11, 20, 1); na.setNode(2, 12, 12, 0.4); EdgeIteratorState iter2 = graph.edge(0, 1, 100, true); iter2.setWayGeometry(Helper.createPointList3D(1.5, 1, 0, 2, 3, 0)); EdgeIteratorState iter1 = graph.edge(0, 2, 200, true); iter1.setWayGeometry(Helper.createPointList3D(3.5, 4.5, 0, 5, 6, 0)); graph.edge(9, 10, 200, true); graph.edge(9, 11, 200, true); graph.edge(1, 2, 120, false); iter1.setName("named street1"); iter2.setName("named street2"); checkGraph(graph); graph.flush(); graph.close(); graph = newGHStorage(new MMapDirectory(defaultGraphLoc), true); assertTrue(graph.loadExisting()); assertEquals(12, graph.getNodes()); checkGraph(graph); assertEquals( "named street1", graph.getEdgeIteratorState(iter1.getEdge(), iter1.getAdjNode()).getName()); assertEquals( "named street2", graph.getEdgeIteratorState(iter2.getEdge(), iter2.getAdjNode()).getName()); graph.edge(3, 4, 123, true).setWayGeometry(Helper.createPointList3D(4.4, 5.5, 0, 6.6, 7.7, 0)); checkGraph(graph); }