@Test public void testDeviceAddedWithEmptyDefaultXml() throws IOException { when(m_adapterManager.getEditRequestForAdapter(any())).thenReturn(null); m_defaultConfigService.deviceAdded(m_device.getDeviceName()); verifyZeroInteractions(m_pmaRegistry); }
@Override public void deviceAdded(String deviceName) { Device device = m_deviceManager.getDevice(deviceName); EditConfigRequest editReq = AdapterUtils.getDefaultEditReq(device, m_adapterManager); if (editReq != null) { if (AlignmentOption.PUSH.equals(device.getAlignmentOption())) { try { m_pmaRegistry.executeNC(deviceName, editReq.requestToString()); } catch (ExecutionException e) { LOGGER.error(String.format("Error when executing default-config xml request for device %s", deviceName)); throw new RuntimeException(e); } } else { LOGGER.info(String.format("For device %s, the alignment mechanism is pull configuration from device to PMA", deviceName)); } } else { LOGGER.info(String.format("The adapter for device %s does not contain any default configurations", deviceName)); } }
DefaultConfigService implements DeviceStateProvider { @Override public void deviceAdded(String deviceName) { Device device = m_deviceManager.getDevice(deviceName); EditConfigRequest editReq = AdapterUtils.getDefaultEditReq(device, m_adapterManager); if (editReq != null) { if (AlignmentOption.PUSH.equals(device.getAlignmentOption())) { try { m_pmaRegistry.executeNC(deviceName, editReq.requestToString()); } catch (ExecutionException e) { LOGGER.error(String.format("Error when executing default-config xml request for device %s", deviceName)); throw new RuntimeException(e); } } else { LOGGER.info(String.format("For device %s, the alignment mechanism is pull configuration from device to PMA", deviceName)); } } else { LOGGER.info(String.format("The adapter for device %s does not contain any default configurations", deviceName)); } } }
DefaultConfigService implements DeviceStateProvider { @Override public void deviceAdded(String deviceName) { Device device = m_deviceManager.getDevice(deviceName); EditConfigRequest editReq = AdapterUtils.getDefaultEditReq(device, m_adapterManager); if (editReq != null) { if (AlignmentOption.PUSH.equals(device.getAlignmentOption())) { try { m_pmaRegistry.executeNC(deviceName, editReq.requestToString()); } catch (ExecutionException e) { LOGGER.error(String.format("Error when executing default-config xml request for device %s", deviceName)); throw new RuntimeException(e); } } else { LOGGER.info(String.format("For device %s, the alignment mechanism is pull configuration from device to PMA", deviceName)); } } else { LOGGER.info(String.format("The adapter for device %s does not contain any default configurations", deviceName)); } } DefaultConfigService(DeviceManager deviceManager, PmaRegistry pmaRegistry, AdapterManager adapterManager); }
DefaultConfigService implements DeviceStateProvider { @Override public void deviceAdded(String deviceName) { Device device = m_deviceManager.getDevice(deviceName); EditConfigRequest editReq = AdapterUtils.getDefaultEditReq(device, m_adapterManager); if (editReq != null) { if (AlignmentOption.PUSH.equals(device.getAlignmentOption())) { try { m_pmaRegistry.executeNC(deviceName, editReq.requestToString()); } catch (ExecutionException e) { LOGGER.error(String.format("Error when executing default-config xml request for device %s", deviceName)); throw new RuntimeException(e); } } else { LOGGER.info(String.format("For device %s, the alignment mechanism is pull configuration from device to PMA", deviceName)); } } else { LOGGER.info(String.format("The adapter for device %s does not contain any default configurations", deviceName)); } } DefaultConfigService(DeviceManager deviceManager, PmaRegistry pmaRegistry, AdapterManager adapterManager); void init(); void destroy(); @Override void deviceAdded(String deviceName); @Override void deviceRemoved(String deviceName); }
DefaultConfigService implements DeviceStateProvider { @Override public void deviceAdded(String deviceName) { Device device = m_deviceManager.getDevice(deviceName); EditConfigRequest editReq = AdapterUtils.getDefaultEditReq(device, m_adapterManager); if (editReq != null) { if (AlignmentOption.PUSH.equals(device.getAlignmentOption())) { try { m_pmaRegistry.executeNC(deviceName, editReq.requestToString()); } catch (ExecutionException e) { LOGGER.error(String.format("Error when executing default-config xml request for device %s", deviceName)); throw new RuntimeException(e); } } else { LOGGER.info(String.format("For device %s, the alignment mechanism is pull configuration from device to PMA", deviceName)); } } else { LOGGER.info(String.format("The adapter for device %s does not contain any default configurations", deviceName)); } } DefaultConfigService(DeviceManager deviceManager, PmaRegistry pmaRegistry, AdapterManager adapterManager); void init(); void destroy(); @Override void deviceAdded(String deviceName); @Override void deviceRemoved(String deviceName);  }