use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.
the class RountripTest method testServerFactoryBean.
@Test
public void testServerFactoryBean() throws Exception {
ServerFactoryBean svrBean = new ServerFactoryBean();
svrBean.setAddress("http://localhost/Hello");
svrBean.setTransportId("http://schemas.xmlsoap.org/soap/http");
svrBean.setServiceBean(new HelloServiceImpl());
svrBean.setServiceClass(HelloService.class);
svrBean.setBus(getBus());
svrBean.create();
ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
clientBean.setAddress("http://localhost/Hello");
clientBean.setTransportId("http://schemas.xmlsoap.org/soap/http");
clientBean.setServiceClass(HelloService.class);
clientBean.setBus(getBus());
HelloService client = (HelloService) proxyFactory.create();
assertEquals("hello", client.sayHello());
assertEquals("hello", client.echo("hello"));
}
use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.
the class ServerFactoryTest method testSetDF.
@Test
public void testSetDF() throws Exception {
ServerFactoryBean svrBean = new ServerFactoryBean();
svrBean.setAddress("http://localhost/Hello");
svrBean.setServiceClass(HelloService.class);
svrBean.setServiceBean(new HelloServiceImpl());
svrBean.setBus(getBus());
svrBean.setDestinationFactory(new CustomDestinationFactory(getBus()));
ServerImpl server = (ServerImpl) svrBean.create();
assertTrue(server.getDestination() instanceof CustomDestination);
}
use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.
the class ServerFactoryTest method testCXF1758.
@Test
public void testCXF1758() throws Exception {
ServerFactoryBean svrBean = new ServerFactoryBean();
svrBean.setAddress("http://localhost/Generics");
svrBean.setServiceBean(new TestServiceImpl<String>() {
});
svrBean.setBus(getBus());
ServerImpl server = (ServerImpl) svrBean.create();
// XMLUtils.printDOM(getWSDLDocument(server));
assertValid("//xsd:schema/xsd:complexType[@name='open']/xsd:sequence/" + "xsd:element[@type='xsd:string']", getWSDLDocument(server));
}
use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.
the class ServerFactoryTest method testJaxbExtraClass.
@Test
public void testJaxbExtraClass() throws Exception {
ServerFactoryBean svrBean = new ServerFactoryBean();
svrBean.setAddress("http://localhost/Hello");
svrBean.setServiceClass(HelloServiceImpl.class);
svrBean.setBus(getBus());
Map<String, Object> props = svrBean.getProperties();
if (props == null) {
props = new HashMap<>();
}
props.put("jaxb.additionalContextClasses", new Class[] { GreetMe.class, GreetMeOneWay.class });
svrBean.setProperties(props);
Server serv = svrBean.create();
Class<?>[] extraClass = ((JAXBDataBinding) serv.getEndpoint().getService().getDataBinding()).getExtraClass();
assertEquals(extraClass.length, 2);
assertEquals(extraClass[0], GreetMe.class);
assertEquals(extraClass[1], GreetMeOneWay.class);
}
use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.
the class QueryHandlerTest method before.
@Before
public void before() {
ServerFactoryBean serverFactoryBean = getBean(ServerFactoryBean.class, "hw-service-endpoint");
hwEndpoint = serverFactoryBean.create().getEndpoint();
serverFactoryBean = getBean(ServerFactoryBean.class, "dlb-service-endpoint");
dlbEndpoint = serverFactoryBean.create().getEndpoint();
}
Aggregations