use of uk.gov.justice.services.core.interceptor.InterceptorContext in project microservice_framework by CJSCommonPlatform.
the class FileBasedInterceptorContextFactory method create.
public InterceptorContext create(final List<FileInputDetails> fileInputDetails, final JsonEnvelope envelope) {
final InterceptorContext interceptorContext = interceptorContextWithInput(envelope);
interceptorContext.setInputParameter(FILE_INPUT_DETAILS_LIST, fileInputDetails);
return interceptorContext;
}
use of uk.gov.justice.services.core.interceptor.InterceptorContext in project microservice_framework by CJSCommonPlatform.
the class LocalAuditInterceptorTest method shouldUseUnknownComponentIfComponentNotSet.
@Test
public void shouldUseUnknownComponentIfComponentNotSet() throws Exception {
final InterceptorContext inputContext = interceptorContextWithInput(inputEnvelope);
interceptorChain.processNext(inputContext);
verify(auditService).audit(inputEnvelope, UNKNOWN_COMPONENT);
verify(auditService).audit(outputEnvelope, UNKNOWN_COMPONENT);
}
use of uk.gov.justice.services.core.interceptor.InterceptorContext in project microservice_framework by CJSCommonPlatform.
the class LocalAuditInterceptorTest method shouldApplyAccessControlToInputIfLocalComponent.
@Test
public void shouldApplyAccessControlToInputIfLocalComponent() throws Exception {
final InterceptorContext inputContext = interceptorContextWithInput(inputEnvelope);
inputContext.setInputParameter("component", COMPONENT);
interceptorChain.processNext(inputContext);
verify(auditService).audit(inputEnvelope, COMPONENT);
verify(auditService).audit(outputEnvelope, COMPONENT);
}
use of uk.gov.justice.services.core.interceptor.InterceptorContext in project microservice_framework by CJSCommonPlatform.
the class EventBufferInterceptorTest method shouldCallEventBufferServiceAndProcessStreamOfMultipleEventsReturned.
@Test
public void shouldCallEventBufferServiceAndProcessStreamOfMultipleEventsReturned() throws Exception {
final InterceptorContext inputContext = interceptorContextWithInput(envelope_1);
final Stream<JsonEnvelope> envelopes = Stream.of(envelope_1, envelope_2);
when(eventBufferService.currentOrderedEventsWith(envelope_1)).thenReturn(envelopes);
final InterceptorContext resultContext = interceptorChain.processNext(inputContext);
assertThat(resultContext.inputEnvelope(), is(envelope_1));
assertThat(target.envelopesRecieved, contains(envelope_1, envelope_2));
}
use of uk.gov.justice.services.core.interceptor.InterceptorContext in project microservice_framework by CJSCommonPlatform.
the class EventBufferInterceptorTest method shouldCallEventBufferServiceAndProcessEmptyStreamReturned.
@Test
public void shouldCallEventBufferServiceAndProcessEmptyStreamReturned() throws Exception {
final Stream<JsonEnvelope> envelopeStream = Stream.empty();
final InterceptorContext interceptorContext = interceptorContextWithInput(envelope_1);
when(eventBufferService.currentOrderedEventsWith(envelope_1)).thenReturn(envelopeStream);
final InterceptorContext resultContext = interceptorChain.processNext(interceptorContext);
assertThat(resultContext, is(interceptorContext));
assertThat(target.envelopesRecieved, empty());
}
Aggregations