use of org.webpieces.microsvc.server.impl.TestCaseRecorderImpl in project webpieces by deanhiller.
the class RecordingFilter method writeOutTestCase.
private Action writeOutTestCase(Action resp) {
TestCaseRecorderImpl recorder = (TestCaseRecorderImpl) Context.get(TestCaseRecorder.RECORDER_KEY);
recorder.spitOutTestCase();
return resp;
}
use of org.webpieces.microsvc.server.impl.TestCaseRecorderImpl in project webpieces by deanhiller.
the class RecordingFilter method filter.
@Override
public XFuture<Action> filter(MethodMeta meta, Service<MethodMeta, Action> nextFilter) {
RequestContext context = Current.getContext();
List<RouterHeader> routerHeaders = context.getRequest().getHeaders().get(MicroSvcHeader.RECORDING.getHeaderName());
if (routerHeaders == null)
return nextFilter.invoke(meta);
Map<String, Object> fullRequestContext = Context.copyContext();
// let the recording begin...
Context.put(TestCaseRecorder.RECORDER_KEY, new TestCaseRecorderImpl(Current.getContext().getRequest().originalRequest, meta, fullRequestContext));
return nextFilter.invoke(meta).thenApply((resp) -> writeOutTestCase(resp));
}
Aggregations