Java Code Examples for org.apache.cxf.interceptor.InterceptorChain#iterator()
The following examples show how to use
org.apache.cxf.interceptor.InterceptorChain#iterator() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ColocUtilTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testGetOutInterceptorChain() throws Exception { PhaseManagerImpl phaseMgr = new PhaseManagerImpl(); SortedSet<Phase> list = phaseMgr.getInPhases(); ColocUtil.setPhases(list, Phase.SETUP, Phase.POST_LOGICAL); Endpoint ep = control.createMock(Endpoint.class); Service srv = control.createMock(Service.class); Exchange ex = new ExchangeImpl(); ex.put(Bus.class, bus); ex.put(Endpoint.class, ep); ex.put(Service.class, srv); EasyMock.expect(ep.getOutInterceptors()) .andReturn(new ArrayList<Interceptor<? extends Message>>()).atLeastOnce(); EasyMock.expect(ep.getService()).andReturn(srv).atLeastOnce(); EasyMock.expect(srv.getOutInterceptors()) .andReturn(new ArrayList<Interceptor<? extends Message>>()).atLeastOnce(); EasyMock.expect(bus.getOutInterceptors()) .andReturn(new ArrayList<Interceptor<? extends Message>>()).atLeastOnce(); control.replay(); InterceptorChain chain = ColocUtil.getOutInterceptorChain(ex, list); control.verify(); assertNotNull("Should have chain instance", chain); Iterator<Interceptor<? extends Message>> iter = chain.iterator(); assertFalse("Should not have interceptors in chain", iter.hasNext()); }
Example 2
Source File: ColocUtilTest.java From cxf with Apache License 2.0 | 5 votes |
@Test public void testGetInInterceptorChain() throws Exception { PhaseManagerImpl phaseMgr = new PhaseManagerImpl(); SortedSet<Phase> list = phaseMgr.getInPhases(); ColocUtil.setPhases(list, Phase.SETUP, Phase.POST_LOGICAL); Endpoint ep = control.createMock(Endpoint.class); Service srv = control.createMock(Service.class); Exchange ex = new ExchangeImpl(); ex.put(Bus.class, bus); ex.put(Endpoint.class, ep); ex.put(Service.class, srv); EasyMock.expect(bus.getExtension(PhaseManager.class)).andReturn(phaseMgr); EasyMock.expect(ep.getInInterceptors()) .andReturn(new ArrayList<Interceptor<? extends Message>>()).atLeastOnce(); EasyMock.expect(ep.getService()).andReturn(srv).atLeastOnce(); EasyMock.expect(srv.getInInterceptors()) .andReturn(new ArrayList<Interceptor<? extends Message>>()).atLeastOnce(); EasyMock.expect(bus.getInInterceptors()) .andReturn(new ArrayList<Interceptor<? extends Message>>()).atLeastOnce(); control.replay(); InterceptorChain chain = ColocUtil.getInInterceptorChain(ex, list); control.verify(); assertNotNull("Should have chain instance", chain); Iterator<Interceptor<? extends Message>> iter = chain.iterator(); assertFalse("Should not have interceptors in chain", iter.hasNext()); assertNotNull("OutFaultObserver should be set", chain.getFaultObserver()); }