public void testVerticesBiasedStart() throws Exception { Configuration config = BackFilterMapReduce.createConfiguration(Vertex.class, 0); mapReduceDriver.withConfiguration(config); Map<Long, FaunusVertex> graph = generateGraph(BaseTest.ExampleGraph.TINKERGRAPH, config); graph .get(1l) .addPath( (List) Arrays.asList(new FaunusVertex.MicroVertex(1l), new FaunusVertex.MicroVertex(1l)), false); graph .get(2l) .addPath( (List) Arrays.asList(new FaunusVertex.MicroVertex(1l), new FaunusVertex.MicroVertex(2l)), false); graph .get(3l) .addPath( (List) Arrays.asList(new FaunusVertex.MicroVertex(2l), new FaunusVertex.MicroVertex(3l)), false); graph .get(4l) .addPath( (List) Arrays.asList(new FaunusVertex.MicroVertex(3l), new FaunusVertex.MicroVertex(4l)), false); graph .get(5l) .addPath( (List) Arrays.asList(new FaunusVertex.MicroVertex(3l), new FaunusVertex.MicroVertex(5l)), false); graph = runWithGraph(graph, mapReduceDriver); assertEquals(graph.size(), 6); assertEquals(graph.get(1l).pathCount(), 2); assertEquals(graph.get(2l).pathCount(), 1); assertEquals(graph.get(3l).pathCount(), 2); assertEquals(graph.get(4l).pathCount(), 0); assertEquals(graph.get(5l).pathCount(), 0); assertEquals(graph.get(6l).pathCount(), 0); identicalStructure(graph, ExampleGraph.TINKERGRAPH); }
public void testBackingUpToVerticesFromEdges() throws Exception { Configuration config = BackFilterMapReduce.createConfiguration(Edge.class, 0); mapReduceDriver.withConfiguration(config); Map<Long, FaunusVertex> graph = generateGraph(BaseTest.ExampleGraph.TINKERGRAPH, config); ((StandardFaunusEdge) graph.get(1l).getEdges(Direction.OUT, "created").iterator().next()) .addPath( (List) Arrays.asList( new FaunusVertex.MicroVertex(1l), new StandardFaunusEdge.MicroEdge(2l)), false); ((StandardFaunusEdge) graph.get(6l).getEdges(Direction.OUT, "created").iterator().next()) .addPath( (List) Arrays.asList( new FaunusVertex.MicroVertex(6l), new StandardFaunusEdge.MicroEdge(2l)), false); ((StandardFaunusEdge) graph.get(6l).getEdges(Direction.OUT, "created").iterator().next()) .addPath( (List) Arrays.asList( new FaunusVertex.MicroVertex(2l), new StandardFaunusEdge.MicroEdge(2l)), false); ((StandardFaunusEdge) graph.get(6l).getEdges(Direction.OUT, "created").iterator().next()) .addPath( (List) Arrays.asList( new FaunusVertex.MicroVertex(2l), new StandardFaunusEdge.MicroEdge(2l)), false); graph = runWithGraph(graph, mapReduceDriver); assertEquals(graph.size(), 6); assertEquals(graph.get(1l).pathCount(), 1); assertEquals(graph.get(2l).pathCount(), 2); assertEquals(graph.get(3l).pathCount(), 0); assertEquals(graph.get(4l).pathCount(), 0); assertEquals(graph.get(5l).pathCount(), 0); assertEquals(graph.get(6l).pathCount(), 1); for (Vertex vertex : graph.values()) { for (Edge e : vertex.getEdges(Direction.BOTH)) { assertEquals(((StandardFaunusEdge) e).pathCount(), 0); } } identicalStructure(graph, ExampleGraph.TINKERGRAPH); }
public void testBackingUpToEdgesException() throws Exception { Configuration config = BackFilterMapReduce.createConfiguration(Vertex.class, 1); mapReduceDriver.withConfiguration(config); Map<Long, FaunusVertex> graph = generateGraph(BaseTest.ExampleGraph.TINKERGRAPH, config); graph .get(1l) .addPath( (List) Arrays.asList( new FaunusVertex.MicroVertex(1l), new StandardFaunusEdge.MicroEdge(1l)), false); graph .get(2l) .addPath( (List) Arrays.asList( new FaunusVertex.MicroVertex(1l), new StandardFaunusEdge.MicroEdge(2l)), false); graph .get(3l) .addPath( (List) Arrays.asList( new FaunusVertex.MicroVertex(2l), new StandardFaunusEdge.MicroEdge(3l)), false); graph .get(4l) .addPath( (List) Arrays.asList( new FaunusVertex.MicroVertex(3l), new StandardFaunusEdge.MicroEdge(4l)), false); graph .get(5l) .addPath( (List) Arrays.asList( new FaunusVertex.MicroVertex(3l), new StandardFaunusEdge.MicroEdge(5l)), false); try { graph = runWithGraph(graph, mapReduceDriver); assertFalse(true); } catch (Exception e) { assertTrue(true); } }
public void testVerticesFullStart() throws Exception { Configuration config = BackFilterMapReduce.createConfiguration(Vertex.class, 0); mapReduceDriver.withConfiguration(config); Map<Long, FaunusVertex> graph = runWithGraph( startPath(generateGraph(BaseTest.ExampleGraph.TINKERGRAPH, config), Vertex.class), mapReduceDriver); assertEquals(graph.size(), 6); assertEquals(graph.get(1l).pathCount(), 1); assertEquals(graph.get(2l).pathCount(), 1); assertEquals(graph.get(3l).pathCount(), 1); assertEquals(graph.get(4l).pathCount(), 1); assertEquals(graph.get(5l).pathCount(), 1); assertEquals(graph.get(6l).pathCount(), 1); identicalStructure(graph, ExampleGraph.TINKERGRAPH); }