use of org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory in project jbossws-cxf by jbossws.
the class Helper method verifyCXF.
public static void verifyCXF() {
// check BusFactory customization; this is required by the JBWS-CXF Configurer integration (HTTPConduit customization, JAXBIntros, ...)
BusFactory factory = BusFactory.newInstance();
if (!(factory instanceof JBossWSBusFactory))
throw new RuntimeException("Expected " + JBossWSBusFactory.class + " but got " + (factory == null ? null : factory.getClass()));
// check the Apache CXF JAXWS implementation is actually used
Object obj = getImplementationObject();
if (!obj.getClass().getName().contains("cxf"))
throw new RuntimeException("JAXWS implementation is not properly selected or endorsed!");
}
use of org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory in project jbossws-cxf by jbossws.
the class Helper method testJBossWSCXFBus.
/**
* Verify the BusFactory.newInstance() still return the JBossWS-CXF version of BusFactory
* (the web app has a dependency on jbossws-cxf-client) and that still create a plain bus
* version, without being fooled by the Spring availability in the TCCL when Spring is not
* installed in the AS.
*
* @return
*/
public boolean testJBossWSCXFBus() {
BusFactory factory = BusFactory.newInstance();
if (!(factory instanceof JBossWSBusFactory)) {
throw new RuntimeException("Expected JBossWSBusFactory");
}
Bus bus = null;
try {
// set Configurer.USER_CFG_FILE_PROPERTY_NAME so that if the SpringBusFactory is
// internally erroneously used, that won't fallback delegating to the non Spring
// one, which would shade the issue
final String prop = System.getProperty(Configurer.USER_CFG_FILE_PROPERTY_NAME);
try {
System.setProperty(Configurer.USER_CFG_FILE_PROPERTY_NAME, "unexistentfile.xml");
bus = factory.createBus();
// the created bus should not be a SpringBus, as the classloader for CXF has no visibility over the deployment spring jars
return !isSpringBus(bus);
} finally {
if (prop == null) {
System.clearProperty(Configurer.USER_CFG_FILE_PROPERTY_NAME);
} else {
System.setProperty(Configurer.USER_CFG_FILE_PROPERTY_NAME, prop);
}
}
} finally {
if (bus != null) {
bus.shutdown(true);
}
}
}
use of org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory in project jbossws-cxf by jbossws.
the class Helper method verifyCXF.
public static void verifyCXF() {
// check BusFactory customization; this is required by the JBWS-CXF Configurer integration (HTTPConduit customization, JAXBIntros, ...)
BusFactory factory = BusFactory.newInstance();
if (!(factory instanceof JBossWSBusFactory))
throw new RuntimeException("Expected " + JBossWSBusFactory.class + " but got " + (factory == null ? null : factory.getClass()));
// check the Apache CXF JAXWS implementation is actually used
Object obj = getImplementationObject();
if (!obj.getClass().getName().contains("cxf"))
throw new RuntimeException("JAXWS implementation is not properly selected or endorsed!");
}
Aggregations