use of org.opensmartgridplatform.shared.infra.jms.ObjectMessageBuilder in project open-smart-grid-platform by OSGP.
the class UpdateFirmwareRequestMessageProcessorTest method processMessageTaskShouldUpdateFirmwareWhenFirmwareFileAvailable.
@Test
void processMessageTaskShouldUpdateFirmwareWhenFirmwareFileAvailable() throws JMSException, OsgpException {
// Arrange
final String firmwareIdentification = "available";
final String deviceIdentification = "availableToo";
final UpdateFirmwareRequestDto updateFirmwareRequestDto = new UpdateFirmwareRequestDto(firmwareIdentification, deviceIdentification);
final ObjectMessage message = new ObjectMessageBuilder().withObject(updateFirmwareRequestDto).withCorrelationUid("123456").build();
final MessageMetadata messageMetadata = MessageMetadata.fromMessage(message);
when(this.firmwareService.isFirmwareFileAvailable(firmwareIdentification)).thenReturn(true);
// Act
this.processor.processMessageTasks(message.getObject(), messageMetadata, this.dlmsConnectionManagerMock, this.device);
// Assert
verify(this.configurationService, times(1)).updateFirmware(nullable(DlmsConnectionManager.class), same(this.device), same(updateFirmwareRequestDto), any(MessageMetadata.class));
}
use of org.opensmartgridplatform.shared.infra.jms.ObjectMessageBuilder in project open-smart-grid-platform by OSGP.
the class PushNotificationSmsMessageProcessorTest method init.
@BeforeEach
public void init() throws JMSException {
final String correlationUid = "corr-uid-1";
final String organisationIdentification = "test-org";
final RequestMessage requestMessage = new RequestMessage(correlationUid, organisationIdentification, DEVICE_IDENTIFICATION, IP_ADDRESS, null, null, this.pushNotificationSms);
this.message = new ObjectMessageBuilder().withCorrelationUid(correlationUid).withMessageType(MessageType.PUSH_NOTIFICATION_SMS.name()).withDeviceIdentification(DEVICE_IDENTIFICATION).withObject(requestMessage).build();
}
Aggregations