Search in sources :

Example 6 with CXFBusFactory

use of org.apache.cxf.bus.CXFBusFactory in project cxf by apache.

the class ServerMisc method run.

protected void run() {
    Factory factory = new PerRequestFactory(DocLitWrappedCodeFirstServiceImpl.class);
    factory = new PooledFactory(factory, 4);
    JAXWSMethodInvoker invoker = new JAXWSMethodInvoker(factory);
    JaxWsServerFactoryBean factoryBean;
    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);
    setBus(b);
    MetricRegistry registry = new MetricRegistry();
    CodahaleMetricsProvider.setupJMXReporter(b, registry);
    b.setExtension(registry, MetricRegistry.class);
    factoryBean = new JaxWsServerFactoryBean();
    factoryBean.setBus(b);
    factoryBean.setAddress(DOCLIT_CODEFIRST_URL);
    factoryBean.setServiceClass(DocLitWrappedCodeFirstServiceImpl.class);
    factoryBean.setFeatures(Arrays.asList(new MetricsFeature()));
    factoryBean.setInvoker(invoker);
    servers.add(factoryBean.create());
    factoryBean = new JaxWsServerFactoryBean();
    factoryBean.setBus(b);
    factoryBean.setAddress(DOCLIT_CODEFIRST_URL_XMLBINDING);
    factoryBean.setServiceClass(DocLitWrappedCodeFirstServiceImpl.class);
    factoryBean.setFeatures(Arrays.asList(new MetricsFeature()));
    factoryBean.setInvoker(invoker);
    factoryBean.setBindingId("http://cxf.apache.org/bindings/xformat");
    factoryBean.setWsdlURL("cxf6866.wsdl");
    servers.add(factoryBean.create());
    factoryBean = new JaxWsServerFactoryBean();
    factoryBean.setAddress(DOCLIT_CODEFIRST_SETTINGS_URL);
    factoryBean.setServiceClass(DocLitWrappedCodeFirstServiceImpl.class);
    factoryBean.setInvoker(invoker);
    factoryBean.getServiceFactory().setAnonymousWrapperTypes(true);
    factoryBean.getServiceFactory().getServiceConfigurations().add(0, new AbstractServiceConfiguration() {

        public Boolean isWrapperPartNillable(MessagePartInfo mpi) {
            return Boolean.TRUE;
        }

        public Long getWrapperPartMinOccurs(MessagePartInfo mpi) {
            return Long.valueOf(1L);
        }
    });
    servers.add(factoryBean.create());
    // Object implementor4 = new DocLitWrappedCodeFirstServiceImpl();
    // endpoints.add(Endpoint.publish(DOCLIT_CODEFIRST_URL, implementor4));
    Object implementor7 = new DocLitBareCodeFirstServiceImpl();
    EndpointImpl ep = (EndpointImpl) Endpoint.publish(DOCLITBARE_CODEFIRST_URL, implementor7);
    ep.getServer().getEndpoint().getInInterceptors().add(new SAAJInInterceptor());
    endpoints.add(ep);
    Object implementor6 = new InterfaceInheritTestImpl();
    endpoints.add(Endpoint.publish(DOCLIT_CODEFIRST_BASE_URL, implementor6));
    Object implementor1 = new AnonymousComplexTypeImpl();
    String address = "http://localhost:" + PORT + "/anonymous_complex_typeSOAP";
    endpoints.add(Endpoint.publish(address, implementor1));
    Object implementor2 = new JaxbElementTestImpl();
    address = "http://localhost:" + PORT + "/jaxb_element_test";
    endpoints.add(Endpoint.publish(address, implementor2));
    Object implementor3 = new OrderedParamHolderImpl();
    address = "http://localhost:" + PORT + "/ordered_param_holder/";
    endpoints.add(Endpoint.publish(address, implementor3));
    // Object implementor4 = new DocLitWrappedCodeFirstServiceImpl();
    // endpoints.add(Endpoint.publish(DOCLIT_CODEFIRST_URL, implementor4));
    Object implementor5 = new RpcLitCodeFirstServiceImpl();
    endpoints.add(Endpoint.publish(RPCLIT_CODEFIRST_URL, implementor5));
    endpoints.add(Endpoint.publish("http://localhost:" + PORT + "/InheritContext/InheritPort", new InheritImpl()));
    endpoints.add(Endpoint.publish(CXF_5064_URL, new SOAPHeaderServiceImpl()));
}
Also used : HashMap(java.util.HashMap) MetricsFeature(org.apache.cxf.metrics.MetricsFeature) Factory(org.apache.cxf.service.invoker.Factory) PooledFactory(org.apache.cxf.service.invoker.PooledFactory) PerRequestFactory(org.apache.cxf.service.invoker.PerRequestFactory) CXFBusFactory(org.apache.cxf.bus.CXFBusFactory) MessagePartInfo(org.apache.cxf.service.model.MessagePartInfo) PooledFactory(org.apache.cxf.service.invoker.PooledFactory) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) CXFBusFactory(org.apache.cxf.bus.CXFBusFactory) JaxbElementTestImpl(org.apache.cxf.jaxb_element_test.JaxbElementTestImpl) Bus(org.apache.cxf.Bus) SOAPHeaderServiceImpl(org.apache.cxf.systest.jaxws.cxf5064.SOAPHeaderServiceImpl) MetricRegistry(com.codahale.metrics.MetricRegistry) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) JAXWSMethodInvoker(org.apache.cxf.jaxws.JAXWSMethodInvoker) SAAJInInterceptor(org.apache.cxf.binding.soap.saaj.SAAJInInterceptor) AbstractServiceConfiguration(org.apache.cxf.wsdl.service.factory.AbstractServiceConfiguration) AnonymousComplexTypeImpl(org.apache.cxf.anonymous_complex_type.AnonymousComplexTypeImpl) OrderedParamHolderImpl(org.apache.cxf.ordered_param_holder.OrderedParamHolderImpl) PerRequestFactory(org.apache.cxf.service.invoker.PerRequestFactory)

Example 7 with CXFBusFactory

use of org.apache.cxf.bus.CXFBusFactory in project ddf by codice.

the class AbstractStsRealm method getBus.

/**
     * Helper method to setup STS Client.
     */
protected Bus getBus() {
    BusFactory bf = new CXFBusFactory();
    Bus setBus = bf.createBus();
    SpringBusFactory.setDefaultBus(setBus);
    SpringBusFactory.setThreadDefaultBus(setBus);
    return setBus;
}
Also used : Bus(org.apache.cxf.Bus) CXFBusFactory(org.apache.cxf.bus.CXFBusFactory) BusFactory(org.apache.cxf.BusFactory) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) CXFBusFactory(org.apache.cxf.bus.CXFBusFactory)

Example 8 with CXFBusFactory

use of org.apache.cxf.bus.CXFBusFactory in project cxf by apache.

the class BusExtensionLoadingTest method testDefaultBusConstruction.

/**
 * Test for checking the ExtensionManagerBus is built using the TCCL by default
 *
 * @throws Exception
 */
@Test
public void testDefaultBusConstruction() throws Exception {
    BusFactory factory = new CXFBusFactory();
    Bus bus = factory.createBus();
    assertNotNullExtensions(bus);
    bus.shutdown(true);
}
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) CXFBusFactory(org.apache.cxf.bus.CXFBusFactory) Test(org.junit.Test)

Example 9 with CXFBusFactory

use of org.apache.cxf.bus.CXFBusFactory in project cxf by apache.

the class ConfiguredEndpointTest method xtestCXFConfiguredServerEndpoint.

@Test
public void xtestCXFConfiguredServerEndpoint() {
    CXFBusFactory cf = new CXFBusFactory();
    factory = cf;
    BusFactory.setDefaultBus(null);
    Map<String, Object> properties = new HashMap<>();
    properties.put(Configurer.USER_CFG_FILE_PROPERTY_NAME, "org/apache/cxf/jaxws/configured-endpoints.xml");
    BusFactory.setDefaultBus(cf.createBus(null, properties));
    initializeBus();
    System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, CXFBusFactory.class.getName());
// doTestConfiguredServerEndpoint();
}
Also used : HashMap(java.util.HashMap) CXFBusFactory(org.apache.cxf.bus.CXFBusFactory) Test(org.junit.Test)

Example 10 with CXFBusFactory

use of org.apache.cxf.bus.CXFBusFactory in project cxf by apache.

the class ClientServerTest method testJaxWsDynamicClient.

@Test
public void testJaxWsDynamicClient() 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();
    org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory dynamicClientFactory = org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory.newInstance(bus);
    Client client = dynamicClientFactory.createClient(wsdlUrl);
    assertNotNull(client);
}
Also used : Bus(org.apache.cxf.Bus) 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)

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