use of org.apache.cxf.binding.xml.XMLBindingFactory in project cxf by apache.
the class TestBase method common.
protected void common(String wsdl, QName portName, Class<?>... jaxbClasses) throws Exception {
control = EasyMock.createNiceControl();
bus = control.createMock(Bus.class);
WSDLManagerImpl manager = new WSDLManagerImpl();
XMLWSDLExtensionLoader.registerExtensors(manager);
EasyMock.expect(bus.getExtension(WSDLManager.class)).andStubReturn(manager);
BindingFactoryManager bindingFactoryManager = control.createMock(BindingFactoryManager.class);
EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andStubReturn(bindingFactoryManager);
DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)).andStubReturn(dfm);
control.replay();
assertNotNull(bus.getExtension(WSDLManager.class));
WSDLServiceFactory factory = new WSDLServiceFactory(bus, getClass().getResource(wsdl).toString(), new QName(portName.getNamespaceURI(), "XMLService"));
org.apache.cxf.service.Service service = factory.create();
EndpointInfo epi = service.getEndpointInfo(portName);
serviceInfo = epi.getService();
assertNotNull(epi);
Binding xmlBinding = new XMLBindingFactory().createBinding(epi.getBinding());
control.reset();
JAXBDataBinding db = new JAXBDataBinding();
db.initialize(service);
db.setContext(JAXBContext.newInstance(jaxbClasses));
service.setDataBinding(db);
Endpoint endpoint = control.createMock(EndpointImpl.class);
EasyMock.expect(endpoint.getEndpointInfo()).andStubReturn(epi);
EasyMock.expect(endpoint.getBinding()).andStubReturn(xmlBinding);
EasyMock.expect(endpoint.getService()).andStubReturn(service);
EasyMock.expect(endpoint.isEmpty()).andReturn(true).anyTimes();
control.replay();
xmlMessage.getExchange().put(Endpoint.class, endpoint);
xmlMessage.getExchange().put(org.apache.cxf.service.Service.class, service);
}
Aggregations