use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.
the class ClientServiceConfigTest method talkToJaxWsHolder.
@Test
public void talkToJaxWsHolder() throws Exception {
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setDataBinding(new AegisDatabinding());
factory.setAddress("local://JaxWsEcho");
Echo client = factory.create(Echo.class);
Holder<String> sholder = new Holder<String>();
client.echo("Channa Doll", sholder);
assertEquals("Channa Doll", sholder.value);
}
use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.
the class ExceptionTest method testJaxwsServerSimpleClient.
@Test(expected = HelloException.class)
public void testJaxwsServerSimpleClient() throws Exception {
JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean();
sfbean.setServiceClass(ExceptionService.class);
sfbean.setDataBinding(new AegisDatabinding());
sfbean.setAddress("local://ExceptionServiceJaxWs1");
Server server = sfbean.create();
Service service = server.getEndpoint().getService();
service.setInvoker(new BeanInvoker(new ExceptionServiceImpl()));
ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
proxyFac.setAddress("local://ExceptionServiceJaxWs1");
proxyFac.setBus(getBus());
setupAegis(proxyFac.getClientFactoryBean());
ExceptionService clientInterface = proxyFac.create(ExceptionService.class);
clientInterface.sayHiWithException();
}
use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.
the class ExplicitPrefixTest method setupService.
private ServiceAndMapping setupService(Class<?> seiClass, Map<String, String> namespaces) {
AegisDatabinding db = new AegisDatabinding();
db.setNamespaceMap(namespaces);
Server s = createService(seiClass, null, db);
ServiceAndMapping serviceAndMapping = new ServiceAndMapping();
serviceAndMapping.setServer(s);
serviceAndMapping.setService(s.getEndpoint().getService());
serviceAndMapping.setTypeMapping((TypeMapping) serviceAndMapping.getService().get(TypeMapping.class.getName()));
return serviceAndMapping;
}
use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.
the class AegisClientServerTest method testAegisClient.
@Test
public void testAegisClient() throws Exception {
AegisDatabinding aegisBinding = new AegisDatabinding();
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
proxyFactory.setDataBinding(aegisBinding);
proxyFactory.setServiceClass(AuthService.class);
proxyFactory.setAddress("http://localhost:" + PORT + "/service");
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]);
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));
}
use of org.apache.cxf.aegis.databinding.AegisDatabinding in project cxf by apache.
the class AegisClientServerTest method testComplexMapResult.
@Test
public void testComplexMapResult() 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();
Map<String, Map<Integer, Integer>> result = service.testComplexMapResult();
assertEquals(result.size(), 1);
assertTrue(result.containsKey("key1"));
assertNotNull(result.get("key1"));
assertEquals(result.toString(), "{key1={1=3}}");
}
Aggregations