CitrusMessageDispatcherServlet extends MessageDispatcherServlet { protected void configureHandlerInterceptor(ApplicationContext context) { if (context.containsBean(ENDPOINT_INTERCEPTOR_BEAN_NAME)) { DelegatingEndpointInterceptor endpointInterceptor = context.getBean(ENDPOINT_INTERCEPTOR_BEAN_NAME, DelegatingEndpointInterceptor.class); endpointInterceptor.setInterceptors(adaptInterceptors(webServiceServer.getInterceptors())); } } CitrusMessageDispatcherServlet(WebServiceServer webServiceServer);   }
@Test public void testConfigureHandlerInterceptor() throws Exception { List<Object> interceptors = new ArrayList<Object>(); interceptors.add(new LoggingEndpointInterceptor()); interceptors.add(new SoapMustUnderstandEndpointInterceptor()); reset(webServiceServer); when(webServiceServer.getInterceptors()).thenReturn(interceptors); when(webServiceServer.getEndpointAdapter()).thenReturn(null); when(webServiceServer.getMessageConverter()).thenReturn(new SoapMessageConverter()); when(webServiceServer.isHandleMimeHeaders()).thenReturn(false); when(webServiceServer.isHandleAttributeHeaders()).thenReturn(false); when(webServiceServer.isKeepSoapEnvelope()).thenReturn(false); when(webServiceServer.getSoapHeaderNamespace()).thenReturn(null); when(webServiceServer.getSoapHeaderPrefix()).thenReturn(""); servlet.initStrategies(applicationContext); Assert.assertEquals(endpointInterceptor.getInterceptors().size(), 2L); Assert.assertEquals(endpointInterceptor.getInterceptors().get(0), interceptors.get(0)); Assert.assertEquals(endpointInterceptor.getInterceptors().get(1), interceptors.get(1)); Assert.assertEquals(webServiceEndpoint.getEndpointAdapter().getClass(), EmptyResponseEndpointAdapter.class); Assert.assertEquals(webServiceEndpoint.getEndpointConfiguration().getMessageConverter().getClass(), SoapMessageConverter.class); Assert.assertFalse(webServiceEndpoint.getEndpointConfiguration().isHandleMimeHeaders()); Assert.assertFalse(webServiceEndpoint.getEndpointConfiguration().isHandleAttributeHeaders()); Assert.assertFalse(webServiceEndpoint.getEndpointConfiguration().isKeepSoapEnvelope()); Assert.assertNull(webServiceEndpoint.getDefaultNamespaceUri()); Assert.assertEquals(webServiceEndpoint.getDefaultPrefix(), ""); }