use of org.apache.cxf.bus.CXFBusFactory in project cxf by apache.
the class ConfiguredEndpointTest method testCXFDefaultServerEndpoint.
@Test
public void testCXFDefaultServerEndpoint() {
factory = new CXFBusFactory();
BusFactory.setDefaultBus(null);
factory.createBus();
System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, CXFBusFactory.class.getName());
initializeBus();
doTestDefaultServerEndpoint();
}
use of org.apache.cxf.bus.CXFBusFactory in project cxf by apache.
the class ConfiguredEndpointTest method testCXFDefaultClientEndpoint.
@Test
public void testCXFDefaultClientEndpoint() {
factory = new CXFBusFactory();
BusFactory.setDefaultBus(null);
factory.createBus();
System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, CXFBusFactory.class.getName());
doTestDefaultClientEndpoint();
}
use of org.apache.cxf.bus.CXFBusFactory in project cxf by apache.
the class Client method main.
public static void main(String[] args) throws Exception {
if (args.length == 0) {
args = new String[] { SOAPService.WSDL_LOCATION.toExternalForm() };
}
URL wsdlURL;
File wsdlFile = new File(args[0]);
if (wsdlFile.exists()) {
wsdlURL = wsdlFile.toURI().toURL();
} else {
wsdlURL = new URL(args[0]);
}
Map<String, Object> properties = new HashMap<>();
properties.put("bus.jmx.usePlatformMBeanServer", Boolean.TRUE);
properties.put("bus.jmx.enabled", Boolean.TRUE);
Bus b = new CXFBusFactory().createBus(null, properties);
MetricRegistry registry = new MetricRegistry();
CodahaleMetricsProvider.setupJMXReporter(b, registry);
b.setExtension(registry, MetricRegistry.class);
SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME);
List<Client> c = new ArrayList<>();
Client client;
client = new Client("Tom", ss);
new Thread(client).start();
c.add(client);
client = new Client("Rob", ss);
new Thread(client).start();
c.add(client);
client = new Client("Vince", ss);
new Thread(client).start();
c.add(client);
client = new Client("Malcolm", ss);
new Thread(client).start();
c.add(client);
client = new Client("Jonas", ss);
new Thread(client).start();
c.add(client);
System.out.println("Sleeping on main thread for 60 seconds");
Thread.sleep(60000);
for (Client c2 : c) {
c2.stop();
}
Thread.sleep(2000);
Thread.sleep(1000000);
// System.exit(0);
}
use of org.apache.cxf.bus.CXFBusFactory in project cxf by apache.
the class ClientServerTest method testBase64.
@Test
public void testBase64() throws Exception {
URL wsdl = getClass().getResource("/wsdl/others/dynamic_client_base64.wsdl");
assertNotNull(wsdl);
String wsdlUrl = null;
wsdlUrl = wsdl.toURI().toString();
CXFBusFactory busFactory = new CXFBusFactory();
Bus bus = busFactory.createBus();
DynamicClientFactory dynamicClientFactory = DynamicClientFactory.newInstance(bus);
Client client = dynamicClientFactory.createClient(wsdlUrl);
assertNotNull(client);
}
use of org.apache.cxf.bus.CXFBusFactory in project cxf by apache.
the class BusExtensionLoadingTest method testBusConstructionWithoutTCCL.
/**
* Tests the ExtensionManagerBus can be built using a given classloader
*
* @throws Exception
*/
@Test
public void testBusConstructionWithoutTCCL() throws Exception {
ClassLoader origClassLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(new TestClassLoader());
BusFactory factory = new CXFBusFactory() {
public Bus createBus(Map<Class<?>, Object> e, Map<String, Object> properties) {
return new ExtensionManagerBus(e, properties, this.getClass().getClassLoader());
}
};
Bus bus = factory.createBus();
assertNotNullExtensions(bus);
bus.shutdown(true);
} finally {
Thread.currentThread().setContextClassLoader(origClassLoader);
}
}
Aggregations