Search in sources :

Example 11 with ResponseMetadata

use of org.opensmartgridplatform.adapter.protocol.iec60870.domain.valueobjects.ResponseMetadata in project open-smart-grid-platform by OSGP.

the class LightMeasurementDeviceResponseServiceTest method sendLightSensorStatusResponseShouldDequeueCorrelationUid.

@Test
void sendLightSensorStatusResponseShouldDequeueCorrelationUid() {
    final MeasurementReportDto measurementReportDto = MeasurementReportFactory.getMeasurementReportDto();
    final ResponseMetadata responseMetadata = new ResponseMetadata.Builder().withCorrelationUid(CORRELATION_UID).withDeviceIdentification(Iec60870DeviceFactory.LMD_1_DEVICE_IDENTIFICATION).withOrganisationIdentification(ORGANISATION_IDENTIFICATION).build();
    final Iec60870Device lightMeasurementDevice1 = Iec60870DeviceFactory.getLightMeasurementDevice1();
    final Iec60870Device lightMeasurementDevice2 = Iec60870DeviceFactory.getLightMeasurementDevice2();
    when(this.iec60870DeviceRepository.findByGatewayDeviceIdentification(Iec60870DeviceFactory.GATEWAY_DEVICE_IDENTIFICATION)).thenReturn(Arrays.asList(lightMeasurementDevice1, lightMeasurementDevice2));
    this.lightMeasurementDeviceResponseService.sendLightSensorStatusResponse(measurementReportDto, lightMeasurementDevice1, responseMetadata, "");
    verify(this.pendingRequestsQueue).dequeue(eq(Iec60870DeviceFactory.LMD_1_DEVICE_IDENTIFICATION));
}
Also used : MeasurementReportDto(org.opensmartgridplatform.dto.da.measurements.MeasurementReportDto) Iec60870Device(org.opensmartgridplatform.adapter.protocol.iec60870.domain.entities.Iec60870Device) ResponseMetadata(org.opensmartgridplatform.adapter.protocol.iec60870.domain.valueobjects.ResponseMetadata) Test(org.junit.jupiter.api.Test)

Aggregations

ResponseMetadata (org.opensmartgridplatform.adapter.protocol.iec60870.domain.valueobjects.ResponseMetadata)10 MeasurementReportDto (org.opensmartgridplatform.dto.da.measurements.MeasurementReportDto)5 Test (org.junit.jupiter.api.Test)4 Iec60870Device (org.opensmartgridplatform.adapter.protocol.iec60870.domain.entities.Iec60870Device)3 ASdu (org.openmuc.j60870.ASdu)2 Given (io.cucumber.java.en.Given)1 IOException (java.io.IOException)1 ClientConnectionAlreadyInCacheException (org.opensmartgridplatform.adapter.protocol.iec60870.domain.exceptions.ClientConnectionAlreadyInCacheException)1 ClientConnectionEventListener (org.opensmartgridplatform.adapter.protocol.iec60870.domain.services.ClientConnectionEventListener)1 DeviceResponseService (org.opensmartgridplatform.adapter.protocol.iec60870.domain.services.DeviceResponseService)1 ConnectionParameters (org.opensmartgridplatform.adapter.protocol.iec60870.domain.valueobjects.ConnectionParameters)1 DeviceConnection (org.opensmartgridplatform.adapter.protocol.iec60870.domain.valueobjects.DeviceConnection)1 DomainInfo (org.opensmartgridplatform.adapter.protocol.iec60870.domain.valueobjects.DomainInfo)1 LogItem (org.opensmartgridplatform.adapter.protocol.iec60870.domain.valueobjects.LogItem)1 Iec60870AsduHandlerNotFoundException (org.opensmartgridplatform.iec60870.exceptions.Iec60870AsduHandlerNotFoundException)1