use of uk.gov.justice.services.core.interceptor.DefaultInterceptorChain in project microservice_framework by CJSCommonPlatform.
the class EventBufferInterceptorTest method ensureStreamCLosedIfExceptionOccurs.
@Test
public void ensureStreamCLosedIfExceptionOccurs() throws Exception {
final Deque<Interceptor> interceptors = new LinkedList<>();
interceptors.add(eventBufferInterceptor);
interceptors.add(new ExceptionThrowingInterceptor());
target = new TestTarget();
interceptorChain = new DefaultInterceptorChain(interceptors, target);
final InterceptorContext inputContext = interceptorContextWithInput(envelope_1);
final StreamCloseSpy streamSpy = new StreamCloseSpy();
final Stream<JsonEnvelope> envelopes = Stream.of(this.envelope_1, envelope_2).onClose(streamSpy);
when(eventBufferService.currentOrderedEventsWith(this.envelope_1)).thenReturn(envelopes);
try {
interceptorChain.processNext(inputContext);
} catch (TestException expected) {
// do nothing
}
assertThat(streamSpy.streamClosed(), is(true));
}
use of uk.gov.justice.services.core.interceptor.DefaultInterceptorChain in project microservice_framework by CJSCommonPlatform.
the class InputStreamFileInterceptorTest method setup.
@Before
public void setup() throws Exception {
final Deque<Interceptor> interceptors = new LinkedList<>();
interceptors.add(inputStreamFileInterceptor);
interceptorChain = new DefaultInterceptorChain(interceptors, this::processResult);
}
use of uk.gov.justice.services.core.interceptor.DefaultInterceptorChain in project microservice_framework by CJSCommonPlatform.
the class LocalAccessControlInterceptorTest method setup.
@Before
public void setup() throws Exception {
final Deque<Interceptor> interceptors = new LinkedList<>();
interceptors.add(localAccessControlInterceptor);
final Target target = context -> context;
interceptorChain = new DefaultInterceptorChain(interceptors, target);
}
use of uk.gov.justice.services.core.interceptor.DefaultInterceptorChain 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.DefaultInterceptorChain 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);
}
Aggregations