@Test public void execute() throws ProtocolAdapterException { final DlmsDevice device = new DlmsDevice(); final Protocol protocol = Protocol.DSMR_4_2_2; device.setProtocol(protocol); when(this.protocolServiceLookup.lookupGetService(protocol)).thenReturn(this.getService); when(this.getService.getConfigurationObject(this.conn)).thenReturn(this.configurationOnDevice); when(this.protocolServiceLookup.lookupSetService(protocol)).thenReturn(this.setService); final AccessResultCode accessResultCode = AccessResultCode.SUCCESS; when(this.setService.setConfigurationObject(this.conn, this.configurationToSet, this.configurationOnDevice)) .thenReturn(accessResultCode); final AccessResultCode result = this.instance.execute(this.conn, device, this.configurationToSet); assertThat(result).isSameAs(accessResultCode); }
@Override public AccessResultCode execute(final DlmsConnectionManager conn, final DlmsDevice device, final ConfigurationObjectDto configurationToSet) throws ProtocolAdapterException { final Protocol protocol = Protocol.forDevice(device); final GetConfigurationObjectService getService = this.protocolServiceLookup.lookupGetService(protocol); final ConfigurationObjectDto configurationOnDevice = getService.getConfigurationObject(conn); final SetConfigurationObjectService setService = this.protocolServiceLookup.lookupSetService(protocol); return setService.setConfigurationObject(conn, configurationToSet, configurationOnDevice); }
SetConfigurationObjectCommandExecutor extends AbstractCommandExecutor<ConfigurationObjectDto, AccessResultCode> { @Override public AccessResultCode execute(final DlmsConnectionManager conn, final DlmsDevice device, final ConfigurationObjectDto configurationToSet) throws ProtocolAdapterException { final Protocol protocol = Protocol.forDevice(device); final GetConfigurationObjectService getService = this.protocolServiceLookup.lookupGetService(protocol); final ConfigurationObjectDto configurationOnDevice = getService.getConfigurationObject(conn); final SetConfigurationObjectService setService = this.protocolServiceLookup.lookupSetService(protocol); return setService.setConfigurationObject(conn, configurationToSet, configurationOnDevice); } }
SetConfigurationObjectCommandExecutor extends AbstractCommandExecutor<ConfigurationObjectDto, AccessResultCode> { @Override public AccessResultCode execute(final DlmsConnectionManager conn, final DlmsDevice device, final ConfigurationObjectDto configurationToSet) throws ProtocolAdapterException { final Protocol protocol = Protocol.forDevice(device); final GetConfigurationObjectService getService = this.protocolServiceLookup.lookupGetService(protocol); final ConfigurationObjectDto configurationOnDevice = getService.getConfigurationObject(conn); final SetConfigurationObjectService setService = this.protocolServiceLookup.lookupSetService(protocol); return setService.setConfigurationObject(conn, configurationToSet, configurationOnDevice); } SetConfigurationObjectCommandExecutor(final ProtocolServiceLookup protocolServiceLookup); }
SetConfigurationObjectCommandExecutor extends AbstractCommandExecutor<ConfigurationObjectDto, AccessResultCode> { @Override public AccessResultCode execute(final DlmsConnectionManager conn, final DlmsDevice device, final ConfigurationObjectDto configurationToSet) throws ProtocolAdapterException { final Protocol protocol = Protocol.forDevice(device); final GetConfigurationObjectService getService = this.protocolServiceLookup.lookupGetService(protocol); final ConfigurationObjectDto configurationOnDevice = getService.getConfigurationObject(conn); final SetConfigurationObjectService setService = this.protocolServiceLookup.lookupSetService(protocol); return setService.setConfigurationObject(conn, configurationToSet, configurationOnDevice); } SetConfigurationObjectCommandExecutor(final ProtocolServiceLookup protocolServiceLookup); @Override ConfigurationObjectDto fromBundleRequestInput(final ActionRequestDto bundleInput); @Override ActionResponseDto asBundleResponse(final AccessResultCode executionResult); @Override AccessResultCode execute(final DlmsConnectionManager conn, final DlmsDevice device,
            final ConfigurationObjectDto configurationToSet); }
SetConfigurationObjectCommandExecutor extends AbstractCommandExecutor<ConfigurationObjectDto, AccessResultCode> { @Override public AccessResultCode execute(final DlmsConnectionManager conn, final DlmsDevice device, final ConfigurationObjectDto configurationToSet) throws ProtocolAdapterException { final Protocol protocol = Protocol.forDevice(device); final GetConfigurationObjectService getService = this.protocolServiceLookup.lookupGetService(protocol); final ConfigurationObjectDto configurationOnDevice = getService.getConfigurationObject(conn); final SetConfigurationObjectService setService = this.protocolServiceLookup.lookupSetService(protocol); return setService.setConfigurationObject(conn, configurationToSet, configurationOnDevice); } SetConfigurationObjectCommandExecutor(final ProtocolServiceLookup protocolServiceLookup); @Override ConfigurationObjectDto fromBundleRequestInput(final ActionRequestDto bundleInput); @Override ActionResponseDto asBundleResponse(final AccessResultCode executionResult); @Override AccessResultCode execute(final DlmsConnectionManager conn, final DlmsDevice device,
            final ConfigurationObjectDto configurationToSet);  }