use of org.opensmartgridplatform.shared.infra.jms.ObjectMessageBuilder in project open-smart-grid-platform by OSGP.
the class OsgpCoreRequestSteps method whenIReceiveAConnectRequestForIEC60870DeviceFromOsgpCore.
@When("I receive a connect request for IEC60870 device {string} from osgp core")
public void whenIReceiveAConnectRequestForIEC60870DeviceFromOsgpCore(final String deviceIdentification) throws Exception {
this.connectionSteps.prepareForConnect(deviceIdentification);
final ObjectMessage message = new ObjectMessageBuilder().withDeviceIdentification(deviceIdentification).withMessageType(MessageType.CONNECT.name()).withObject(new ConnectRequestDto()).build();
this.messageListener.onMessage(message);
}
use of org.opensmartgridplatform.shared.infra.jms.ObjectMessageBuilder in project open-smart-grid-platform by OSGP.
the class OsgpCoreRequestSteps method whenIReceiveAGetLightSensorStatusRequestMessageForIEC60870DeviceFromOsgpCore.
@When("I receive a get light sensor status request message for IEC60870 device {string} from osgp core")
public void whenIReceiveAGetLightSensorStatusRequestMessageForIEC60870DeviceFromOsgpCore(final String deviceIdentification) throws Exception {
this.connectionSteps.prepareForConnect(deviceIdentification);
final ObjectMessage message = new ObjectMessageBuilder().withDeviceIdentification(deviceIdentification).withMessageType(MessageType.GET_LIGHT_SENSOR_STATUS.name()).withObject(new ConnectRequestDto()).build();
this.messageListener.onMessage(message);
}
use of org.opensmartgridplatform.shared.infra.jms.ObjectMessageBuilder in project open-smart-grid-platform by OSGP.
the class OsgpCoreRequestSteps method whenIReceiveRequestForIec60870Device.
@When("I receive a request for the IEC60870 device")
public void whenIReceiveRequestForIec60870Device() throws JMSException {
final ObjectMessage message = new ObjectMessageBuilder().withDeviceIdentification(DEFAULT_DEVICE_IDENTIFICATION).withMessageType(DEFAULT_MESSAGE_TYPE).withObject(new GetHealthStatusRequestDto()).build();
this.messageListener.onMessage(message);
}
use of org.opensmartgridplatform.shared.infra.jms.ObjectMessageBuilder in project open-smart-grid-platform by OSGP.
the class PushNotificationAlarmMessageProcessorTest method init.
@BeforeEach
public void init() throws JMSException, UnknownEntityException {
final String correlationUid = "corr-uid-1";
final String organisationIdentification = "test-org";
final String ipAddress = "127.0.0.1";
final RequestMessage requestMessage = new RequestMessage(correlationUid, organisationIdentification, DEVICE_IDENTIFICATION, ipAddress, null, null, this.pushNotificationAlarm);
this.message = new ObjectMessageBuilder().withCorrelationUid(correlationUid).withMessageType(MessageType.PUSH_NOTIFICATION_ALARM.name()).withDeviceIdentification(DEVICE_IDENTIFICATION).withObject(requestMessage).build();
this.device = new Device(DEVICE_IDENTIFICATION);
when(this.deviceRepository.findByDeviceIdentification(DEVICE_IDENTIFICATION)).thenReturn(this.device);
when(this.deviceRepository.save(this.device)).thenAnswer((Answer<Void>) invocationOnMock -> null);
doNothing().when(this.eventNotificationMessageService).handleEvent(any(String.class), any(Date.class), any(EventType.class), any(String.class), any(Integer.class));
when(this.deviceAuthorizationRepository.findByDeviceAndFunctionGroup(this.device, DeviceFunctionGroup.OWNER)).thenReturn(Collections.singletonList(this.deviceAuthorization));
when(this.deviceAuthorization.getOrganisation()).thenReturn(this.organisation);
when(this.organisation.getOrganisationIdentification()).thenReturn(requestMessage.getOrganisationIdentification());
when(this.domainInfoRepository.findAll()).thenReturn(Collections.singletonList(this.domainInfo));
when(this.domainInfo.getDomain()).thenReturn("SMART_METERING");
when(this.domainInfo.getDomainVersion()).thenReturn("1.0");
doNothing().when(this.domainRequestService).send(any(RequestMessage.class), any(String.class), any(DomainInfo.class));
}
use of org.opensmartgridplatform.shared.infra.jms.ObjectMessageBuilder in project open-smart-grid-platform by OSGP.
the class SystemEventMessageProcessorTest method init.
@BeforeEach
public void init() throws JMSException {
final String correlationUid = "corr-uid-1";
final String organisationIdentification = "test-org";
final String ipAddress = "127.0.0.1";
final String domain = "SMART_METERING";
final String domainVersion = "1.0";
final RequestMessage requestMessage = new RequestMessage(correlationUid, organisationIdentification, DEVICE_IDENTIFICATION, ipAddress, null, null, this.systemEventDto);
this.message = new ObjectMessageBuilder().withCorrelationUid(correlationUid).withMessageType(MessageType.SYSTEM_EVENT.name()).withDeviceIdentification(DEVICE_IDENTIFICATION).withObject(requestMessage).build();
this.message.setStringProperty(Constants.DOMAIN, domain);
this.message.setStringProperty(Constants.DOMAIN_VERSION, domainVersion);
when(this.domainInfoRepository.findByDomainAndDomainVersion(domain, domainVersion)).thenReturn(this.domainInfo);
doNothing().when(this.domainRequestService).send(any(RequestMessage.class), any(String.class), any(DomainInfo.class));
}
Aggregations