@Test public void testCopyTo() { graph = createGraph(); initExampleGraph(graph); GraphStorage gs = newRAMGraph(); gs.setSegmentSize(8000); gs.create(10); try { graph.copyTo(gs); checkExampleGraph(gs); } catch (Exception ex) { ex.printStackTrace(); assertTrue(ex.toString(), false); } try { Helper.close((Closeable) graph); graph = createGraph(); gs.copyTo(graph); checkExampleGraph(graph); } catch (Exception ex) { ex.printStackTrace(); assertTrue(ex.toString(), false); } Helper.close((Closeable) graph); }
@Test public void testGetLocations() { graph = createGraph(); NodeAccess na = graph.getNodeAccess(); na.setNode(0, 12, 23); na.setNode(1, 22, 23); assertEquals(2, graph.getNodes()); graph.edge(0, 1, 10, true); assertEquals(2, graph.getNodes()); graph.edge(0, 2, 10, true); assertEquals(3, graph.getNodes()); Helper.close((Closeable) graph); graph = createGraph(); assertEquals(0, graph.getNodes()); }
@Test public void testClone() { graph = createGraph(); graph.edge(1, 2, 10, true); NodeAccess na = graph.getNodeAccess(); na.setNode(0, 12, 23); na.setNode(1, 8, 13); na.setNode(2, 2, 10); na.setNode(3, 5, 9); graph.edge(1, 3, 10, true); Graph clone = graph.copyTo(createGraph(locationParent + "/clone", false)); assertEquals(graph.getNodes(), clone.getNodes()); assertEquals( count(carOutExplorer.setBaseNode(1)), count(clone.createEdgeExplorer(carOutFilter).setBaseNode(1))); clone.edge(1, 4, 10, true); assertEquals(3, count(clone.createEdgeExplorer(carOutFilter).setBaseNode(1))); assertEquals(graph.getBounds(), clone.getBounds()); Helper.close((Closeable) clone); }
@After public void tearDown() { Helper.close((Closeable) graph); Helper.removeDir(new File(locationParent)); }