@Test public void testExecuteFailConfiguration() throws ProtocolAdapterException { when(this.setConfigurationObjectService.setConfigurationObject(any(DlmsConnectionManager.class), any(ConfigurationObjectDto.class), any(ConfigurationObjectDto.class))) .thenReturn(AccessResultCode.OTHER_REASON); assertThatExceptionOfType(ProtocolAdapterException.class).isThrownBy(() -> { this.executor.execute(this.dlmsConnectionManager, this.device, this.dataDto); }); }
@Override public AccessResultCode execute(final DlmsConnectionManager conn, final DlmsDevice device, final SetRandomisationSettingsRequestDataDto setRandomisationSettingsRequestDataDto) throws ProtocolAdapterException { LOGGER.info("Executing SetRandomisationSettingsCommandExecutor. Data = {}", setRandomisationSettingsRequestDataDto); boolean directAttach = setRandomisationSettingsRequestDataDto.getDirectAttach() == 1; int randomisationStartWindow = setRandomisationSettingsRequestDataDto.getRandomisationStartWindow(); int multiplicationFactor = setRandomisationSettingsRequestDataDto.getMultiplicationFactor(); int numberOfRetries = setRandomisationSettingsRequestDataDto.getNumberOfRetries(); if (directAttach) { LOGGER.info("Enabling directAttach on device {}.", device.getDeviceIdentification()); writeDirectAttach(conn, device, true); } else { LOGGER.info("Disabling directAttach and setting Randomisation Settings for device {}.", device.getDeviceIdentification()); writeDirectAttach(conn, device, false); writeRandomisationSettings(conn, device, randomisationStartWindow, multiplicationFactor, numberOfRetries); } return AccessResultCode.SUCCESS; }
SetRandomisationSettingsCommandExecutor extends AbstractCommandExecutor<SetRandomisationSettingsRequestDataDto, AccessResultCode> { @Override public AccessResultCode execute(final DlmsConnectionManager conn, final DlmsDevice device, final SetRandomisationSettingsRequestDataDto setRandomisationSettingsRequestDataDto) throws ProtocolAdapterException { LOGGER.info("Executing SetRandomisationSettingsCommandExecutor. Data = {}", setRandomisationSettingsRequestDataDto); boolean directAttach = setRandomisationSettingsRequestDataDto.getDirectAttach() == 1; int randomisationStartWindow = setRandomisationSettingsRequestDataDto.getRandomisationStartWindow(); int multiplicationFactor = setRandomisationSettingsRequestDataDto.getMultiplicationFactor(); int numberOfRetries = setRandomisationSettingsRequestDataDto.getNumberOfRetries(); if (directAttach) { LOGGER.info("Enabling directAttach on device {}.", device.getDeviceIdentification()); writeDirectAttach(conn, device, true); } else { LOGGER.info("Disabling directAttach and setting Randomisation Settings for device {}.", device.getDeviceIdentification()); writeDirectAttach(conn, device, false); writeRandomisationSettings(conn, device, randomisationStartWindow, multiplicationFactor, numberOfRetries); } return AccessResultCode.SUCCESS; } }
SetRandomisationSettingsCommandExecutor extends AbstractCommandExecutor<SetRandomisationSettingsRequestDataDto, AccessResultCode> { @Override public AccessResultCode execute(final DlmsConnectionManager conn, final DlmsDevice device, final SetRandomisationSettingsRequestDataDto setRandomisationSettingsRequestDataDto) throws ProtocolAdapterException { LOGGER.info("Executing SetRandomisationSettingsCommandExecutor. Data = {}", setRandomisationSettingsRequestDataDto); boolean directAttach = setRandomisationSettingsRequestDataDto.getDirectAttach() == 1; int randomisationStartWindow = setRandomisationSettingsRequestDataDto.getRandomisationStartWindow(); int multiplicationFactor = setRandomisationSettingsRequestDataDto.getMultiplicationFactor(); int numberOfRetries = setRandomisationSettingsRequestDataDto.getNumberOfRetries(); if (directAttach) { LOGGER.info("Enabling directAttach on device {}.", device.getDeviceIdentification()); writeDirectAttach(conn, device, true); } else { LOGGER.info("Disabling directAttach and setting Randomisation Settings for device {}.", device.getDeviceIdentification()); writeDirectAttach(conn, device, false); writeRandomisationSettings(conn, device, randomisationStartWindow, multiplicationFactor, numberOfRetries); } return AccessResultCode.SUCCESS; } @Autowired  SetRandomisationSettingsCommandExecutor(final DlmsObjectConfigService dlmsObjectConfigService,
            final ProtocolServiceLookup protocolServiceLookup); }
SetRandomisationSettingsCommandExecutor extends AbstractCommandExecutor<SetRandomisationSettingsRequestDataDto, AccessResultCode> { @Override public AccessResultCode execute(final DlmsConnectionManager conn, final DlmsDevice device, final SetRandomisationSettingsRequestDataDto setRandomisationSettingsRequestDataDto) throws ProtocolAdapterException { LOGGER.info("Executing SetRandomisationSettingsCommandExecutor. Data = {}", setRandomisationSettingsRequestDataDto); boolean directAttach = setRandomisationSettingsRequestDataDto.getDirectAttach() == 1; int randomisationStartWindow = setRandomisationSettingsRequestDataDto.getRandomisationStartWindow(); int multiplicationFactor = setRandomisationSettingsRequestDataDto.getMultiplicationFactor(); int numberOfRetries = setRandomisationSettingsRequestDataDto.getNumberOfRetries(); if (directAttach) { LOGGER.info("Enabling directAttach on device {}.", device.getDeviceIdentification()); writeDirectAttach(conn, device, true); } else { LOGGER.info("Disabling directAttach and setting Randomisation Settings for device {}.", device.getDeviceIdentification()); writeDirectAttach(conn, device, false); writeRandomisationSettings(conn, device, randomisationStartWindow, multiplicationFactor, numberOfRetries); } return AccessResultCode.SUCCESS; } @Autowired  SetRandomisationSettingsCommandExecutor(final DlmsObjectConfigService dlmsObjectConfigService,
            final ProtocolServiceLookup protocolServiceLookup); @Override SetRandomisationSettingsRequestDataDto fromBundleRequestInput(final ActionRequestDto bundleInput); @Override ActionResponseDto asBundleResponse(final AccessResultCode executionResult); @Override AccessResultCode execute(final DlmsConnectionManager conn, final DlmsDevice device,
            final SetRandomisationSettingsRequestDataDto setRandomisationSettingsRequestDataDto); }
SetRandomisationSettingsCommandExecutor extends AbstractCommandExecutor<SetRandomisationSettingsRequestDataDto, AccessResultCode> { @Override public AccessResultCode execute(final DlmsConnectionManager conn, final DlmsDevice device, final SetRandomisationSettingsRequestDataDto setRandomisationSettingsRequestDataDto) throws ProtocolAdapterException { LOGGER.info("Executing SetRandomisationSettingsCommandExecutor. Data = {}", setRandomisationSettingsRequestDataDto); boolean directAttach = setRandomisationSettingsRequestDataDto.getDirectAttach() == 1; int randomisationStartWindow = setRandomisationSettingsRequestDataDto.getRandomisationStartWindow(); int multiplicationFactor = setRandomisationSettingsRequestDataDto.getMultiplicationFactor(); int numberOfRetries = setRandomisationSettingsRequestDataDto.getNumberOfRetries(); if (directAttach) { LOGGER.info("Enabling directAttach on device {}.", device.getDeviceIdentification()); writeDirectAttach(conn, device, true); } else { LOGGER.info("Disabling directAttach and setting Randomisation Settings for device {}.", device.getDeviceIdentification()); writeDirectAttach(conn, device, false); writeRandomisationSettings(conn, device, randomisationStartWindow, multiplicationFactor, numberOfRetries); } return AccessResultCode.SUCCESS; } @Autowired  SetRandomisationSettingsCommandExecutor(final DlmsObjectConfigService dlmsObjectConfigService,
            final ProtocolServiceLookup protocolServiceLookup); @Override SetRandomisationSettingsRequestDataDto fromBundleRequestInput(final ActionRequestDto bundleInput); @Override ActionResponseDto asBundleResponse(final AccessResultCode executionResult); @Override AccessResultCode execute(final DlmsConnectionManager conn, final DlmsDevice device,
            final SetRandomisationSettingsRequestDataDto setRandomisationSettingsRequestDataDto);  }