@Test public void shouldDeleteFoundFlowMeter() { createFlowMeter(); transactionManager.doInTransaction(() -> { Collection<FlowMeter> allMeters = flowMeterRepository.findAll(); FlowMeter foundMeter = allMeters.iterator().next(); flowMeterRepository.remove(foundMeter); }); assertEquals(0, flowMeterRepository.findAll().size()); }
@Override public Collection<FlowMeter> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowMeterFrame.FRAME_LABEL)) .toListExplicit(FlowMeterFrame.class).stream() .map(FlowMeter::new) .collect(Collectors.toList()); }
FermaFlowMeterRepository extends FermaGenericRepository<FlowMeter, FlowMeterData, FlowMeterFrame> implements FlowMeterRepository { @Override public Collection<FlowMeter> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowMeterFrame.FRAME_LABEL)) .toListExplicit(FlowMeterFrame.class).stream() .map(FlowMeter::new) .collect(Collectors.toList()); } }
FermaFlowMeterRepository extends FermaGenericRepository<FlowMeter, FlowMeterData, FlowMeterFrame> implements FlowMeterRepository { @Override public Collection<FlowMeter> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowMeterFrame.FRAME_LABEL)) .toListExplicit(FlowMeterFrame.class).stream() .map(FlowMeter::new) .collect(Collectors.toList()); } FermaFlowMeterRepository(FramedGraphFactory<?> graphFactory, TransactionManager transactionManager); }
FermaFlowMeterRepository extends FermaGenericRepository<FlowMeter, FlowMeterData, FlowMeterFrame> implements FlowMeterRepository { @Override public Collection<FlowMeter> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowMeterFrame.FRAME_LABEL)) .toListExplicit(FlowMeterFrame.class).stream() .map(FlowMeter::new) .collect(Collectors.toList()); } FermaFlowMeterRepository(FramedGraphFactory<?> graphFactory, TransactionManager transactionManager); @Override Collection<FlowMeter> findAll(); @Override Optional<FlowMeter> findByPathId(PathId pathId); @Override boolean exists(SwitchId switchId, MeterId meterId); @Override Optional<MeterId> findFirstUnassignedMeter(SwitchId switchId, MeterId lowestMeterId,
                                                      MeterId highestMeterId); }
FermaFlowMeterRepository extends FermaGenericRepository<FlowMeter, FlowMeterData, FlowMeterFrame> implements FlowMeterRepository { @Override public Collection<FlowMeter> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowMeterFrame.FRAME_LABEL)) .toListExplicit(FlowMeterFrame.class).stream() .map(FlowMeter::new) .collect(Collectors.toList()); } FermaFlowMeterRepository(FramedGraphFactory<?> graphFactory, TransactionManager transactionManager); @Override Collection<FlowMeter> findAll(); @Override Optional<FlowMeter> findByPathId(PathId pathId); @Override boolean exists(SwitchId switchId, MeterId meterId); @Override Optional<MeterId> findFirstUnassignedMeter(SwitchId switchId, MeterId lowestMeterId,
                                                      MeterId highestMeterId);  }