use of org.apache.cxf.BusFactory in project cxf by apache.
the class JettyDigestAuthTest method testGetWSDL.
@org.junit.Test
public void testGetWSDL() throws Exception {
BusFactory bf = BusFactory.newInstance();
Bus bus = bf.createBus();
bus.getInInterceptors().add(new LoggingInInterceptor());
bus.getOutInterceptors().add(new LoggingOutInterceptor());
MyHTTPConduitConfigurer myHttpConduitConfig = new MyHTTPConduitConfigurer();
bus.setExtension(myHttpConduitConfig, HTTPConduitConfigurer.class);
JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance(bus);
factory.createClient(ADDRESS + "?wsdl");
}
use of org.apache.cxf.BusFactory in project jbossws-cxf by jbossws.
the class AbstractClient method testBusCreation.
public static void testBusCreation() throws BusTestException {
Bus initialDefaultBus = BusFactory.getDefaultBus(false);
Bus initialThreadBus = BusFactory.getThreadDefaultBus(false);
BusFactory factory = BusFactory.newInstance();
Bus bus = factory.createBus();
assert (bus != null);
if (// if the thread bus was not set before, it should now be
initialThreadBus == null) {
checkThreadBus(bus);
}
checkDefaultBus(initialDefaultBus);
BusFactory.setThreadDefaultBus(initialThreadBus);
checkThreadBus(initialThreadBus);
checkDefaultBus(initialDefaultBus);
}
use of org.apache.cxf.BusFactory in project jbossws-cxf by jbossws.
the class AbstractClient method testWebServiceRef.
public static void testWebServiceRef(Endpoint port) throws BusTestException {
Bus initialDefaultBus = BusFactory.getDefaultBus(false);
Bus threadBus = BusFactory.getThreadDefaultBus(false);
// does not change anything to the bus, as the port is already created when injecting serviceref
performInvocation(port);
checkDefaultBus(initialDefaultBus);
checkThreadBus(threadBus);
try {
BusFactory.setThreadDefaultBus(null);
// does not change anything to the bus, as the port is already created when injecting serviceref
performInvocation(port);
checkDefaultBus(initialDefaultBus);
checkThreadBus(null);
BusFactory factory = BusFactory.newInstance();
// internally sets the thread bus
Bus bus = factory.createBus();
// does not change anything to the bus, as the port is already created when injecting serviceref
performInvocation(port);
checkDefaultBus(initialDefaultBus);
checkThreadBus(bus);
} finally {
BusFactory.setThreadDefaultBus(threadBus);
}
}
use of org.apache.cxf.BusFactory 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.apache.cxf.BusFactory 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);
}
}
}
Aggregations