@Test public void devicesAreCleanedWhenTheNetworkAddressIsNotAllowedToHaveDuplicates() throws Exception { this.withConfigurationNotAllowingDuplicates(); this.withHostAndInetAddress(IP_ADDRESS); this.theNetworkAddressIsUsedBy(this.inetAddress, "device1", "device2"); this.deviceNetworkAddressCleanupService.clearDuplicateAddresses(DEVICE_IDENTIFICATION, this.host); verify(this.deviceRepository, times(1)).findByNetworkAddress(this.inetAddress); final ArgumentCaptor<Device> deviceCaptor = ArgumentCaptor.forClass(Device.class); verify(this.deviceRepository, times(2)).save(deviceCaptor.capture()); final List<Device> savedDevices = deviceCaptor.getAllValues(); this.deviceIsSavedWithCleanedNetworkAddress("device1", savedDevices); this.deviceIsSavedWithCleanedNetworkAddress("device2", savedDevices); }
public void clearDuplicateAddresses(final String deviceIdentification, final String host) throws UnknownHostException { this.clearDuplicateAddresses(deviceIdentification, InetAddress.getByName(host)); }
DeviceNetworkAddressCleanupService { public void clearDuplicateAddresses(final String deviceIdentification, final String host) throws UnknownHostException { this.clearDuplicateAddresses(deviceIdentification, InetAddress.getByName(host)); } }
DeviceNetworkAddressCleanupService { public void clearDuplicateAddresses(final String deviceIdentification, final String host) throws UnknownHostException { this.clearDuplicateAddresses(deviceIdentification, InetAddress.getByName(host)); } @Autowired  DeviceNetworkAddressCleanupService(final DeviceRepository deviceRepository,
            @Value("${device.network.address.cleanup.never}") final boolean allowMultipleDevicesPerNetworkAddress,
            @Value("#{'${device.network.address.cleanup.duplicates.allowed}'.split(',')}") final List<String> ipRangesAllowingMultipleDevicesPerAddress); }
DeviceNetworkAddressCleanupService { public void clearDuplicateAddresses(final String deviceIdentification, final String host) throws UnknownHostException { this.clearDuplicateAddresses(deviceIdentification, InetAddress.getByName(host)); } @Autowired  DeviceNetworkAddressCleanupService(final DeviceRepository deviceRepository,
            @Value("${device.network.address.cleanup.never}") final boolean allowMultipleDevicesPerNetworkAddress,
            @Value("#{'${device.network.address.cleanup.duplicates.allowed}'.split(',')}") final List<String> ipRangesAllowingMultipleDevicesPerAddress); static InetAddress getLocalHost(); void clearDuplicateAddresses(final String deviceIdentification, final String host); void clearDuplicateAddresses(final String deviceIdentification, final InetAddress inetAddress); boolean allowDuplicateEntries(final InetAddress inetAddress); }
DeviceNetworkAddressCleanupService { public void clearDuplicateAddresses(final String deviceIdentification, final String host) throws UnknownHostException { this.clearDuplicateAddresses(deviceIdentification, InetAddress.getByName(host)); } @Autowired  DeviceNetworkAddressCleanupService(final DeviceRepository deviceRepository,
            @Value("${device.network.address.cleanup.never}") final boolean allowMultipleDevicesPerNetworkAddress,
            @Value("#{'${device.network.address.cleanup.duplicates.allowed}'.split(',')}") final List<String> ipRangesAllowingMultipleDevicesPerAddress); static InetAddress getLocalHost(); void clearDuplicateAddresses(final String deviceIdentification, final String host); void clearDuplicateAddresses(final String deviceIdentification, final InetAddress inetAddress); boolean allowDuplicateEntries(final InetAddress inetAddress);  }