use of uk.gov.justice.services.common.converter.jackson.ObjectMapperProducer in project microservice_framework by CJSCommonPlatform.
the class EnveloperFactory method create.
public DefaultEnveloper create() {
final ObjectMapper objectMapper = new ObjectMapperProducer().objectMapper();
final ObjectToJsonValueConverter converter = new ObjectToJsonValueConverter(objectMapper);
return new DefaultEnveloper(new UtcClock(), converter);
}
use of uk.gov.justice.services.common.converter.jackson.ObjectMapperProducer in project microservice_framework by CJSCommonPlatform.
the class DispatcherTest method setup.
@Before
public void setup() {
handlerRegistry = new HandlerRegistry(logger);
dispatcher = new Dispatcher(handlerRegistry, new EnvelopePayloadTypeConverter(new ObjectMapperProducer().objectMapper()), new JsonEnvelopeRepacker());
}
use of uk.gov.justice.services.common.converter.jackson.ObjectMapperProducer 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.common.converter.jackson.ObjectMapperProducer in project microservice_framework by CJSCommonPlatform.
the class DefaultEnveloperProviderTest method shouldDelegateToDefaultEnveloperFromCdiToEnvelopeWithMetadateFrom.
@Test
public void shouldDelegateToDefaultEnveloperFromCdiToEnvelopeWithMetadateFrom() throws Exception {
final DefaultEnveloper enveloper = new DefaultEnveloper(new UtcClock(), new ObjectToJsonValueConverter(new ObjectMapperProducer().objectMapper()));
enveloper.register(new EventFoundEvent(DefaultEnveloperProviderTest.TestEvent.class, TEST_EVENT_NAME));
final Metadata metadata = createMetadata();
final TestPojo payload = new TestPojo(TEST_EVENT_NAME);
final Envelope<TestPojo> envelope = envelopeFrom(metadata, payload);
final Function<Object, JsonEnvelope> envelope1 = new DefaultEnveloperProvider().toEnvelopeWithMetadataFrom(envelope);
final TestEvent testEvent = new TestEvent();
assertThat(envelope1.apply(testEvent).metadata().name(), is(metadata.name()));
assertThat(envelope.payload(), is(payload));
}
Aggregations