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);
}
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);
}
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);
}
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);
}
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());
}
Aggregations