Java Code Examples for org.apache.cxf.interceptor.Interceptor

The following examples show how to use org.apache.cxf.interceptor.Interceptor. These examples are extracted from open source projects. 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 Project: cxf   Source File: PolicyInterceptorsTest.java    License: Apache License 2.0 6 votes vote down vote up
private void doTestBasics(Interceptor<Message> interceptor, boolean isClient, boolean usesOperationInfo) {
    setupMessage(!isClient, isClient, usesOperationInfo, !usesOperationInfo, false, false);
    control.replay();
    interceptor.handleMessage(message);
    control.verify();

    control.reset();
    setupMessage(isClient, isClient, usesOperationInfo, !usesOperationInfo, false, false);
    control.replay();
    interceptor.handleMessage(message);
    control.verify();

    control.reset();
    setupMessage(isClient, isClient, usesOperationInfo, usesOperationInfo, false, false);
    control.replay();
    interceptor.handleMessage(message);
    control.verify();

    control.reset();
    setupMessage(isClient, isClient, usesOperationInfo, usesOperationInfo, true, false);
    control.replay();
    interceptor.handleMessage(message);
    control.verify();
}
 
Example 2
Source Project: cxf   Source File: EffectivePolicyImplTest.java    License: Apache License 2.0 6 votes vote down vote up
private void setupRegistryInterceptors(boolean useIn, boolean fault,
                                       PolicyInterceptorProviderRegistry reg, QName qn,
                                       List<Interceptor<? extends Message>> m) {
    if (useIn && !fault) {
        EasyMock.expect(reg.getInInterceptorsForAssertion(qn))
            .andReturn(m);
    } else if (!useIn && !fault) {
        EasyMock.expect(reg.getOutInterceptorsForAssertion(qn))
            .andReturn(m);
    } else if (useIn && fault) {
        EasyMock.expect(reg.getInFaultInterceptorsForAssertion(qn))
            .andReturn(m);
    } else if (!useIn && fault) {
        EasyMock.expect(reg.getOutFaultInterceptorsForAssertion(qn))
            .andReturn(m);
    }
}
 
Example 3
Source Project: cxf   Source File: ControlImpl.java    License: Apache License 2.0 6 votes vote down vote up
public void setFaultLocation(FaultLocation fl) {
    List<Interceptor<? extends Message>> interceptors = greeterBus.getInInterceptors();
    FaultThrowingInterceptor fi = null;
    for (Interceptor<? extends Message> i : interceptors) {
        if (i instanceof FaultThrowingInterceptor) {
            interceptors.remove(i);
            LOG.fine("Removed existing FaultThrowingInterceptor");
            break;
        }
    }
    if (null == fl.getPhase() || "".equals(fl.getPhase())) {
        LOG.fine("Removed FaultThrowingInterceptor");
        return;
    }

    fi = new FaultThrowingInterceptor(fl.getPhase());
    if (null != fl.getBefore() && !"".equals(fl.getBefore())) {
        fi.addBefore(fl.getBefore());
    }
    if (null != fl.getAfter() && !"".equals(fl.getAfter())) {
        fi.addAfter(fl.getAfter());
    }

    interceptors.add(fi);
    LOG.fine("Added FaultThrowingInterceptor to phase " + fl.getPhase());
}
 
Example 4
Source Project: cxf   Source File: AnnotationInterceptorTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testSimpleFrontend() throws Exception {
    fb.setServiceClass(HelloService.class);
    HelloService hello = new HelloServiceImpl();
    fb.setServiceBean(hello);
    server = fb.create();

    List<Interceptor<? extends Message>> interceptors
        = server.getEndpoint().getInInterceptors();
    assertTrue(hasTestInterceptor(interceptors));
    assertFalse(hasTest2Interceptor(interceptors));

    List<Interceptor<? extends Message>> outFaultInterceptors
        = server.getEndpoint().getOutFaultInterceptors();
    assertTrue(hasTestInterceptor(outFaultInterceptors));
    assertTrue(hasTest2Interceptor(outFaultInterceptors));
}
 
Example 5
Source Project: steady   Source File: CryptoCoverageCheckerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testOrder() throws Exception {
    //make sure the interceptors get ordered correctly
    SortedSet<Phase> phases = new TreeSet<Phase>();
    phases.add(new Phase(Phase.PRE_PROTOCOL, 1));
    
    List<Interceptor<? extends Message>> lst = 
        new ArrayList<Interceptor<? extends Message>>();
    lst.add(new MustUnderstandInterceptor());
    lst.add(new WSS4JInInterceptor());
    lst.add(new SAAJInInterceptor());
    lst.add(new CryptoCoverageChecker());
    PhaseInterceptorChain chain = new PhaseInterceptorChain(phases);
    chain.add(lst);
    String output = chain.toString();
    assertTrue(output.contains("MustUnderstandInterceptor, SAAJInInterceptor, "
            + "WSS4JInInterceptor, CryptoCoverageChecker"));
}
 
Example 6
Source Project: camelinaction2   Source File: WssAuthTest.java    License: Apache License 2.0 6 votes vote down vote up
protected static OrderEndpoint createCXFClient(String url, String user, String passwordCallbackClass) {
    List<Interceptor<? extends Message>> outInterceptors = new ArrayList();

    // Define WSS4j properties for flow outgoing
    Map<String, Object> outProps = new HashMap<String, Object>();
    outProps.put("action", "UsernameToken Timestamp");
    outProps.put("user", user);
    outProps.put("passwordCallbackClass", passwordCallbackClass);

    WSS4JOutInterceptor wss4j = new WSS4JOutInterceptor(outProps);
    // Add LoggingOutInterceptor
    LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor();

    outInterceptors.add(wss4j);
    outInterceptors.add(loggingOutInterceptor);

    // we use CXF to create a client for us as its easier than JAXWS and works
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setOutInterceptors(outInterceptors);
    factory.setServiceClass(OrderEndpoint.class);
    factory.setAddress(url);
    return (OrderEndpoint) factory.create();
}
 
Example 7
Source Project: cxf   Source File: PhaseInterceptorChainTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testThreeInterceptorSamePhaseWithOrder() throws Exception {
    AbstractPhaseInterceptor<? extends Message> p1 = setUpPhaseInterceptor("phase1", "p1");
    Set<String> before = new HashSet<>();
    before.add("p1");
    AbstractPhaseInterceptor<? extends Message> p2 = setUpPhaseInterceptor("phase1", "p2", before, null);
    Set<String> before1 = new HashSet<>();
    before1.add("p2");
    AbstractPhaseInterceptor<? extends Message> p3 = setUpPhaseInterceptor("phase1", "p3", before1, null);
    control.replay();
    chain.add(p3);
    chain.add(p1);
    chain.add(p2);

    Iterator<Interceptor<? extends Message>> it = chain.iterator();
    assertSame("Unexpected interceptor at this position.", p3, it.next());
    assertSame("Unexpected interceptor at this position.", p2, it.next());
    assertSame("Unexpected interceptor at this position.", p1, it.next());
    assertFalse(it.hasNext());
}
 
Example 8
Source Project: cxf   Source File: CryptoCoverageCheckerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testOrder() throws Exception {
    //make sure the interceptors get ordered correctly
    SortedSet<Phase> phases = new TreeSet<>();
    phases.add(new Phase(Phase.PRE_PROTOCOL, 1));

    List<Interceptor<? extends Message>> lst = new ArrayList<>();
    lst.add(new MustUnderstandInterceptor());
    lst.add(new WSS4JInInterceptor());
    lst.add(new SAAJInInterceptor());
    lst.add(new CryptoCoverageChecker());
    PhaseInterceptorChain chain = new PhaseInterceptorChain(phases);
    chain.add(lst);
    String output = chain.toString();
    assertTrue(output.contains("MustUnderstandInterceptor, SAAJInInterceptor, "
            + "WSS4JInInterceptor, CryptoCoverageChecker"));
}
 
Example 9
Source Project: cxf   Source File: MustUnderstandInterceptor.java    License: Apache License 2.0 6 votes vote down vote up
private void initServiceSideInfo(Set<QName> mustUnderstandQNames, SoapMessage soapMessage,
                Set<URI> serviceRoles, Set<QName> paramHeaders) {

    if (paramHeaders != null) {
        mustUnderstandQNames.addAll(paramHeaders);
    }
    for (Interceptor<? extends org.apache.cxf.message.Message> interceptorInstance
        : soapMessage.getInterceptorChain()) {
        if (interceptorInstance instanceof SoapInterceptor) {
            SoapInterceptor si = (SoapInterceptor) interceptorInstance;
            Set<URI> roles = si.getRoles();
            if (roles != null) {
                serviceRoles.addAll(roles);
            }
            Set<QName> understoodHeaders = si.getUnderstoodHeaders();
            if (understoodHeaders != null) {
                mustUnderstandQNames.addAll(understoodHeaders);
            }
        }
    }
}
 
Example 10
Source Project: cxf   Source File: WSAFeatureXmlTest.java    License: Apache License 2.0 6 votes vote down vote up
private void checkAddressInterceptors(List<Interceptor<? extends Message>> interceptors) {
    boolean hasAg = false;
    boolean hasCodec = false;
    Object cache = null;

    for (Interceptor<? extends Message> i : interceptors) {
        if (i instanceof MAPAggregator) {
            hasAg = true;
            cache = ((MAPAggregator) i).getMessageIdCache();
        } else if (i instanceof MAPCodec) {
            hasCodec = true;
        }
    }

    assertTrue(cache instanceof TestCache);
    assertTrue(hasAg);
    assertTrue(hasCodec);
}
 
Example 11
Source Project: cxf   Source File: ClientImpl.java    License: Apache License 2.0 6 votes vote down vote up
protected void modifyChain(InterceptorChain chain, Message ctx, boolean in) {
    if (ctx == null) {
        return;
    }
    Collection<InterceptorProvider> providers
        = CastUtils.cast((Collection<?>)ctx.get(Message.INTERCEPTOR_PROVIDERS));
    if (providers != null) {
        for (InterceptorProvider p : providers) {
            if (in) {
                chain.add(p.getInInterceptors());
            } else {
                chain.add(p.getOutInterceptors());
            }
        }
    }
    String key = in ? Message.IN_INTERCEPTORS : Message.OUT_INTERCEPTORS;
    Collection<Interceptor<? extends Message>> is
        = CastUtils.cast((Collection<?>)ctx.get(key));
    if (is != null) {
        chain.add(is);
    }
}
 
Example 12
Source Project: cxf   Source File: EndpointPolicyImpl.java    License: Apache License 2.0 6 votes vote down vote up
void initializeInterceptors(PolicyInterceptorProviderRegistry reg,
                            Set<Interceptor<? extends Message>> out, Assertion a,
                            boolean fault, Message msg) {
    QName qn = a.getName();
    List<Interceptor<? extends org.apache.cxf.message.Message>> i
        = fault ? reg.getInFaultInterceptorsForAssertion(qn)
        : reg.getInInterceptorsForAssertion(qn);
    out.addAll(i);
    if (a instanceof PolicyContainingAssertion) {
        Policy p = ((PolicyContainingAssertion)a).getPolicy();
        if (p != null) {
            for (Assertion a2 : getSupportedAlternatives(p, msg)) {
                initializeInterceptors(reg, out, a2, fault, msg);
            }
        }
    }
}
 
Example 13
Source Project: cxf   Source File: PhaseChainCache.java    License: Apache License 2.0 6 votes vote down vote up
@SafeVarargs
static PhaseInterceptorChain getChain(AtomicReference<ChainHolder> lastData,
                                      SortedSet<Phase> phaseList,
                                     List<Interceptor<? extends Message>> ... providers) {
    ChainHolder last = lastData.get();

    if (last == null
        || !last.matches(providers)) {

        PhaseInterceptorChain chain = new PhaseInterceptorChain(phaseList);
        List<ModCountCopyOnWriteArrayList<Interceptor<? extends Message>>> copy
            = new ArrayList<ModCountCopyOnWriteArrayList<
                Interceptor<? extends Message>>>(providers.length);
        for (List<Interceptor<? extends Message>> p : providers) {
            copy.add(new ModCountCopyOnWriteArrayList<Interceptor<? extends Message>>(p));
            chain.add(p);
        }
        last = new ChainHolder(chain, copy);
        lastData.set(last);
    }


    return last.chain.cloneChain();
}
 
Example 14
Source Project: cxf   Source File: JAXRSLocalTransportTest.java    License: Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setResourceClasses(BookStore.class, BookStoreSpring.class);
    sf.setResourceProvider(BookStore.class,
                           new SingletonResourceProvider(new BookStore(), true));
    sf.setResourceProvider(BookStoreSpring.class,
                           new SingletonResourceProvider(new BookStoreSpring(), true));
    sf.setProvider(new JacksonJsonProvider());
    List<Interceptor<? extends Message>> outInts = new ArrayList<>();
    outInts.add(new CustomOutInterceptor());
    sf.setOutInterceptors(outInts);

    List<Interceptor<? extends Message>> inInts = new ArrayList<>();
    inInts.add(new CustomInFaultyInterceptor());
    sf.setInInterceptors(inInts);

    sf.setTransportId(LocalTransportFactory.TRANSPORT_ID);
    sf.setAddress("local://books");
    localServer = sf.create();
}
 
Example 15
Source Project: cxf   Source File: AnnotationInterceptorTest.java    License: Apache License 2.0 5 votes vote down vote up
private boolean hasAnnotationFeatureInterceptor(List<Interceptor<? extends Message>> interceptors) {
    boolean flag = false;
    for (Interceptor<? extends Message> it : interceptors) {
        if (it instanceof AnnotationFeatureInterceptor) {
            flag = true;
        }
    }
    return flag;
}
 
Example 16
Source Project: cxf   Source File: EffectivePolicyImpl.java    License: Apache License 2.0 5 votes vote down vote up
void initialiseInterceptors(PolicyInterceptorProviderRegistry reg, PolicyEngine engine,
                            Set<Interceptor<? extends org.apache.cxf.message.Message>> out, Assertion a,
                            boolean useIn, boolean fault,
                            Message m) {
    QName qn = a.getName();

    List<Interceptor<? extends org.apache.cxf.message.Message>> i = null;
    if (useIn && !fault) {
        i = reg.getInInterceptorsForAssertion(qn);
    } else if (!useIn && !fault) {
        i = reg.getOutInterceptorsForAssertion(qn);
    } else if (useIn && fault) {
        i = reg.getInFaultInterceptorsForAssertion(qn);
    } else if (!useIn && fault) {
        i = reg.getOutFaultInterceptorsForAssertion(qn);
    }
    out.addAll(i);

    if (a instanceof PolicyContainingAssertion) {
        Policy p = ((PolicyContainingAssertion)a).getPolicy();
        if (p != null) {
            for (Assertion a2 : getSupportedAlternatives(engine, p, m)) {
                initialiseInterceptors(reg, engine, out, a2, useIn, fault, m);
            }
        }
    }
}
 
Example 17
Source Project: cxf   Source File: ColocUtil.java    License: Apache License 2.0 5 votes vote down vote up
public static InterceptorChain getOutInterceptorChain(Exchange ex, SortedSet<Phase> phases) {
    Bus bus = ex.getBus();
    PhaseInterceptorChain chain = new PhaseInterceptorChain(phases);

    Endpoint ep = ex.getEndpoint();
    List<Interceptor<? extends Message>> il = ep.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by endpoint: " + il);
    }
    chain.add(il);
    il = ep.getService().getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by service: " + il);
    }
    chain.add(il);
    il = bus.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by bus: " + il);
    }
    chain.add(il);

    if (ep.getService().getDataBinding() instanceof InterceptorProvider) {
        il = ((InterceptorProvider)ep.getService().getDataBinding()).getOutInterceptors();
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Interceptors contributed by databinding: " + il);
        }
        chain.add(il);
    }
    modifyChain(chain, ex, false);

    return chain;
}
 
Example 18
Source Project: cxf   Source File: BusDefinitionParser.java    License: Apache License 2.0 5 votes vote down vote up
public void setInFaultInterceptors(List<Interceptor<? extends Message>> interceptors) {
    if (bus != null) {
        bus.getInFaultInterceptors().addAll(interceptors);
    } else {
        super.setInFaultInterceptors(interceptors);
    }
}
 
Example 19
Source Project: cxf   Source File: EffectivePolicyImplTest.java    License: Apache License 2.0 5 votes vote down vote up
private List<Interceptor<? extends Message>> createMockInterceptorList() {
    Interceptor<? extends Message> i = control.createMock(Interceptor.class);
    Interceptor<? extends Message> m = i;
    List<Interceptor<? extends Message>> a = new ArrayList<>();
    a.add(m);
    return a;
}
 
Example 20
Source Project: cxf   Source File: PolicyInterceptorProviderRegistryImpl.java    License: Apache License 2.0 5 votes vote down vote up
public List<Interceptor<? extends Message>>
getInterceptorsForAlternative(Collection<? extends Assertion> alternative,
                              boolean out, boolean fault) {

    List<Interceptor<? extends Message>> interceptors = new ArrayList<>();
    for (Assertion a : alternative) {
        if (a.isOptional()) {
            continue;
        }
        QName qn = a.getName();
        interceptors.addAll(getInterceptorsForAssertion(qn, out, fault));
    }
    return interceptors;
}
 
Example 21
Source Project: cxf   Source File: EndpointPolicyImplTest.java    License: Apache License 2.0 5 votes vote down vote up
private List<Interceptor<? extends Message>> createMockInterceptorList() {
    Interceptor<? extends Message> i = control.createMock(Interceptor.class);
    Interceptor<? extends Message> m = i;
    List<Interceptor<? extends Message>> a = new ArrayList<>();
    a.add(m);
    return a;
}
 
Example 22
Source Project: cxf   Source File: AbstractClient.java    License: Apache License 2.0 5 votes vote down vote up
protected static PhaseInterceptorChain setupOutInterceptorChain(ClientConfiguration cfg) {
    PhaseManager pm = cfg.getBus().getExtension(PhaseManager.class);
    List<Interceptor<? extends Message>> i1 = cfg.getBus().getOutInterceptors();
    List<Interceptor<? extends Message>> i2 = cfg.getOutInterceptors();
    List<Interceptor<? extends Message>> i3 = cfg.getConduitSelector().getEndpoint().getOutInterceptors();
    PhaseInterceptorChain chain = new PhaseChainCache().get(pm.getOutPhases(), i1, i2, i3);
    chain.add(new ClientRequestFilterInterceptor());
    return chain;
}
 
Example 23
Source Project: cxf   Source File: XMLBindingFactoryTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testContainsInAttachmentInterceptor() {
    XMLBindingFactory xbf = new XMLBindingFactory();
    Binding b = xbf.createBinding(new BindingInfo(null, null));

    boolean found = false;
    for (Interceptor<? extends Message> interseptor : b.getInInterceptors()) {
        if (interseptor instanceof AttachmentInInterceptor) {
            found = true;
        }
    }

    assertTrue("No in attachment interceptor found", found);
}
 
Example 24
Source Project: cxf   Source File: PhaseChainCache.java    License: Apache License 2.0 5 votes vote down vote up
public PhaseInterceptorChain get(SortedSet<Phase> phaseList,
                                 List<Interceptor<? extends Message>> p1,
                                 List<Interceptor<? extends Message>> p2,
                                 List<Interceptor<? extends Message>> p3,
                                 List<Interceptor<? extends Message>> p4) {
    return getChain(lastData, phaseList, p1, p2, p3, p4);
}
 
Example 25
Source Project: cxf   Source File: PhaseChainCache.java    License: Apache License 2.0 5 votes vote down vote up
public PhaseInterceptorChain get(SortedSet<Phase> phaseList,
                                 List<Interceptor<? extends Message>> p1,
                                 List<Interceptor<? extends Message>> p2,
                                 List<Interceptor<? extends Message>> p3,
                                 List<Interceptor<? extends Message>> p4,
                                 List<Interceptor<? extends Message>> p5) {
    return getChain(lastData, phaseList, p1, p2, p3, p4, p5);
}
 
Example 26
Source Project: cxf   Source File: ConfiguredEndpointTest.java    License: Apache License 2.0 5 votes vote down vote up
private TestInterceptor findTestInterceptor(List<Interceptor<? extends Message>> interceptors) {
    for (Interceptor<? extends Message> i : interceptors) {
        if (i instanceof TestInterceptor) {
            return (TestInterceptor)i;
        }
    }
    return null;
}
 
Example 27
Source Project: cxf   Source File: PolicyEngineTest.java    License: Apache License 2.0 5 votes vote down vote up
private Set<String> getInterceptorIds(List<Interceptor<? extends Message>> interceptors) {
    Set<String> ids = new HashSet<>();
    for (Interceptor<? extends Message> i : interceptors) {
        ids.add(((PhaseInterceptor<? extends Message>)i).getId());
    }
    return ids;
}
 
Example 28
Source Project: steady   Source File: WSS4JInOutTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testOrder() throws Exception {
    //make sure the interceptors get ordered correctly
    SortedSet<Phase> phases = new TreeSet<Phase>();
    phases.add(new Phase(Phase.PRE_PROTOCOL, 1));
    
    List<Interceptor<? extends Message>> lst = new ArrayList<Interceptor<? extends Message>>();
    lst.add(new MustUnderstandInterceptor());
    lst.add(new WSS4JInInterceptor());
    lst.add(new SAAJInInterceptor());
    PhaseInterceptorChain chain = new PhaseInterceptorChain(phases);
    chain.add(lst);
    String output = chain.toString();
    assertTrue(output.contains("MustUnderstandInterceptor, SAAJInInterceptor, WSS4JInInterceptor"));
}
 
Example 29
Source Project: dropwizard-jaxws   Source File: ClientBuilderTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void buildClient() {

    Handler<?> handler = mock(Handler.class);

    Interceptor<?> inInterceptor = mock(Interceptor.class);
    Interceptor<?> inFaultInterceptor = mock(Interceptor.class);
    Interceptor<?> outInterceptor = mock(Interceptor.class);
    Interceptor<?> outFaultInterceptor = mock(Interceptor.class);

    ClientBuilder<Object> builder = new ClientBuilder<>(Object.class, "address")
            .connectTimeout(1234)
            .receiveTimeout(5678)
            .handlers(handler, handler)
            .bindingId("binding id")
            .cxfInInterceptors(inInterceptor, inInterceptor)
            .cxfInFaultInterceptors(inFaultInterceptor, inFaultInterceptor)
            .cxfOutInterceptors(outInterceptor, outInterceptor)
            .cxfOutFaultInterceptors(outFaultInterceptor, outFaultInterceptor);

    assertThat(builder.getAddress(), equalTo("address"));
    assertThat(builder.getServiceClass(), equalTo(Object.class));
    assertThat(builder.getConnectTimeout(), equalTo(1234));
    assertThat(builder.getReceiveTimeout(), equalTo(5678));
    assertThat(builder.getBindingId(), equalTo("binding id"));
    assertThat(builder.getCxfInInterceptors(), contains(new Interceptor<?>[]{ inInterceptor, inInterceptor }));
    assertThat(builder.getCxfInFaultInterceptors(), contains(new Interceptor<?>[]{ inFaultInterceptor, inFaultInterceptor }));
    assertThat(builder.getCxfOutInterceptors(), contains(new Interceptor<?>[]{ outInterceptor, outInterceptor }));
    assertThat(builder.getCxfOutFaultInterceptors(), contains(new Interceptor<?>[]{ outFaultInterceptor, outFaultInterceptor }));
}
 
Example 30
Source Project: cxf   Source File: CorbaBindingTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testCorbaBinding() {
    CorbaBinding binding = new CorbaBinding();
    List<Interceptor<? extends Message>> in = binding.getInInterceptors();
    assertNotNull(in);
    List<Interceptor<? extends Message>> out = binding.getOutInterceptors();
    assertNotNull(out);
    List<Interceptor<? extends Message>> infault = binding.getInFaultInterceptors();
    assertNotNull(infault);
    List<Interceptor<? extends Message>> outfault = binding.getFaultOutInterceptors();
    assertNotNull(outfault);
    Message message = binding.createMessage();
    message.put(ORB.class, orb);
    assertNotNull(message);
    ORB corbaORB = message.get(ORB.class);
    assertNotNull(corbaORB);
    MessageImpl mesage = new MessageImpl();
    mesage.put(ORB.class, orb);
    Message msg = binding.createMessage(mesage);
    assertNotNull(msg);
    ORB corbaOrb = msg.get(ORB.class);
    assertNotNull(corbaOrb);
    /*List<Interceptor> infault = binding.getInFaultInterceptors();
    assertEquals(1, infault.size());
    List<Interceptor> outfault = binding.getOutFaultInterceptors();
    assertEquals(1, fault.size());*/
}