@Test public void deleteConnectedDeviceTest() { transactionManager.doInTransaction(() -> { connectedDeviceRepository.add(lldpConnectedDeviceA); connectedDeviceRepository.add(lldpConnectedDeviceB); assertEquals(2, connectedDeviceRepository.findAll().size()); connectedDeviceRepository.remove(lldpConnectedDeviceA); assertEquals(1, connectedDeviceRepository.findAll().size()); assertEquals(lldpConnectedDeviceB, connectedDeviceRepository.findAll().iterator().next()); connectedDeviceRepository.remove(lldpConnectedDeviceB); assertEquals(0, connectedDeviceRepository.findAll().size()); }); }
@Override public Collection<SwitchConnectedDevice> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(SwitchConnectedDeviceFrame.FRAME_LABEL)) .toListExplicit(SwitchConnectedDeviceFrame.class).stream() .map(SwitchConnectedDevice::new) .collect(Collectors.toList()); }
FermaSwitchConnectedDevicesRepository extends FermaGenericRepository<SwitchConnectedDevice, SwitchConnectedDeviceData, SwitchConnectedDeviceFrame> implements SwitchConnectedDeviceRepository { @Override public Collection<SwitchConnectedDevice> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(SwitchConnectedDeviceFrame.FRAME_LABEL)) .toListExplicit(SwitchConnectedDeviceFrame.class).stream() .map(SwitchConnectedDevice::new) .collect(Collectors.toList()); } }
FermaSwitchConnectedDevicesRepository extends FermaGenericRepository<SwitchConnectedDevice, SwitchConnectedDeviceData, SwitchConnectedDeviceFrame> implements SwitchConnectedDeviceRepository { @Override public Collection<SwitchConnectedDevice> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(SwitchConnectedDeviceFrame.FRAME_LABEL)) .toListExplicit(SwitchConnectedDeviceFrame.class).stream() .map(SwitchConnectedDevice::new) .collect(Collectors.toList()); } FermaSwitchConnectedDevicesRepository(FramedGraphFactory<?> graphFactory, TransactionManager transactionManager); }
FermaSwitchConnectedDevicesRepository extends FermaGenericRepository<SwitchConnectedDevice, SwitchConnectedDeviceData, SwitchConnectedDeviceFrame> implements SwitchConnectedDeviceRepository { @Override public Collection<SwitchConnectedDevice> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(SwitchConnectedDeviceFrame.FRAME_LABEL)) .toListExplicit(SwitchConnectedDeviceFrame.class).stream() .map(SwitchConnectedDevice::new) .collect(Collectors.toList()); } FermaSwitchConnectedDevicesRepository(FramedGraphFactory<?> graphFactory, TransactionManager transactionManager); @Override Collection<SwitchConnectedDevice> findAll(); @Override Collection<SwitchConnectedDevice> findBySwitchId(SwitchId switchId); @Override Collection<SwitchConnectedDevice> findByFlowId(String flowId); @Override Optional<SwitchConnectedDevice> findLldpByUniqueFieldCombination(
            SwitchId switchId, int portNumber, int vlan, String macAddress, String chassisId, String portId); @Override Optional<SwitchConnectedDevice> findArpByUniqueFieldCombination(
            SwitchId switchId, int portNumber, int vlan, String macAddress, String ipAddress); }
FermaSwitchConnectedDevicesRepository extends FermaGenericRepository<SwitchConnectedDevice, SwitchConnectedDeviceData, SwitchConnectedDeviceFrame> implements SwitchConnectedDeviceRepository { @Override public Collection<SwitchConnectedDevice> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(SwitchConnectedDeviceFrame.FRAME_LABEL)) .toListExplicit(SwitchConnectedDeviceFrame.class).stream() .map(SwitchConnectedDevice::new) .collect(Collectors.toList()); } FermaSwitchConnectedDevicesRepository(FramedGraphFactory<?> graphFactory, TransactionManager transactionManager); @Override Collection<SwitchConnectedDevice> findAll(); @Override Collection<SwitchConnectedDevice> findBySwitchId(SwitchId switchId); @Override Collection<SwitchConnectedDevice> findByFlowId(String flowId); @Override Optional<SwitchConnectedDevice> findLldpByUniqueFieldCombination(
            SwitchId switchId, int portNumber, int vlan, String macAddress, String chassisId, String portId); @Override Optional<SwitchConnectedDevice> findArpByUniqueFieldCombination(
            SwitchId switchId, int portNumber, int vlan, String macAddress, String ipAddress);  }