Search in sources :

Example 21 with ExtensionManagerBus

use of org.apache.cxf.bus.extension.ExtensionManagerBus in project cxf by apache.

the class AtmosphereWebSocketServletDestinationTest method testUseCustomAtmoosphereInterceptor.

@Test
public void testUseCustomAtmoosphereInterceptor() throws Exception {
    Bus bus = new ExtensionManagerBus();
    bus.setProperty("atmosphere.interceptors", new CustomInterceptor1());
    DestinationRegistry registry = new HTTPTransportFactory().getRegistry();
    EndpointInfo endpoint = new EndpointInfo();
    endpoint.setAddress(ENDPOINT_ADDRESS);
    endpoint.setName(ENDPOINT_NAME);
    AtmosphereWebSocketServletDestination dest = new AtmosphereWebSocketServletDestination(bus, registry, endpoint, ENDPOINT_ADDRESS);
    List<AtmosphereInterceptor> ais = dest.getAtmosphereFramework().interceptors();
    int added = 0;
    for (AtmosphereInterceptor a : ais) {
        if (CustomInterceptor1.class.equals(a.getClass())) {
            added++;
            break;
        }
    }
    assertEquals(1, added);
}
Also used : AtmosphereInterceptor(org.atmosphere.cpr.AtmosphereInterceptor) Bus(org.apache.cxf.Bus) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) DestinationRegistry(org.apache.cxf.transport.http.DestinationRegistry) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) HTTPTransportFactory(org.apache.cxf.transport.http.HTTPTransportFactory) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) Test(org.junit.Test)

Example 22 with ExtensionManagerBus

use of org.apache.cxf.bus.extension.ExtensionManagerBus in project cxf by apache.

the class AtmosphereWebSocketServletDestinationTest method testUseCXFDefaultAtmoosphereInterceptor.

@Test
public void testUseCXFDefaultAtmoosphereInterceptor() throws Exception {
    Bus bus = new ExtensionManagerBus();
    DestinationRegistry registry = new HTTPTransportFactory().getRegistry();
    EndpointInfo endpoint = new EndpointInfo();
    endpoint.setAddress(ENDPOINT_ADDRESS);
    endpoint.setName(ENDPOINT_NAME);
    AtmosphereWebSocketServletDestination dest = new AtmosphereWebSocketServletDestination(bus, registry, endpoint, ENDPOINT_ADDRESS);
    List<AtmosphereInterceptor> ais = dest.getAtmosphereFramework().interceptors();
    int added = 0;
    for (AtmosphereInterceptor a : ais) {
        if (DefaultProtocolInterceptor.class.equals(a.getClass())) {
            added++;
            break;
        }
    }
    assertEquals(1, added);
}
Also used : AtmosphereInterceptor(org.atmosphere.cpr.AtmosphereInterceptor) Bus(org.apache.cxf.Bus) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) DestinationRegistry(org.apache.cxf.transport.http.DestinationRegistry) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) HTTPTransportFactory(org.apache.cxf.transport.http.HTTPTransportFactory) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) Test(org.junit.Test)

Example 23 with ExtensionManagerBus

use of org.apache.cxf.bus.extension.ExtensionManagerBus in project cxf by apache.

the class AtmosphereWebSocketJettyDestinationTest method testUseCustomAtmoosphereInterceptor.

@Test
public void testUseCustomAtmoosphereInterceptor() throws Exception {
    Bus bus = new ExtensionManagerBus();
    bus.setProperty("atmosphere.interceptors", new CustomInterceptor1());
    DestinationRegistry registry = new HTTPTransportFactory().getRegistry();
    EndpointInfo endpoint = new EndpointInfo();
    endpoint.setAddress(ENDPOINT_ADDRESS);
    endpoint.setName(ENDPOINT_NAME);
    AtmosphereWebSocketServletDestination dest = new AtmosphereWebSocketServletDestination(bus, registry, endpoint, ENDPOINT_ADDRESS);
    List<AtmosphereInterceptor> ais = dest.getAtmosphereFramework().interceptors();
    int added = 0;
    for (AtmosphereInterceptor a : ais) {
        if (CustomInterceptor1.class.equals(a.getClass())) {
            added++;
            break;
        }
    }
    assertEquals(1, added);
}
Also used : AtmosphereInterceptor(org.atmosphere.cpr.AtmosphereInterceptor) Bus(org.apache.cxf.Bus) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) DestinationRegistry(org.apache.cxf.transport.http.DestinationRegistry) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) HTTPTransportFactory(org.apache.cxf.transport.http.HTTPTransportFactory) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) Test(org.junit.Test)

Example 24 with ExtensionManagerBus

use of org.apache.cxf.bus.extension.ExtensionManagerBus in project cxf by apache.

the class AtmosphereWebSocketJettyDestinationTest method testUseCXFDefaultAtmoosphereInterceptor.

@Test
public void testUseCXFDefaultAtmoosphereInterceptor() throws Exception {
    Bus bus = new ExtensionManagerBus();
    DestinationRegistry registry = new HTTPTransportFactory().getRegistry();
    EndpointInfo endpoint = new EndpointInfo();
    endpoint.setAddress(ENDPOINT_ADDRESS);
    endpoint.setName(ENDPOINT_NAME);
    AtmosphereWebSocketServletDestination dest = new AtmosphereWebSocketServletDestination(bus, registry, endpoint, ENDPOINT_ADDRESS);
    List<AtmosphereInterceptor> ais = dest.getAtmosphereFramework().interceptors();
    int added = 0;
    for (AtmosphereInterceptor a : ais) {
        if (DefaultProtocolInterceptor.class.equals(a.getClass())) {
            added++;
            break;
        }
    }
    assertEquals(1, added);
}
Also used : AtmosphereInterceptor(org.atmosphere.cpr.AtmosphereInterceptor) Bus(org.apache.cxf.Bus) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) DestinationRegistry(org.apache.cxf.transport.http.DestinationRegistry) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) HTTPTransportFactory(org.apache.cxf.transport.http.HTTPTransportFactory) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) Test(org.junit.Test)

Example 25 with ExtensionManagerBus

use of org.apache.cxf.bus.extension.ExtensionManagerBus in project cxf by apache.

the class NettyHttpDestinationTest method testDoService.

@Test
public void testDoService() throws Exception {
    Bus defaultBus = new ExtensionManagerBus();
    assertSame("Default thread bus has not been set", defaultBus, BusFactory.getThreadDefaultBus());
    destination = setUpDestination(false, false);
    setUpDoService(false);
    assertSame("Default thread bus has been unexpectedly reset", defaultBus, BusFactory.getThreadDefaultBus());
    destination.doService(request, response);
    verifyDoService();
    assertSame("Default thread bus has not been reset", defaultBus, BusFactory.getThreadDefaultBus());
}
Also used : Bus(org.apache.cxf.Bus) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) ExtensionManagerBus(org.apache.cxf.bus.extension.ExtensionManagerBus) Test(org.junit.Test)

Aggregations

ExtensionManagerBus (org.apache.cxf.bus.extension.ExtensionManagerBus)59 Bus (org.apache.cxf.Bus)48 Test (org.junit.Test)44 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)28 Message (org.apache.cxf.message.Message)14 HTTPTransportFactory (org.apache.cxf.transport.http.HTTPTransportFactory)14 QName (javax.xml.namespace.QName)8 DestinationRegistry (org.apache.cxf.transport.http.DestinationRegistry)8 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)7 ArrayList (java.util.ArrayList)6 AtmosphereInterceptor (org.atmosphere.cpr.AtmosphereInterceptor)6 HashMap (java.util.HashMap)5 HashSet (java.util.HashSet)5 URL (java.net.URL)4 List (java.util.List)4 ASMHelperImpl (org.apache.cxf.common.util.ASMHelperImpl)4 MessageObserver (org.apache.cxf.transport.MessageObserver)4 HTTPServerPolicy (org.apache.cxf.transports.http.configuration.HTTPServerPolicy)4 HttpURLConnection (java.net.HttpURLConnection)3 Hashtable (java.util.Hashtable)3