public static AfterMethodCallChain afterMethodCallChain(final AfterMethodCall... calls) { return new AfterMethodCallChain(Arrays.asList(calls)); }
@Test public void testIntegrationWithServiceBundle() throws Exception { mdcForHttpRequestInterceptor = new SetupMdcForHttpRequestInterceptor(Sets.set("foo")); final CaptureRequestInterceptor captureRequestInterceptor = new CaptureRequestInterceptor(); captureRequestInterceptor.before(methodCallBuilder.setName("restMethod").setOriginatingRequest(httpRequest).build()); final ServiceBundle serviceBundle = ServiceBundleBuilder.serviceBundleBuilder() .setBeforeMethodCallOnServiceQueue(BeforeMethodCallChain.beforeMethodCallChain(captureRequestInterceptor, mdcForHttpRequestInterceptor)) .setAfterMethodCallOnServiceQueue(AfterMethodCallChain.afterMethodCallChain(captureRequestInterceptor, mdcForHttpRequestInterceptor)) .setBeforeMethodSent(new ForwardCallMethodInterceptor(new RequestContext())).build().startServiceBundle(); serviceBundle.addServiceObject("my", new MyServiceImpl()); final MyService localProxy = serviceBundle.createLocalProxy(MyService.class, "my"); final AsyncFutureCallback<String> callback = AsyncFutureBuilder.asyncFutureBuilder().build(String.class); localProxy.getRequestURI(callback); localProxy.clientProxyFlush(); assertEquals("/foo", callback.get()); final AsyncFutureCallback<Map<String, String>> callbackMap = AsyncFutureBuilder.asyncFutureBuilder() .buildMap(String.class, String.class); localProxy.getMDC(callbackMap); localProxy.clientProxyFlush(); validate(callbackMap.get()); captureRequestInterceptor.after(null, null); serviceBundle.stop(); }
private void configureEndpointServerBuilderForInterceptors(final EndpointServerBuilder endpointServerBuilder) { final Interceptors interceptors = configureInterceptors(); if (interceptors.before.size() > 0) { endpointServerBuilder.setBeforeMethodCallOnServiceQueue(new BeforeMethodCallChain(interceptors.before)); } if (interceptors.after.size() > 0) { endpointServerBuilder.setAfterMethodCallOnServiceQueue(new AfterMethodCallChain(interceptors.after)); } if (interceptors.beforeSent.size() > 0) { endpointServerBuilder.setBeforeMethodSent(new BeforeMethodSentChain(interceptors.beforeSent)); } }
private void configureServiceBuilderForInterceptors(final ServiceBuilder serviceBuilder) { final Interceptors interceptors = configureInterceptors(); if (interceptors.before.size() > 0) { serviceBuilder.setBeforeMethodCall(new BeforeMethodCallChain(interceptors.before)); } if (interceptors.after.size() > 0) { serviceBuilder.setAfterMethodCall(new AfterMethodCallChain(interceptors.after)); } if (interceptors.beforeSent.size() > 0) { serviceBuilder.setBeforeMethodSent(new BeforeMethodSentChain(interceptors.beforeSent)); } }
private void configureServiceBundleBuilderForInterceptors(final ServiceBundleBuilder serviceBundleBuilder) { final Interceptors interceptors = configureInterceptors(); if (interceptors.before.size() > 0) { serviceBundleBuilder.setBeforeMethodCallOnServiceQueue(new BeforeMethodCallChain(interceptors.before)); } if (interceptors.after.size() > 0) { serviceBundleBuilder.setAfterMethodCallOnServiceQueue(new AfterMethodCallChain(interceptors.after)); } if (interceptors.beforeSent.size() > 0) { serviceBundleBuilder.setBeforeMethodSent(new BeforeMethodSentChain(interceptors.beforeSent)); } }
public static AfterMethodCallChain afterMethodCallChain(final AfterMethodCall... calls) { return new AfterMethodCallChain(Arrays.asList(calls)); } private final List<AfterMethodCall> afterMethodCallList;
public static AfterMethodCallChain afterMethodCallChain(final AfterMethodCall... calls) { return new AfterMethodCallChain(Arrays.asList(calls)); }