use of org.apache.cxf.frontend.ClientProxyFactoryBean in project cxf by apache.
the class ClientServiceConfigTest method ordinaryParamNameTest.
@Test
public void ordinaryParamNameTest() throws Exception {
ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
ReflectionServiceFactoryBean factory = new ReflectionServiceFactoryBean();
proxyFac.setServiceFactory(factory);
proxyFac.setDataBinding(new AegisDatabinding());
proxyFac.setAddress("local://Echo");
proxyFac.setBus(getBus());
Echo echo = proxyFac.create(Echo.class);
String boing = echo.simpleEcho("reflection");
assertEquals("reflection", boing);
}
use of org.apache.cxf.frontend.ClientProxyFactoryBean in project cxf by apache.
the class SpringBeansTest method testClients.
@Test
public void testClients() throws Exception {
AbstractFactoryBeanDefinitionParser.setFactoriesAreAbstract(false);
ctx = new ClassPathXmlApplicationContext(new String[] { "/org/apache/cxf/frontend/spring/clients.xml" });
Object bean = ctx.getBean("client1.proxyFactory");
assertNotNull(bean);
ClientProxyFactoryBean cpfbean = (ClientProxyFactoryBean) bean;
BindingConfiguration bc = cpfbean.getBindingConfig();
assertTrue(bc instanceof SoapBindingConfiguration);
SoapBindingConfiguration sbc = (SoapBindingConfiguration) bc;
assertTrue(sbc.getVersion() instanceof Soap12);
HelloService greeter = (HelloService) ctx.getBean("client1");
assertNotNull(greeter);
Client client = ClientProxy.getClient(greeter);
assertNotNull("expected ConduitSelector", client.getConduitSelector());
assertTrue("unexpected ConduitSelector", client.getConduitSelector() instanceof NullConduitSelector);
List<Interceptor<? extends Message>> inInterceptors = client.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 : client.getOutInterceptors()) {
if (i instanceof SAAJOutInterceptor) {
saaj = true;
} else if (i instanceof LoggingOutInterceptor) {
logging = true;
}
}
assertTrue(saaj);
assertTrue(logging);
ClientProxyFactoryBean clientProxyFactoryBean = (ClientProxyFactoryBean) ctx.getBean("client2.proxyFactory");
assertNotNull(clientProxyFactoryBean);
assertEquals("get the wrong transportId", clientProxyFactoryBean.getTransportId(), "http://cxf.apache.org/transports/local");
assertEquals("get the wrong bindingId", clientProxyFactoryBean.getBindingId(), "http://cxf.apache.org/bindings/xformat");
greeter = (HelloService) ctx.getBean("client2");
assertNotNull(greeter);
greeter = (HelloService) ctx.getBean("client3");
assertNotNull(greeter);
client = ClientProxy.getClient(greeter);
EndpointInfo epi = client.getEndpoint().getEndpointInfo();
AuthorizationPolicy ap = epi.getExtensor(AuthorizationPolicy.class);
assertNotNull("The AuthorizationPolicy instance should not be null", ap);
assertEquals("Get the wrong username", ap.getUserName(), "testUser");
assertEquals("Get the wrong password", ap.getPassword(), "password");
}
use of org.apache.cxf.frontend.ClientProxyFactoryBean in project cxf by apache.
the class FlatArrayTest method testDataMovementBean.
@Test
public void testDataMovementBean() throws Exception {
ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
proxyFac.setDataBinding(new AegisDatabinding());
proxyFac.setAddress("local://FlatArray");
proxyFac.setBus(getBus());
FlatArrayServiceInterface client = proxyFac.create(FlatArrayServiceInterface.class);
BeanWithFlatArray bwfa = new BeanWithFlatArray();
bwfa.setValues(INT_ARRAY);
client.takeBeanWithFlatArray(bwfa);
assertArrayEquals(INT_ARRAY, service.beanWithFlatArrayValue.getValues());
}
use of org.apache.cxf.frontend.ClientProxyFactoryBean in project cxf by apache.
the class FlatArrayTest method testDataMovementPart.
@Test
public void testDataMovementPart() throws Exception {
ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
proxyFac.setDataBinding(new AegisDatabinding());
proxyFac.setAddress("local://FlatArray");
proxyFac.setBus(getBus());
FlatArrayServiceInterface client = proxyFac.create(FlatArrayServiceInterface.class);
client.submitStringArray(STRING_ARRAY);
assertArrayEquals(STRING_ARRAY, service.stringArrayValue);
}
use of org.apache.cxf.frontend.ClientProxyFactoryBean in project cxf by apache.
the class MissingTypeWSDLTest method testMissingTransliteration.
@Test
public void testMissingTransliteration() throws Exception {
Server server = createService(MissingType.class, new MissingTypeImpl(), null);
Service service = server.getEndpoint().getService();
service.setInvoker(new BeanInvoker(new MissingTypeImpl()));
ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
proxyFac.setAddress("local://MissingType");
proxyFac.setBus(getBus());
setupAegis(proxyFac.getClientFactoryBean());
Document wsdl = getWSDLDocument("MissingType");
assertValid("/wsdl:definitions/wsdl:types" + "/xsd:schema[@targetNamespace='urn:org:apache:cxf:aegis:type:missing']" + "/xsd:complexType[@name=\"Inner\"]", wsdl);
}
Aggregations