use of uk.gov.justice.services.core.dispatcher.JsonEnvelopeRepacker in project microservice_framework by CJSCommonPlatform.
the class InterceptorChainProcessorProducerTest method setUp.
@Before
public void setUp() throws Exception {
interceptorChainProcessorProducer.dispatcherCache = new DispatcherCache(new DispatcherFactory(new EnvelopePayloadTypeConverter(new ObjectMapperProducer().objectMapper()), new JsonEnvelopeRepacker()));
envelopeRecordingInterceptor.reset();
}
use of uk.gov.justice.services.core.dispatcher.JsonEnvelopeRepacker in project microservice_framework by CJSCommonPlatform.
the class SenderProducerTest method shouldCreateANewSenderDispatcherDelegate.
@Test
public void shouldCreateANewSenderDispatcherDelegate() throws Exception {
final InjectionPoint injectionPoint = mock(InjectionPoint.class);
final Dispatcher dispatcher = mock(Dispatcher.class);
when(dispatcherCache.dispatcherFor(injectionPoint)).thenReturn(dispatcher);
final DispatcherDelegate dispatcherDelegate = (DispatcherDelegate) senderProducer.produceSender(injectionPoint);
assertThat(privateField("dispatcher", dispatcherDelegate, Dispatcher.class), is(dispatcher));
assertThat(privateField("systemUserUtil", dispatcherDelegate, SystemUserUtil.class), is(systemUserUtil));
assertThat(privateField("envelopePayloadTypeConverter", dispatcherDelegate, EnvelopePayloadTypeConverter.class), is(envelopePayloadTypeConverter));
assertThat(privateField("jsonEnvelopeRepacker", dispatcherDelegate, JsonEnvelopeRepacker.class), is(jsonEnvelopeRepacker));
final RequestResponseEnvelopeValidator requestResponseEnvelopeValidator = privateField("requestResponseEnvelopeValidator", dispatcherDelegate, RequestResponseEnvelopeValidator.class);
assertThat(privateField("nameToMediaTypeConverter", requestResponseEnvelopeValidator, NameToMediaTypeConverter.class), is(nameToMediaTypeConverter));
assertThat(privateField("mediaTypeProvider", requestResponseEnvelopeValidator, MediaTypeProvider.class), is(mediaTypeProvider));
assertThat(privateField("envelopeInspector", requestResponseEnvelopeValidator, EnvelopeInspector.class), is(envelopeInspector));
final EnvelopeValidator envelopeValidator = privateField("envelopeValidator", requestResponseEnvelopeValidator, EnvelopeValidator.class);
assertThat(privateField("jsonSchemaValidator", envelopeValidator, JsonSchemaValidator.class), is(jsonSchemaValidator));
assertThat(privateField("objectMapper", envelopeValidator, ObjectMapper.class), is(objectMapper));
assertThat(privateField("envelopeValidationExceptionHandler", envelopeValidator, EnvelopeValidationExceptionHandler.class), is(envelopeValidationExceptionHandler));
}
use of uk.gov.justice.services.core.dispatcher.JsonEnvelopeRepacker in project microservice_framework by CJSCommonPlatform.
the class RequesterProducerTest method requesterShouldDelegateAdminRequestSubstitutingUserId.
@Test
public void requesterShouldDelegateAdminRequestSubstitutingUserId() throws Exception {
final InjectionPoint injectionPoint = mock(InjectionPoint.class);
final Dispatcher dispatcher = mock(Dispatcher.class);
when(dispatcherCache.dispatcherFor(injectionPoint)).thenReturn(dispatcher);
final DispatcherDelegate dispatcherDelegate = (DispatcherDelegate) requesterProducer.produceRequester(injectionPoint);
assertThat(privateField("dispatcher", dispatcherDelegate, Dispatcher.class), is(dispatcher));
assertThat(privateField("systemUserUtil", dispatcherDelegate, SystemUserUtil.class), is(systemUserUtil));
assertThat(privateField("envelopePayloadTypeConverter", dispatcherDelegate, EnvelopePayloadTypeConverter.class), is(envelopePayloadTypeConverter));
assertThat(privateField("jsonEnvelopeRepacker", dispatcherDelegate, JsonEnvelopeRepacker.class), is(jsonEnvelopeRepacker));
final RequestResponseEnvelopeValidator requestResponseEnvelopeValidator = privateField("requestResponseEnvelopeValidator", dispatcherDelegate, RequestResponseEnvelopeValidator.class);
assertThat(privateField("nameToMediaTypeConverter", requestResponseEnvelopeValidator, NameToMediaTypeConverter.class), is(nameToMediaTypeConverter));
assertThat(privateField("mediaTypeProvider", requestResponseEnvelopeValidator, MediaTypeProvider.class), is(mediaTypeProvider));
assertThat(privateField("envelopeInspector", requestResponseEnvelopeValidator, EnvelopeInspector.class), is(envelopeInspector));
final EnvelopeValidator envelopeValidator = privateField("envelopeValidator", requestResponseEnvelopeValidator, EnvelopeValidator.class);
assertThat(privateField("jsonSchemaValidator", envelopeValidator, JsonSchemaValidator.class), is(jsonSchemaValidator));
assertThat(privateField("objectMapper", envelopeValidator, ObjectMapper.class), is(objectMapper));
assertThat(privateField("envelopeValidationExceptionHandler", envelopeValidator, EnvelopeValidationExceptionHandler.class), is(envelopeValidationExceptionHandler));
}
Aggregations