use of org.apache.cxf.binding.BindingFactoryManager in project cxf by apache.
the class SpringBusFactoryTest method testDefault.
@Test
public void testDefault() {
Bus bus = new SpringBusFactory().createBus();
assertNotNull(bus);
BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);
assertNotNull("No binding factory manager", bfm);
assertNotNull("No configurer", bus.getExtension(Configurer.class));
assertNotNull("No resource manager", bus.getExtension(ResourceManager.class));
assertNotNull("No destination factory manager", bus.getExtension(DestinationFactoryManager.class));
assertNotNull("No conduit initiator manager", bus.getExtension(ConduitInitiatorManager.class));
assertNotNull("No phase manager", bus.getExtension(PhaseManager.class));
assertNotNull("No workqueue manager", bus.getExtension(WorkQueueManager.class));
assertNotNull("No lifecycle manager", bus.getExtension(BusLifeCycleManager.class));
assertNotNull("No service registry", bus.getExtension(ServerRegistry.class));
try {
bfm.getBindingFactory("http://cxf.apache.org/unknown");
} catch (BusException ex) {
// expected
}
assertEquals("Unexpected interceptors", 0, bus.getInInterceptors().size());
assertEquals("Unexpected interceptors", 0, bus.getInFaultInterceptors().size());
assertEquals("Unexpected interceptors", 0, bus.getOutInterceptors().size());
assertEquals("Unexpected interceptors", 0, bus.getOutFaultInterceptors().size());
}
use of org.apache.cxf.binding.BindingFactoryManager in project cxf by apache.
the class AbstractWSDLBasedEndpointFactory method createBindingInfo.
protected BindingInfo createBindingInfo() {
BindingFactoryManager mgr = bus.getExtension(BindingFactoryManager.class);
String binding = bindingId;
if (binding == null && bindingConfig != null) {
binding = bindingConfig.getBindingId();
}
if (binding == null) {
// default to soap binding
binding = "http://schemas.xmlsoap.org/soap/";
}
try {
if (binding.contains("/soap")) {
if (bindingConfig == null) {
bindingConfig = createSoapBindingConfig();
}
if (bindingConfig instanceof SoapBindingConfiguration && !((SoapBindingConfiguration) bindingConfig).isSetStyle()) {
((SoapBindingConfiguration) bindingConfig).setStyle(serviceFactory.getStyle());
}
}
bindingFactory = mgr.getBindingFactory(binding);
BindingInfo inf = bindingFactory.createBindingInfo(serviceFactory.getService(), binding, bindingConfig);
for (BindingOperationInfo boi : inf.getOperations()) {
serviceFactory.updateBindingOperation(boi);
Method m = serviceFactory.getMethodDispatcher().getMethod(boi);
serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_OPERATION_CREATED, inf, boi, m);
}
serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_CREATED, inf);
return inf;
} catch (BusException ex) {
throw new ServiceConstructionException(new Message("COULD.NOT.RESOLVE.BINDING", LOG, bindingId), ex);
}
}
use of org.apache.cxf.binding.BindingFactoryManager in project cxf by apache.
the class ReflectionServiceFactoryBean method createEndpoints.
protected void createEndpoints() {
Service service = getService();
BindingFactoryManager bfm = getBus().getExtension(BindingFactoryManager.class);
for (ServiceInfo inf : service.getServiceInfos()) {
for (EndpointInfo ei : inf.getEndpoints()) {
for (BindingOperationInfo boi : ei.getBinding().getOperations()) {
updateBindingOperation(boi);
}
try {
bfm.getBindingFactory(ei.getBinding().getBindingId());
} catch (BusException e1) {
continue;
}
try {
Endpoint ep = createEndpoint(ei);
service.getEndpoints().put(ei.getName(), ep);
} catch (EndpointException e) {
throw new ServiceConstructionException(e);
}
}
}
}
use of org.apache.cxf.binding.BindingFactoryManager in project cxf by apache.
the class SpringBusFactoryTest method checkBindingExtensions.
private void checkBindingExtensions(Bus bus) throws BusException {
BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);
assertNotNull("No binding factory manager", bfm);
assertNotNull("binding factory not available", bfm.getBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/"));
try {
bfm.getBindingFactory("http://cxf.apache.org/unknown");
} catch (BusException ex) {
// expected
}
}
use of org.apache.cxf.binding.BindingFactoryManager in project cxf by apache.
the class CorbaBindingFactoryConfigurerTest method testOrbConfiguration.
@Test
public void testOrbConfiguration() throws Exception {
SpringBusFactory bf = new SpringBusFactory();
URL cxfConfig = null;
cxfConfig = ClassLoaderUtils.getResource("corba_binding_factory_configurer.xml", this.getClass());
bus = bf.createBus(cxfConfig);
BusFactory.setDefaultBus(bus);
BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);
CorbaBindingFactory factory = (CorbaBindingFactory) bfm.getBindingFactory("http://cxf.apache.org/bindings/corba");
OrbConfig orbConfig = factory.getOrbConfig();
assertNotNull("CorbaBindingFactoryConfigurer is null", orbConfig);
Properties props = orbConfig.getOrbProperties();
assertNotNull("probs is null", props);
assertTrue("prob1 is not equal to value1", "value1".equals(props.get("prop1")));
assertTrue("prob2 is not equal to value2", "value2".equals(props.get("prop2")));
assertTrue("ORBClass is not equal to MyORBImpl", "com.orbimplco.MyORBImpl".equals(props.get("org.omg.CORBA.ORBClass")));
assertTrue("ORBSingletonClass is not equal to MyORBSingleton", "com.orbimplco.MyORBSingleton".equals(props.get("org.omg.CORBA.ORBSingletonClass")));
List<String> orbArgs = orbConfig.getOrbArgs();
assertNotNull("orbArgs is null", orbArgs);
String domainNameId = orbArgs.get(0);
assertTrue("domainNameId is not equal to -ORBdomain_name", "-ORBdomain_name".equals(domainNameId));
String domainNameValue = orbArgs.get(1);
assertTrue("domainNameValue is not equal to test-domain", "test-domain".equals(domainNameValue));
String configDomainsDirId = orbArgs.get(2);
assertTrue("configDomainsDirId is not equal to -ORBconfig_domains_dir", "-ORBconfig_domains_dir".equals(configDomainsDirId));
String configDomainsDirValue = orbArgs.get(3);
assertTrue("configDomainsDirValue is not equal to src/test/resources", "src/test/resources".equals(configDomainsDirValue));
String orbNameId = orbArgs.get(4);
assertTrue("orbNameId is not equal to -ORBname", "-ORBname".equals(orbNameId));
String orbNameValue = orbArgs.get(5);
assertTrue("orbNameValue is not equal to test", "test".equals(orbNameValue));
}
Aggregations