use of uk.gov.justice.services.core.interceptor.Interceptor in project microservice_framework by CJSCommonPlatform.
the class LocalAuditInterceptorTest method setup.
@Before
public void setup() throws Exception {
final Deque<Interceptor> interceptors = new LinkedList<>();
interceptors.add(localAuditInterceptor);
final Target target = context -> context.copyWithOutput(outputEnvelope);
interceptorChain = new DefaultInterceptorChain(interceptors, target);
}
use of uk.gov.justice.services.core.interceptor.Interceptor in project microservice_framework by CJSCommonPlatform.
the class EventBufferInterceptorTest method setup.
@Before
public void setup() throws Exception {
final Deque<Interceptor> interceptors = new LinkedList<>();
interceptors.add(eventBufferInterceptor);
target = new TestTarget();
interceptorChain = new DefaultInterceptorChain(interceptors, target);
}
use of uk.gov.justice.services.core.interceptor.Interceptor in project microservice_framework by CJSCommonPlatform.
the class EventFilterInterceptorCodeGeneratorTest method nowTestTheGeneratedClass.
private void nowTestTheGeneratedClass(final Class<?> generatedClass) throws Exception {
final String eventName = "an.event.name";
final Interceptor interceptor = buildTheClassForTest(generatedClass, new MyCustomEventFilter(eventName));
final InterceptorContext interceptorContext_1 = mock(InterceptorContext.class, "interceptorContext_1");
final InterceptorContext interceptorContext_2 = mock(InterceptorContext.class, "interceptorContext_2");
final InterceptorChain interceptorChain = mock(InterceptorChain.class);
final JsonEnvelope jsonEnvelope = mock(JsonEnvelope.class);
final Metadata metadata = mock(Metadata.class);
when(interceptorContext_1.inputEnvelope()).thenReturn(jsonEnvelope);
when(jsonEnvelope.metadata()).thenReturn(metadata);
when(metadata.name()).thenReturn(eventName);
when(interceptorChain.processNext(interceptorContext_1)).thenReturn(interceptorContext_2);
assertThat(interceptor.process(interceptorContext_1, interceptorChain), is(interceptorContext_2));
}
Aggregations