use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class AdHocManagementServiceTest method testSetReboot.
@Test
public void testSetReboot() throws Exception {
this.givenOnlyTheIdentifiedOrganisationExists(ORGANISATION_IDENTIFICATION);
final ArgumentCaptor<RequestMessage> messageCaptor = ArgumentCaptor.forClass(RequestMessage.class);
this.adHocManagementService.setReboot(ORGANISATION_IDENTIFICATION, DEVICE_IDENTIFICATION, CORRELATION_UUID, MESSAGE_TYPE, PRIORITY);
verify(this.osgpCoreRequestMessageSender).send(messageCaptor.capture(), eq(MESSAGE_TYPE), eq(PRIORITY), eq(IP_ADDRESS));
final RequestMessage message = messageCaptor.getValue();
assertThat(message.getCorrelationUid()).isEqualTo(CORRELATION_UUID);
assertThat(message.getOrganisationIdentification()).isEqualTo(ORGANISATION_IDENTIFICATION);
}
use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class DeviceInstallationService method startSelfTest.
// === START DEVICE TEST ===
public void startSelfTest(@Identification final String deviceIdentification, @Identification final String organisationIdentification, final String correlationUid, final String messageType, final int messagePriority) throws FunctionalException {
LOGGER.debug("startSelfTest called with organisation {} and device {}", organisationIdentification, deviceIdentification);
this.findOrganisation(organisationIdentification);
final Device device = this.findActiveDevice(deviceIdentification);
this.osgpCoreRequestMessageSender.send(new RequestMessage(correlationUid, organisationIdentification, deviceIdentification, null), messageType, messagePriority, device.getIpAddress());
}
use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class DeviceInstallationService method stopSelfTest.
// === STOP DEVICE TEST ===
public void stopSelfTest(@Identification final String deviceIdentification, @Identification final String organisationIdentification, final String correlationUid, final String messageType, final int messagePriority) throws FunctionalException {
LOGGER.debug("stopSelfTest called with organisation {} and device {}", organisationIdentification, deviceIdentification);
this.findOrganisation(organisationIdentification);
final Device device = this.findActiveDevice(deviceIdentification);
this.osgpCoreRequestMessageSender.send(new RequestMessage(correlationUid, organisationIdentification, deviceIdentification, null), messageType, messagePriority, device.getIpAddress());
}
use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class OsgpCoreRequestMessageListener method onMessage.
@Override
public void onMessage(final Message message) {
try {
LOGGER.info("Received message");
final ObjectMessage objectMessage = (ObjectMessage) message;
final String messageType = objectMessage.getJMSType();
final RequestMessage requestMessage = (RequestMessage) objectMessage.getObject();
this.messageProcessor.processMessage(requestMessage, messageType);
} catch (final JMSException e) {
// Can't read message.
LOGGER.error("Exception: {}, StackTrace: {}", e.getMessage(), e.getStackTrace(), e);
} catch (final UnknownMessageTypeException e) {
// Don't know this message.
LOGGER.error("UnknownMessageTypeException", e);
}
}
use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class DlmsChannelHandlerServer method processPushedAlarm.
private void processPushedAlarm(final DlmsPushNotification message, final String correlationId, final String deviceIdentification, final String ipAddress) {
this.logMessage(message);
final PushNotificationAlarmDto pushNotificationAlarm = new PushNotificationAlarmDto(deviceIdentification, message.getAlarms(), message.toByteArray());
final RequestMessage requestMessage = new RequestMessage(correlationId, "no-organisation", deviceIdentification, ipAddress, null, null, pushNotificationAlarm);
final MessageMetadata messageMetadata = new Builder().withMessagePriority(MessagePriorityEnum.HIGH.getPriority()).build();
log.info("Sending push notification alarm to GXF with correlation ID: {}", correlationId);
this.osgpRequestMessageSender.send(requestMessage, MessageType.PUSH_NOTIFICATION_ALARM.name(), messageMetadata);
}
Aggregations