Search in sources :

Example 6 with RetryHeader

use of org.opensmartgridplatform.shared.infra.jms.RetryHeader in project open-smart-grid-platform by OSGP.

the class ProtocolResponseMessageSendingHandlerTest method sendsProtocolResponseMessageThatAvoidsRetries.

@Test
void sendsProtocolResponseMessageThatAvoidsRetries() {
    final ProtocolResponseMessageSendingHandler protocolResponseMessageSendingHandler = this.aProtocolResponseMessageSendingHandler();
    protocolResponseMessageSendingHandler.handlePublishedMessage("any/topic", "any-payload".getBytes(StandardCharsets.UTF_8));
    verify(this.outboundOsgpCoreResponseMessageSender).send(this.responseMessageCaptor.capture());
    final ResponseMessage actualResponseMessage = this.responseMessageCaptor.getValue();
    final MessageMetadata actualMessageMetadata = actualResponseMessage.messageMetadata();
    assertThat(actualMessageMetadata.isScheduled()).isFalse();
    assertThat(actualMessageMetadata.isBypassRetry()).isTrue();
    final RetryHeader retryHeader = actualResponseMessage.getRetryHeader();
    if (retryHeader != null) {
        assertThat(retryHeader.getScheduledRetryTime()).isNull();
        assertThat(retryHeader.getMaxRetries()).isZero();
    }
}
Also used : MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) RetryHeader(org.opensmartgridplatform.shared.infra.jms.RetryHeader) Test(org.junit.jupiter.api.Test)

Aggregations

RetryHeader (org.opensmartgridplatform.shared.infra.jms.RetryHeader)6 Calendar (java.util.Calendar)3 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)3 ProtocolResponseMessage (org.opensmartgridplatform.shared.infra.jms.ProtocolResponseMessage)3 Date (java.util.Date)2 Test (org.junit.jupiter.api.Test)2 ScheduledTask (org.opensmartgridplatform.domain.core.entities.ScheduledTask)2 ResponseMessage (org.opensmartgridplatform.shared.infra.jms.ResponseMessage)2 ResponseMessageResultType (org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType)2 Timestamp (java.sql.Timestamp)1 Message (org.opensmartgridplatform.oslp.Oslp.Message)1 OslpEnvelope (org.opensmartgridplatform.oslp.OslpEnvelope)1 SignedOslpEnvelopeDto (org.opensmartgridplatform.oslp.SignedOslpEnvelopeDto)1 MessageMetadata (org.opensmartgridplatform.shared.infra.jms.MessageMetadata)1