@Test
 public void testPhases() {
   Bus bus = new SpringBusFactory().createBus();
   PhaseManager cxfPM = bus.getExtension(PhaseManager.class);
   PhaseManager defaultPM = new PhaseManagerImpl();
   SortedSet<Phase> cxfPhases = cxfPM.getInPhases();
   SortedSet<Phase> defaultPhases = defaultPM.getInPhases();
   assertEquals(defaultPhases.size(), cxfPhases.size());
   assertTrue(cxfPhases.equals(defaultPhases));
   cxfPhases = cxfPM.getOutPhases();
   defaultPhases = defaultPM.getOutPhases();
   assertEquals(defaultPhases.size(), cxfPhases.size());
   assertTrue(cxfPhases.equals(defaultPhases));
 }
Example #2
0
  protected void invokeInboundChain(Exchange ex, Endpoint ep) {
    Message m = getInBoundMessage(ex);
    Message inMsg = ep.getBinding().createMessage();
    MessageImpl.copyContent(m, inMsg);

    // Copy Response Context to Client inBound Message
    // TODO a Context Filter Strategy required.
    inMsg.putAll(m);

    inMsg.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
    inMsg.put(Message.INBOUND_MESSAGE, Boolean.TRUE);
    inMsg.setExchange(ex);

    Exception exc = inMsg.getContent(Exception.class);
    if (exc != null) {
      ex.setInFaultMessage(inMsg);
      ColocInFaultObserver observer = new ColocInFaultObserver(bus);
      observer.onMessage(inMsg);
    } else {
      // Handle Response
      ex.setInMessage(inMsg);
      PhaseManager pm = bus.getExtension(PhaseManager.class);
      SortedSet<Phase> phases = new TreeSet<Phase>(pm.getInPhases());
      ColocUtil.setPhases(phases, Phase.USER_LOGICAL, Phase.PRE_INVOKE);

      InterceptorChain chain = ColocUtil.getInInterceptorChain(ex, phases);
      inMsg.setInterceptorChain(chain);
      chain.doIntercept(inMsg);
    }
    ex.put(ClientImpl.FINISHED, Boolean.TRUE);
  }
Example #3
0
 protected static PhaseInterceptorChain setupInInterceptorChain(ClientConfiguration cfg) {
   PhaseManager pm = cfg.getBus().getExtension(PhaseManager.class);
   List<Interceptor<? extends Message>> i1 = cfg.getBus().getInInterceptors();
   List<Interceptor<? extends Message>> i2 = cfg.getInInterceptors();
   List<Interceptor<? extends Message>> i3 =
       cfg.getConduitSelector().getEndpoint().getInInterceptors();
   PhaseInterceptorChain chain = new PhaseChainCache().get(pm.getInPhases(), i1, i2, i3);
   chain.add(new ClientResponseFilterInterceptor());
   return chain;
 }