Search in sources :

Example 1 with CXFBusFactory

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();
}
Also used : CXFBusFactory(org.apache.cxf.bus.CXFBusFactory) Test(org.junit.Test)

Example 2 with CXFBusFactory

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();
}
Also used : CXFBusFactory(org.apache.cxf.bus.CXFBusFactory) Test(org.junit.Test)

Example 3 with CXFBusFactory

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);
}
Also used : SOAPService(org.apache.hello_world_soap_http.SOAPService) Bus(org.apache.cxf.Bus) HashMap(java.util.HashMap) MetricRegistry(com.codahale.metrics.MetricRegistry) ArrayList(java.util.ArrayList) URL(java.net.URL) File(java.io.File) CXFBusFactory(org.apache.cxf.bus.CXFBusFactory)

Example 4 with CXFBusFactory

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);
}
Also used : Bus(org.apache.cxf.Bus) DynamicClientFactory(org.apache.cxf.endpoint.dynamic.DynamicClientFactory) Client(org.apache.cxf.endpoint.Client) URL(java.net.URL) CXFBusFactory(org.apache.cxf.bus.CXFBusFactory) SOAPServiceMultiPortTypeTest(org.apache.hello_world_soap_http.SOAPServiceMultiPortTypeTest) SOAPServiceBogusAddressTest(org.apache.hello_world_soap_http.SOAPServiceBogusAddressTest) Test(org.junit.Test)

Example 5 with CXFBusFactory

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);
    }
}
Also used : Bus(org.apache.cxf.Bus) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) CXFBusFactory(org.apache.cxf.bus.CXFBusFactory) BusFactory(org.apache.cxf.BusFactory) Map(java.util.Map) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) CXFBusFactory(org.apache.cxf.bus.CXFBusFactory) Test(org.junit.Test)

Aggregations

CXFBusFactory (org.apache.cxf.bus.CXFBusFactory)10 Bus (org.apache.cxf.Bus)7 Test (org.junit.Test)7 URL (java.net.URL)3 HashMap (java.util.HashMap)3 BusFactory (org.apache.cxf.BusFactory)3 MetricRegistry (com.codahale.metrics.MetricRegistry)2 ExtensionManagerBus (org.apache.cxf.bus.extension.ExtensionManagerBus)2 Client (org.apache.cxf.endpoint.Client)2 SOAPServiceBogusAddressTest (org.apache.hello_world_soap_http.SOAPServiceBogusAddressTest)2 SOAPServiceMultiPortTypeTest (org.apache.hello_world_soap_http.SOAPServiceMultiPortTypeTest)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 AnonymousComplexTypeImpl (org.apache.cxf.anonymous_complex_type.AnonymousComplexTypeImpl)1 SAAJInInterceptor (org.apache.cxf.binding.soap.saaj.SAAJInInterceptor)1 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)1 DynamicClientFactory (org.apache.cxf.endpoint.dynamic.DynamicClientFactory)1 JaxbElementTestImpl (org.apache.cxf.jaxb_element_test.JaxbElementTestImpl)1 EndpointImpl (org.apache.cxf.jaxws.EndpointImpl)1