Search in sources :

Example 41 with Bus

use of org.apache.cxf.Bus in project cxf by apache.

the class SpringBusFactoryTest method testCustomFileName.

@Test
public void testCustomFileName() {
    String cfgFile = "org/apache/cxf/bus/spring/resources/bus-overwrite.xml";
    Bus bus = new SpringBusFactory().createBus(cfgFile, true);
    checkCustomerConfiguration(bus);
}
Also used : Bus(org.apache.cxf.Bus) Test(org.junit.Test)

Example 42 with Bus

use of org.apache.cxf.Bus in project cxf by apache.

the class SpringBusFactoryTest method testCustomFileURLFromSystemProperty.

@Test
public void testCustomFileURLFromSystemProperty() {
    URL cfgFileURL = this.getClass().getResource("resources/bus-overwrite.xml");
    System.setProperty(Configurer.USER_CFG_FILE_PROPERTY_URL, cfgFileURL.toString());
    Bus bus = new SpringBusFactory().createBus((String) null, true);
    checkCustomerConfiguration(bus);
    System.clearProperty(Configurer.USER_CFG_FILE_PROPERTY_URL);
}
Also used : Bus(org.apache.cxf.Bus) URL(java.net.URL) Test(org.junit.Test)

Example 43 with Bus

use of org.apache.cxf.Bus in project cxf by apache.

the class SpringBusFactoryTest method testJsr250.

@Test
public void testJsr250() {
    Bus bus = new SpringBusFactory().createBus("org/apache/cxf/bus/spring/testjsr250.xml");
    TestExtension te = bus.getExtension(TestExtension.class);
    assertTrue("@PostConstruct annotated method has not been called.", te.postConstructMethodCalled);
    assertTrue("@PreDestroy annoated method has been called already.", !te.preDestroyMethodCalled);
    bus.shutdown(true);
    assertTrue("@PreDestroy annotated method has not been called.", te.preDestroyMethodCalled);
}
Also used : Bus(org.apache.cxf.Bus) Test(org.junit.Test)

Example 44 with Bus

use of org.apache.cxf.Bus in project cxf by apache.

the class SpringBusFactoryTest method testDefault.

@Test
public void testDefault() {
    Bus bus = new SpringBusFactory().createBus();
    assertNotNull(bus);
    BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);
    assertNotNull("No binding factory manager", bfm);
    assertNotNull("No configurer", bus.getExtension(Configurer.class));
    assertNotNull("No resource manager", bus.getExtension(ResourceManager.class));
    assertNotNull("No destination factory manager", bus.getExtension(DestinationFactoryManager.class));
    assertNotNull("No conduit initiator manager", bus.getExtension(ConduitInitiatorManager.class));
    assertNotNull("No phase manager", bus.getExtension(PhaseManager.class));
    assertNotNull("No workqueue manager", bus.getExtension(WorkQueueManager.class));
    assertNotNull("No lifecycle manager", bus.getExtension(BusLifeCycleManager.class));
    assertNotNull("No service registry", bus.getExtension(ServerRegistry.class));
    try {
        bfm.getBindingFactory("http://cxf.apache.org/unknown");
    } catch (BusException ex) {
    // expected
    }
    assertEquals("Unexpected interceptors", 0, bus.getInInterceptors().size());
    assertEquals("Unexpected interceptors", 0, bus.getInFaultInterceptors().size());
    assertEquals("Unexpected interceptors", 0, bus.getOutInterceptors().size());
    assertEquals("Unexpected interceptors", 0, bus.getOutFaultInterceptors().size());
}
Also used : Bus(org.apache.cxf.Bus) DestinationFactoryManager(org.apache.cxf.transport.DestinationFactoryManager) PhaseManager(org.apache.cxf.phase.PhaseManager) ConduitInitiatorManager(org.apache.cxf.transport.ConduitInitiatorManager) ServerRegistry(org.apache.cxf.endpoint.ServerRegistry) BusLifeCycleManager(org.apache.cxf.buslifecycle.BusLifeCycleManager) BindingFactoryManager(org.apache.cxf.binding.BindingFactoryManager) ResourceManager(org.apache.cxf.resource.ResourceManager) Configurer(org.apache.cxf.configuration.Configurer) WorkQueueManager(org.apache.cxf.workqueue.WorkQueueManager) BusException(org.apache.cxf.BusException) Test(org.junit.Test)

Example 45 with Bus

use of org.apache.cxf.Bus in project cxf by apache.

the class SpringBusFactoryTest method testPhases.

@Test
public void testPhases() {
    Bus bus = new SpringBusFactory().createBus();
    PhaseManager cxfPM = bus.getExtension(PhaseManager.class);
    PhaseManager defaultPM = new PhaseManagerImpl();
    SortedSet<Phase> cxfPhases = cxfPM.getInPhases();
    SortedSet<Phase> defaultPhases = defaultPM.getInPhases();
    assertEquals(defaultPhases.size(), cxfPhases.size());
    assertTrue(cxfPhases.equals(defaultPhases));
    cxfPhases = cxfPM.getOutPhases();
    defaultPhases = defaultPM.getOutPhases();
    assertEquals(defaultPhases.size(), cxfPhases.size());
    assertTrue(cxfPhases.equals(defaultPhases));
}
Also used : Bus(org.apache.cxf.Bus) Phase(org.apache.cxf.phase.Phase) PhaseManager(org.apache.cxf.phase.PhaseManager) PhaseManagerImpl(org.apache.cxf.bus.managers.PhaseManagerImpl) Test(org.junit.Test)

Aggregations

Bus (org.apache.cxf.Bus)1144 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)800 URL (java.net.URL)748 QName (javax.xml.namespace.QName)436 Service (javax.xml.ws.Service)400 DoubleItPortType (org.example.contract.doubleit.DoubleItPortType)354 Test (org.junit.Test)219 HashMap (java.util.HashMap)63 Message (org.apache.cxf.message.Message)60 WebClient (org.apache.cxf.jaxrs.client.WebClient)50 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)48 Client (org.apache.cxf.endpoint.Client)43 Greeter (org.apache.hello_world.Greeter)42 SecurityToken (org.apache.cxf.ws.security.tokenstore.SecurityToken)41 SOAPService (org.apache.hello_world.services.SOAPService)41 JAXRSClientFactoryBean (org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean)40 Endpoint (org.apache.cxf.endpoint.Endpoint)38 ExtensionManagerBus (org.apache.cxf.bus.extension.ExtensionManagerBus)36 STSClient (org.apache.cxf.ws.security.trust.STSClient)36 Document (org.w3c.dom.Document)36