Search in sources :

Example 16 with AegisDatabinding

use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.

the class AegisClientServerTest method testReturnQualifiedPair.

@Test
public void testReturnQualifiedPair() 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();
    Pair<Integer, String> ret = service.getReturnQualifiedPair(111, "ffang");
    assertEquals(new Integer(111), ret.getFirst());
    assertEquals("ffang", ret.getSecond());
}
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 AegisDatabinding

use of org.apache.cxf.aegis.databinding.AegisDatabinding 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 18 with AegisDatabinding

use of org.apache.cxf.aegis.databinding.AegisDatabinding 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 19 with AegisDatabinding

use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.

the class AegisClientServerTest method testJaxWsAegisClient.

@Test
public void testJaxWsAegisClient() throws Exception {
    AegisDatabinding aegisBinding = new AegisDatabinding();
    JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
    proxyFactory.setDataBinding(aegisBinding);
    proxyFactory.setServiceClass(AuthService.class);
    proxyFactory.setAddress("http://localhost:" + PORT + "/jaxwsAndAegis");
    AuthService service = (AuthService) proxyFactory.create();
    assertTrue(service.authenticate("Joe", "Joe", "123"));
    assertFalse(service.authenticate("Joe1", "Joe", "fang"));
    assertTrue(service.authenticate("Joe", null, "123"));
    List<String> list = service.getRoles("Joe");
    assertEquals(3, list.size());
    assertEquals("Joe", list.get(0));
    assertEquals("Joe-1", list.get(1));
    assertEquals("Joe-2", list.get(2));
    String[] roles = service.getRolesAsArray("Joe");
    assertEquals(2, roles.length);
    assertEquals("Joe", roles[0]);
    assertEquals("Joe-1", roles[1]);
    roles = service.getRolesAsArray("null");
    assertNull(roles);
    roles = service.getRolesAsArray("0");
    assertEquals(0, roles.length);
    assertEquals("get Joe", service.getAuthentication("Joe"));
    Authenticate au = new Authenticate();
    au.setSid("ffang");
    au.setUid("ffang");
    assertTrue(service.authenticate(au));
    au.setUid("ffang1");
    assertFalse(service.authenticate(au));
}
Also used : Authenticate(org.apache.cxf.authservice.Authenticate) AuthService(org.apache.cxf.authservice.AuthService) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) Test(org.junit.Test)

Example 20 with AegisDatabinding

use of org.apache.cxf.aegis.databinding.AegisDatabinding 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)

Aggregations

AegisDatabinding (org.apache.cxf.aegis.databinding.AegisDatabinding)37 Test (org.junit.Test)21 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)14 ClientProxyFactoryBean (org.apache.cxf.frontend.ClientProxyFactoryBean)12 AbstractAegisTest (org.apache.cxf.aegis.AbstractAegisTest)10 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)7 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)7 Before (org.junit.Before)7 ServerFactoryBean (org.apache.cxf.frontend.ServerFactoryBean)6 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)5 AegisContext (org.apache.cxf.aegis.AegisContext)4 Server (org.apache.cxf.endpoint.Server)4 BeanInvoker (org.apache.cxf.service.invoker.BeanInvoker)4 HashSet (java.util.HashSet)3 ReflectionServiceFactoryBean (org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean)3 QName (javax.xml.namespace.QName)2 XFireCompatibilityServiceConfiguration (org.apache.cxf.aegis.databinding.XFireCompatibilityServiceConfiguration)2 AuthService (org.apache.cxf.authservice.AuthService)2 Authenticate (org.apache.cxf.authservice.Authenticate)2 Service (org.apache.cxf.service.Service)2