Search in sources :

Example 1 with Envelope

use of uk.gov.justice.services.messaging.Envelope in project microservice_framework by CJSCommonPlatform.

the class DispatcherDelegateTest method requestMethodShouldDelegateToDispatcher.

@Test
public void requestMethodShouldDelegateToDispatcher() throws Exception {
    final JsonEnvelope envelope = mock(JsonEnvelope.class);
    when(envelopePayloadTypeConverter.convert(any(Envelope.class), eq(JsonValue.class))).thenReturn(envelope);
    when(jsonEnvelopeRepacker.repack(envelope)).thenReturn(envelope);
    dispatcherDelegate.request(envelope);
    verify(dispatcher).dispatch(envelope);
}
Also used : JsonValue(javax.json.JsonValue) JsonEnvelope(uk.gov.justice.services.messaging.JsonEnvelope) Envelope(uk.gov.justice.services.messaging.Envelope) JsonEnvelope(uk.gov.justice.services.messaging.JsonEnvelope) Test(org.junit.Test)

Example 2 with Envelope

use of uk.gov.justice.services.messaging.Envelope in project microservice_framework by CJSCommonPlatform.

the class DispatcherDelegateTest method requestMethodShouldSpecifyResponsePayloadType.

@Test
public void requestMethodShouldSpecifyResponsePayloadType() throws Exception {
    final JsonEnvelope envelope = mock(JsonEnvelope.class);
    final JsonEnvelope response = mock(JsonEnvelope.class);
    when(envelopePayloadTypeConverter.convert(any(Envelope.class), eq(JsonValue.class))).thenReturn(envelope);
    when(jsonEnvelopeRepacker.repack(envelope)).thenReturn(envelope);
    when(dispatcher.dispatch(envelope)).thenReturn(response);
    dispatcherDelegate.request(envelope, Object.class);
    verify(requestResponseEnvelopeValidator).validateResponse(response);
}
Also used : JsonValue(javax.json.JsonValue) JsonEnvelope(uk.gov.justice.services.messaging.JsonEnvelope) Envelope(uk.gov.justice.services.messaging.Envelope) JsonEnvelope(uk.gov.justice.services.messaging.JsonEnvelope) Test(org.junit.Test)

Example 3 with Envelope

use of uk.gov.justice.services.messaging.Envelope in project microservice_framework by CJSCommonPlatform.

the class DispatcherDelegateTest method requestMethodShouldValidateEnvelope.

@Test
public void requestMethodShouldValidateEnvelope() throws Exception {
    final JsonEnvelope envelope = mock(JsonEnvelope.class);
    final JsonEnvelope response = mock(JsonEnvelope.class);
    when(envelopePayloadTypeConverter.convert(any(Envelope.class), eq(JsonValue.class))).thenReturn(envelope);
    when(jsonEnvelopeRepacker.repack(envelope)).thenReturn(envelope);
    when(dispatcher.dispatch(envelope)).thenReturn(response);
    dispatcherDelegate.request(envelope);
    verify(requestResponseEnvelopeValidator).validateResponse(response);
}
Also used : JsonValue(javax.json.JsonValue) JsonEnvelope(uk.gov.justice.services.messaging.JsonEnvelope) Envelope(uk.gov.justice.services.messaging.Envelope) JsonEnvelope(uk.gov.justice.services.messaging.JsonEnvelope) Test(org.junit.Test)

Example 4 with Envelope

use of uk.gov.justice.services.messaging.Envelope in project microservice_framework by CJSCommonPlatform.

the class DispatcherDelegateTest method sendMethodShouldValidateEnvelope.

@Test
public void sendMethodShouldValidateEnvelope() throws Exception {
    final JsonEnvelope envelope = mock(JsonEnvelope.class);
    when(envelopePayloadTypeConverter.convert(any(Envelope.class), eq(JsonValue.class))).thenReturn(envelope);
    when(jsonEnvelopeRepacker.repack(envelope)).thenReturn(envelope);
    dispatcherDelegate.send(envelope);
    verify(requestResponseEnvelopeValidator).validateRequest(envelope);
}
Also used : JsonValue(javax.json.JsonValue) JsonEnvelope(uk.gov.justice.services.messaging.JsonEnvelope) Envelope(uk.gov.justice.services.messaging.Envelope) JsonEnvelope(uk.gov.justice.services.messaging.JsonEnvelope) Test(org.junit.Test)

Example 5 with Envelope

use of uk.gov.justice.services.messaging.Envelope in project microservice_framework by CJSCommonPlatform.

the class DispatcherDelegateTest method sendMethodShouldDelegateToDispatcher.

@Test
public void sendMethodShouldDelegateToDispatcher() throws Exception {
    final JsonEnvelope envelope = mock(JsonEnvelope.class);
    when(envelopePayloadTypeConverter.convert(any(Envelope.class), eq(JsonValue.class))).thenReturn(envelope);
    when(jsonEnvelopeRepacker.repack(envelope)).thenReturn(envelope);
    dispatcherDelegate.send(envelope);
    verify(dispatcher).dispatch(envelope);
}
Also used : JsonValue(javax.json.JsonValue) JsonEnvelope(uk.gov.justice.services.messaging.JsonEnvelope) Envelope(uk.gov.justice.services.messaging.Envelope) JsonEnvelope(uk.gov.justice.services.messaging.JsonEnvelope) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 Envelope (uk.gov.justice.services.messaging.Envelope)6 JsonEnvelope (uk.gov.justice.services.messaging.JsonEnvelope)6 JsonValue (javax.json.JsonValue)5 Metadata (uk.gov.justice.services.messaging.Metadata)1