Search in sources :

Example 11 with EventNotificationDto

use of org.opensmartgridplatform.dto.valueobjects.EventNotificationDto in project open-smart-grid-platform by OSGP.

the class EventNotificationMessageServiceTest method sendsLightSensorReportsLightEventToDomainTest.

@Test
void sendsLightSensorReportsLightEventToDomainTest() throws UnknownEntityException {
    final String deviceUid = "testUid";
    final String deviceIdentification = "testIdentification";
    final DateTime dateTime = DateTime.now();
    final EventTypeDto eventTypeDto = EventTypeDto.LIGHT_SENSOR_REPORTS_LIGHT;
    final String description = "Sensor reports light";
    final Integer index = 0;
    final EventNotificationDto eventNotificationDto = new EventNotificationDto(deviceUid, dateTime, eventTypeDto, description, index);
    this.eventNotificationMessageService.handleEvent(deviceIdentification, eventNotificationDto);
    final ArgumentMatcher<RequestMessage> matchesEventType = (final RequestMessage message) -> ((Event) message.getRequest()).getEventType() == EventType.LIGHT_SENSOR_REPORTS_LIGHT;
    verify(this.domainRequestService).send(argThat(matchesEventType), eq(MessageType.EVENT_NOTIFICATION.name()), any());
}
Also used : RequestMessage(org.opensmartgridplatform.shared.infra.jms.RequestMessage) EventNotificationDto(org.opensmartgridplatform.dto.valueobjects.EventNotificationDto) DateTime(org.joda.time.DateTime) EventTypeDto(org.opensmartgridplatform.dto.valueobjects.EventTypeDto) Test(org.junit.jupiter.api.Test)

Aggregations

EventNotificationDto (org.opensmartgridplatform.dto.valueobjects.EventNotificationDto)11 DateTime (org.joda.time.DateTime)6 EventTypeDto (org.opensmartgridplatform.dto.valueobjects.EventTypeDto)4 RequestMessage (org.opensmartgridplatform.shared.infra.jms.RequestMessage)4 ArrayList (java.util.ArrayList)2 DateTimeFormatter (org.joda.time.format.DateTimeFormatter)2 EventType (org.opensmartgridplatform.domain.core.valueobjects.EventType)2 BdaVisibleString (com.beanit.openiec61850.BdaVisibleString)1 FcModelNode (com.beanit.openiec61850.FcModelNode)1 Then (io.cucumber.java.en.Then)1 Serializable (java.io.Serializable)1 List (java.util.List)1 JMSException (javax.jms.JMSException)1 NotImplementedException (org.apache.commons.lang3.NotImplementedException)1 Test (org.junit.jupiter.api.Test)1 ProtocolAdapterException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)1 OslpDevice (org.opensmartgridplatform.adapter.protocol.oslp.elster.domain.entities.OslpDevice)1 LightMeasurementDevice (org.opensmartgridplatform.core.db.api.iec61850.entities.LightMeasurementDevice)1 Device (org.opensmartgridplatform.domain.core.entities.Device)1 Event (org.opensmartgridplatform.domain.core.entities.Event)1