Search in sources :

Example 61 with DlmsDevice

use of org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice in project open-smart-grid-platform by OSGP.

the class AddDeviceSteps method configureForCommunicationWithDeviceSimulator.

private void configureForCommunicationWithDeviceSimulator(final Device device) {
    /*
     * This call also sets the device to be IN_USE and activated.
     */
    device.updateRegistrationData(PlatformSmartmeteringDefaults.NETWORK_ADDRESS, device.getDeviceType());
    final DlmsDevice dlmsDevice = this.dlmsDeviceRepository.findByDeviceIdentification(device.getDeviceIdentification());
    assertThat(dlmsDevice).as("Device should be in the DLMS protocol database for identification " + device.getDeviceIdentification()).isNotNull();
    dlmsDevice.setIpAddressIsStatic(true);
    dlmsDevice.setPort(PlatformSmartmeteringDefaults.PORT);
    this.dlmsDeviceRepository.save(dlmsDevice);
}
Also used : DlmsDevice(org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice)

Example 62 with DlmsDevice

use of org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice in project open-smart-grid-platform by OSGP.

the class EnableAndDisableDebugging method theDeviceDebugInformationShouldBeEnabled.

@Then("^the device debug information should be enabled$")
public void theDeviceDebugInformationShouldBeEnabled() throws Throwable {
    final DlmsDevice device = this.dlmsDeviceRepository.findByDeviceIdentification(ScenarioContext.current().get(PlatformKeys.KEY_DEVICE_IDENTIFICATION).toString());
    assertThat(device.isInDebugMode()).as("Debug mode").isTrue();
}
Also used : DlmsDevice(org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice) Then(io.cucumber.java.en.Then)

Example 63 with DlmsDevice

use of org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice in project open-smart-grid-platform by OSGP.

the class EnableAndDisableDebugging method theDeviceDebugInformationShouldBeDisabled.

@Then("^the device debug information should be disabled$")
public void theDeviceDebugInformationShouldBeDisabled() throws Throwable {
    final DlmsDevice device = this.dlmsDeviceRepository.findByDeviceIdentification(ScenarioContext.current().get(PlatformKeys.KEY_DEVICE_IDENTIFICATION).toString());
    assertThat(device.isInDebugMode()).as("Debug mode").isFalse();
}
Also used : DlmsDevice(org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice) Then(io.cucumber.java.en.Then)

Example 64 with DlmsDevice

use of org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice in project open-smart-grid-platform by OSGP.

the class ConfigurationService method getMbusKeyExchangeData.

public GMeterInfoDto getMbusKeyExchangeData(final DlmsConnectionManager conn, final DlmsDevice device, final SetMbusUserKeyByChannelRequestDataDto setMbusUserKeyByChannelRequestData, final MessageMetadata messageMetadata) throws OsgpException {
    final GetMBusDeviceOnChannelRequestDataDto mbusDeviceOnChannelRequest = new GetMBusDeviceOnChannelRequestDataDto(device.getDeviceIdentification(), setMbusUserKeyByChannelRequestData.getChannel());
    final ChannelElementValuesDto channelElementValues = this.getMBusDeviceOnChannelCommandExecutor.execute(conn, device, mbusDeviceOnChannelRequest, messageMetadata);
    final DlmsDevice mbusDevice = this.domainHelperService.findMbusDevice(channelElementValues.getIdentificationNumber(), channelElementValues.getManufacturerIdentification());
    return new GMeterInfoDto(setMbusUserKeyByChannelRequestData.getChannel(), mbusDevice.getDeviceIdentification());
}
Also used : ChannelElementValuesDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ChannelElementValuesDto) GMeterInfoDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GMeterInfoDto) DlmsDevice(org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice) GetMBusDeviceOnChannelRequestDataDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMBusDeviceOnChannelRequestDataDto)

Example 65 with DlmsDevice

use of org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice in project open-smart-grid-platform by OSGP.

the class BundleServiceTest method shouldHandleActionsWithResultContainingFaultResponseWithRetryableException.

@Test
public void shouldHandleActionsWithResultContainingFaultResponseWithRetryableException() {
    final ActionResponseDto faultResponse = this.createFaultResponse(true);
    final BundleMessagesRequestDto bundleMessagesRequest = new BundleMessagesRequestDto(Arrays.asList(this.createAction(this.builder.makePeriodicMeterReadsRequestDataDto(), faultResponse)));
    final BundleMessagesRequestDto result = this.bundleService.callExecutors(null, new DlmsDevice(), bundleMessagesRequest, this.messageMetadata);
    verify(this.bundleCommandExecutorMap).getCommandExecutor(PeriodicMeterReadsRequestDataDto.class);
    assertThat(result.getAllResponses().size()).isOne();
    assertThat(result.getAllResponses().get(0)).isNotNull();
}
Also used : BundleMessagesRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.BundleMessagesRequestDto) ActionResponseDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ActionResponseDto) DlmsDevice(org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice) Test(org.junit.jupiter.api.Test)

Aggregations

DlmsDevice (org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice)103 Test (org.junit.jupiter.api.Test)58 DlmsDeviceBuilder (org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDeviceBuilder)24 DlmsMessageListener (org.opensmartgridplatform.adapter.protocol.dlms.infra.messaging.DlmsMessageListener)17 InvocationCountingDlmsMessageListener (org.opensmartgridplatform.adapter.protocol.dlms.infra.messaging.InvocationCountingDlmsMessageListener)17 AttributeAddress (org.openmuc.jdlms.AttributeAddress)15 MessageMetadata (org.opensmartgridplatform.shared.infra.jms.MessageMetadata)13 ProtocolAdapterException (org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException)10 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)10 Then (io.cucumber.java.en.Then)9 DataObject (org.openmuc.jdlms.datatypes.DataObject)7 DlmsConnectionManager (org.opensmartgridplatform.adapter.protocol.dlms.domain.factories.DlmsConnectionManager)7 AccessResultCode (org.openmuc.jdlms.AccessResultCode)6 Instant (java.time.Instant)5 Protocol (org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.Protocol)5 IOException (java.io.IOException)4 Date (java.util.Date)4 List (java.util.List)4 ThrowableAssert.catchThrowable (org.assertj.core.api.ThrowableAssert.catchThrowable)4 SetParameter (org.openmuc.jdlms.SetParameter)4