Search in sources :

Example 16 with LoggingOutInterceptor

use of org.apache.cxf.ext.logging.LoggingOutInterceptor in project cxf by apache.

the class AegisClientServerTest method testReturnGenericPair.

@Test
public void testReturnGenericPair() throws Exception {
    AegisDatabinding aegisBinding = new AegisDatabinding();
    JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
    proxyFactory.setDataBinding(aegisBinding);
    proxyFactory.setServiceClass(SportsService.class);
    proxyFactory.setAddress("http://localhost:" + PORT + "/jaxwsAndAegisSports");
    proxyFactory.getInInterceptors().add(new LoggingInInterceptor());
    proxyFactory.getOutInterceptors().add(new LoggingOutInterceptor());
    SportsService service = (SportsService) proxyFactory.create();
    int ret = service.getGenericPair(new Pair<Integer, String>(111, "String"));
    assertEquals(111, ret);
}
Also used : LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) Test(org.junit.Test)

Example 17 with LoggingOutInterceptor

use of org.apache.cxf.ext.logging.LoggingOutInterceptor in project cxf by apache.

the class AegisClientServerTest method testGenericCollection.

@Test
public void testGenericCollection() throws Exception {
    AegisDatabinding aegisBinding = new AegisDatabinding();
    JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
    proxyFactory.setDataBinding(aegisBinding);
    proxyFactory.setServiceClass(SportsService.class);
    proxyFactory.setAddress("http://localhost:" + PORT + "/jaxwsAndAegisSports");
    proxyFactory.getInInterceptors().add(new LoggingInInterceptor());
    proxyFactory.getOutInterceptors().add(new LoggingOutInterceptor());
    SportsService service = (SportsService) proxyFactory.create();
    List<String> list = new ArrayList<>();
    list.add("ffang");
    String ret = service.getGeneric(list);
    assertEquals(ret, "ffang");
}
Also used : LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) ArrayList(java.util.ArrayList) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) Test(org.junit.Test)

Example 18 with LoggingOutInterceptor

use of org.apache.cxf.ext.logging.LoggingOutInterceptor in project cxf by apache.

the class AegisClientServerTest method testCollection.

@Test
public void testCollection() throws Exception {
    AegisDatabinding aegisBinding = new AegisDatabinding();
    JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
    proxyFactory.setDataBinding(aegisBinding);
    proxyFactory.setServiceClass(SportsService.class);
    proxyFactory.setWsdlLocation("http://localhost:" + PORT + "/jaxwsAndAegisSports?wsdl");
    proxyFactory.getInInterceptors().add(new LoggingInInterceptor());
    proxyFactory.getOutInterceptors().add(new LoggingOutInterceptor());
    SportsService service = (SportsService) proxyFactory.create();
    Collection<Team> teams = service.getTeams();
    assertEquals(1, teams.size());
    assertEquals("Patriots", teams.iterator().next().getName());
    // CXF-1251
    String s = service.testForMinOccurs0("A", null, "b");
    assertEquals("Anullb", s);
}
Also used : LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) Test(org.junit.Test)

Example 19 with LoggingOutInterceptor

use of org.apache.cxf.ext.logging.LoggingOutInterceptor in project cxf by apache.

the class MultipleServiceShareClassTest method createGetterService.

private <T extends Getter> T createGetterService(final Class<T> serviceClass) {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setAddress("http://localhost:" + PORT + "/" + serviceClass.getSimpleName());
    factory.getInInterceptors().add(new LoggingInInterceptor());
    factory.getOutInterceptors().add(new LoggingOutInterceptor());
    return factory.create(serviceClass);
}
Also used : LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor)

Example 20 with LoggingOutInterceptor

use of org.apache.cxf.ext.logging.LoggingOutInterceptor in project cxf by apache.

the class SpringBeansTest method testInterceptors.

private void testInterceptors(ClassPathXmlApplicationContext ctx) {
    EndpointImpl ep;
    ep = (EndpointImpl) ctx.getBean("epWithInterceptors");
    assertNotNull(ep);
    List<Interceptor<? extends Message>> inInterceptors = ep.getInInterceptors();
    boolean saaj = false;
    boolean logging = false;
    for (Interceptor<? extends Message> i : inInterceptors) {
        if (i instanceof SAAJInInterceptor) {
            saaj = true;
        } else if (i instanceof LoggingInInterceptor) {
            logging = true;
        }
    }
    assertTrue(saaj);
    assertTrue(logging);
    saaj = false;
    logging = false;
    for (Interceptor<?> i : ep.getOutInterceptors()) {
        if (i instanceof SAAJOutInterceptor) {
            saaj = true;
        } else if (i instanceof LoggingOutInterceptor) {
            logging = true;
        }
    }
    assertTrue(saaj);
}
Also used : SAAJInInterceptor(org.apache.cxf.binding.soap.saaj.SAAJInInterceptor) SAAJOutInterceptor(org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor) Message(org.apache.cxf.message.Message) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) SAAJOutInterceptor(org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor) SAAJInInterceptor(org.apache.cxf.binding.soap.saaj.SAAJInInterceptor) Interceptor(org.apache.cxf.interceptor.Interceptor) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor)

Aggregations

LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)224 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)207 Test (org.junit.Test)175 Service (org.apache.cxf.service.Service)138 Client (org.apache.cxf.endpoint.Client)135 HashMap (java.util.HashMap)101 WSSSecurityProperties (org.apache.wss4j.stax.ext.WSSSecurityProperties)89 ArrayList (java.util.ArrayList)68 Properties (java.util.Properties)65 WSSConstants (org.apache.wss4j.stax.ext.WSSConstants)61 QName (javax.xml.namespace.QName)35 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)22 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)21 AbstractSecurityTest (org.apache.cxf.ws.security.wss4j.AbstractSecurityTest)18 Echo (org.apache.cxf.ws.security.wss4j.Echo)18 Bus (org.apache.cxf.Bus)16 URL (java.net.URL)15 Server (org.apache.cxf.endpoint.Server)14 Greeter (org.apache.cxf.greeter_control.Greeter)14 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)13