Search in sources :

Example 1 with XMLBindingFactory

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);
}
Also used : Binding(org.apache.cxf.binding.Binding) JAXBDataBinding(org.apache.cxf.jaxb.JAXBDataBinding) Bus(org.apache.cxf.Bus) WSDLServiceFactory(org.apache.cxf.wsdl11.WSDLServiceFactory) DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) QName(javax.xml.namespace.QName) WSDLManagerImpl(org.apache.cxf.wsdl11.WSDLManagerImpl) BindingFactoryManager(org.apache.cxf.binding.BindingFactoryManager) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Endpoint(org.apache.cxf.endpoint.Endpoint) WSDLManager(org.apache.cxf.wsdl.WSDLManager) JAXBDataBinding(org.apache.cxf.jaxb.JAXBDataBinding) XMLBindingFactory(org.apache.cxf.binding.xml.XMLBindingFactory)

Aggregations

QName (javax.xml.namespace.QName)1 Bus (org.apache.cxf.Bus)1 Binding (org.apache.cxf.binding.Binding)1 BindingFactoryManager (org.apache.cxf.binding.BindingFactoryManager)1 XMLBindingFactory (org.apache.cxf.binding.xml.XMLBindingFactory)1 Endpoint (org.apache.cxf.endpoint.Endpoint)1 JAXBDataBinding (org.apache.cxf.jaxb.JAXBDataBinding)1 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)1 DestinationFactoryManager (org.apache.cxf.transport.DestinationFactoryManager)1 WSDLManager (org.apache.cxf.wsdl.WSDLManager)1 WSDLManagerImpl (org.apache.cxf.wsdl11.WSDLManagerImpl)1 WSDLServiceFactory (org.apache.cxf.wsdl11.WSDLServiceFactory)1