use of org.apache.cxf.transport.http.HTTPTransportFactory in project cxf by apache.
the class AtmosphereWebSocketServletDestinationTest method testUseCustomAtmoosphereInterceptors.
@Test
public void testUseCustomAtmoosphereInterceptors() throws Exception {
Bus bus = new ExtensionManagerBus();
bus.setProperty("atmosphere.interceptors", Arrays.asList(new CustomInterceptor1(), new CustomInterceptor2()));
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++;
} else if (CustomInterceptor2.class.equals(a.getClass())) {
added++;
break;
}
}
assertEquals(2, added);
}
use of org.apache.cxf.transport.http.HTTPTransportFactory in project cxf by apache.
the class JettyWebSocketDestinationTest method testRegisteration.
@Test
public void testRegisteration() throws Exception {
Bus bus = new ExtensionManagerBus();
DestinationRegistry registry = new HTTPTransportFactory().getRegistry();
EndpointInfo endpoint = new EndpointInfo();
endpoint.setAddress(ENDPOINT_ADDRESS);
endpoint.setName(ENDPOINT_NAME);
JettyHTTPServerEngine engine = EasyMock.createMock(JettyHTTPServerEngine.class);
control.replay();
TestJettyWebSocketDestination dest = new TestJettyWebSocketDestination(bus, registry, endpoint, null, engine);
dest.activate();
assertNotNull(registry.getDestinationForPath(ENDPOINT_ADDRESS));
dest.deactivate();
assertNull(registry.getDestinationForPath(ENDPOINT_ADDRESS));
}
use of org.apache.cxf.transport.http.HTTPTransportFactory in project cxf by apache.
the class CXFNonSpringServlet method getDestinationRegistryFromBusOrDefault.
protected DestinationRegistry getDestinationRegistryFromBusOrDefault(final String transportId) {
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
try {
String peferredTransportId = transportId;
// extension or customization).
if (StringUtils.isEmpty(peferredTransportId) && getBus() != null) {
peferredTransportId = (String) getBus().getProperty(AbstractTransportFactory.PREFERRED_TRANSPORT_ID);
}
if (StringUtils.isEmpty(peferredTransportId)) {
final Set<String> candidates = dfm.getRegisteredDestinationFactoryNames();
// consider other candidates
if (!candidates.contains(DEFAULT_TRANSPORT_ID)) {
peferredTransportId = candidates.stream().filter(name -> name.endsWith("/configuration")).findAny().orElse(DEFAULT_TRANSPORT_ID);
}
}
DestinationFactory df = StringUtils.isEmpty(peferredTransportId) ? dfm.getDestinationFactory(DEFAULT_TRANSPORT_ID) : dfm.getDestinationFactory(peferredTransportId);
if (df instanceof HTTPTransportFactory) {
HTTPTransportFactory transportFactory = (HTTPTransportFactory) df;
return transportFactory.getRegistry();
}
} catch (BusException e) {
// why are we throwing a busexception if the DF isn't found?
}
return null;
}
use of org.apache.cxf.transport.http.HTTPTransportFactory in project cxf by apache.
the class HttpConduitConfigurationTest method testConduitBean.
@Test
public void testConduitBean() throws Exception {
SpringBusFactory factory = new SpringBusFactory();
bus = factory.createBus("org/apache/cxf/transport/http/spring/conduit-bean.xml");
HTTPTransportFactory atf = new HTTPTransportFactory();
HTTPConduit conduit = (HTTPConduit) atf.getConduit(ei, bus);
verifyConduit(conduit);
}
use of org.apache.cxf.transport.http.HTTPTransportFactory in project cxf by apache.
the class HttpConduitConfigurationTest method testConduitBeanWithTLSReferences.
@Test
public void testConduitBeanWithTLSReferences() throws Exception {
SpringBusFactory factory = new SpringBusFactory();
bus = factory.createBus("org/apache/cxf/transport/http/spring/conduit-tlsrefs-bean.xml");
HTTPTransportFactory atf = new HTTPTransportFactory();
HTTPConduit conduit = (HTTPConduit) atf.getConduit(ei, bus);
verifyConduit(conduit);
}
Aggregations