@Test public void save() { graphService.saveGraph(graph); verify(sessionMock).beginTransaction(); verify(sessionMock, times(graph.getAllNodes().size())).save(any(AbstractNode.class), eq(1)); verifyNoMoreInteractions(sessionMock); verify(txMock).commit(); }
public void saveGraph(DependencyGraph dependencyGraph) { LOGGER.info("Saving graph ..."); Stopwatch stopwatch = Stopwatch.createStarted(); Transaction tx = session.beginTransaction(); GraphMapper mapper = new GraphMapper(); mapper.toNeo4j(dependencyGraph); mapper.getNodes().forEach(n -> session.save(n, 1)); tx.commit(); stopwatch.stop(); LOGGER.info("... done in {}: {} nodes and {} edges.", stopwatch.toString(), mapper.getNodes().size(), mapper.getReferencesRelations().size()); }
GraphService { public void saveGraph(DependencyGraph dependencyGraph) { LOGGER.info("Saving graph ..."); Stopwatch stopwatch = Stopwatch.createStarted(); Transaction tx = session.beginTransaction(); GraphMapper mapper = new GraphMapper(); mapper.toNeo4j(dependencyGraph); mapper.getNodes().forEach(n -> session.save(n, 1)); tx.commit(); stopwatch.stop(); LOGGER.info("... done in {}: {} nodes and {} edges.", stopwatch.toString(), mapper.getNodes().size(), mapper.getReferencesRelations().size()); } }
GraphService { public void saveGraph(DependencyGraph dependencyGraph) { LOGGER.info("Saving graph ..."); Stopwatch stopwatch = Stopwatch.createStarted(); Transaction tx = session.beginTransaction(); GraphMapper mapper = new GraphMapper(); mapper.toNeo4j(dependencyGraph); mapper.getNodes().forEach(n -> session.save(n, 1)); tx.commit(); stopwatch.stop(); LOGGER.info("... done in {}: {} nodes and {} edges.", stopwatch.toString(), mapper.getNodes().size(), mapper.getReferencesRelations().size()); } GraphService();  GraphService(Session session); }
GraphService { public void saveGraph(DependencyGraph dependencyGraph) { LOGGER.info("Saving graph ..."); Stopwatch stopwatch = Stopwatch.createStarted(); Transaction tx = session.beginTransaction(); GraphMapper mapper = new GraphMapper(); mapper.toNeo4j(dependencyGraph); mapper.getNodes().forEach(n -> session.save(n, 1)); tx.commit(); stopwatch.stop(); LOGGER.info("... done in {}: {} nodes and {} edges.", stopwatch.toString(), mapper.getNodes().size(), mapper.getReferencesRelations().size()); } GraphService();  GraphService(Session session); void close(); void saveGraph(DependencyGraph dependencyGraph); void deleteAll(); Collection<ClassNode> findByProperty(String key, Object value); Collection<ClassNode> findByFilter(Filter filter); }
GraphService { public void saveGraph(DependencyGraph dependencyGraph) { LOGGER.info("Saving graph ..."); Stopwatch stopwatch = Stopwatch.createStarted(); Transaction tx = session.beginTransaction(); GraphMapper mapper = new GraphMapper(); mapper.toNeo4j(dependencyGraph); mapper.getNodes().forEach(n -> session.save(n, 1)); tx.commit(); stopwatch.stop(); LOGGER.info("... done in {}: {} nodes and {} edges.", stopwatch.toString(), mapper.getNodes().size(), mapper.getReferencesRelations().size()); } GraphService();  GraphService(Session session); void close(); void saveGraph(DependencyGraph dependencyGraph); void deleteAll(); Collection<ClassNode> findByProperty(String key, Object value); Collection<ClassNode> findByFilter(Filter filter);  }