use of org.apache.cxf.transport.http_undertow.UndertowHTTPDestination in project cxf by apache.
the class ApplicationContextTest method checkContext.
private void checkContext(TestApplicationContext ctx) throws Exception {
ConfigurerImpl cfg = new ConfigurerImpl(ctx);
EndpointInfo info = getEndpointInfo("bla", "Foo", "http://localhost:9000");
Bus bus = (Bus) ctx.getBean(Bus.DEFAULT_BUS_ID);
bus.setExtension(cfg, Configurer.class);
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
DestinationFactory factory = dfm.getDestinationFactory("http://cxf.apache.org/transports/http");
Destination d = factory.getDestination(info, bus);
assertTrue(d instanceof UndertowHTTPDestination);
UndertowHTTPDestination jd = (UndertowHTTPDestination) d;
assertEquals("foobar", jd.getServer().getContentEncoding());
UndertowHTTPServerEngine engine = (UndertowHTTPServerEngine) jd.getEngine();
assertEquals(111, engine.getThreadingParameters().getMinThreads());
assertEquals(120, engine.getThreadingParameters().getMaxThreads());
ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
ConduitInitiator ci = cim.getConduitInitiator("http://cxf.apache.org/transports/http");
HTTPConduit conduit = (HTTPConduit) ci.getConduit(info, bus);
assertEquals(97, conduit.getClient().getConnectionTimeout());
info.setName(new QName("urn:test:ns", "Bar"));
conduit = (HTTPConduit) ci.getConduit(info, bus);
assertEquals(79, conduit.getClient().getConnectionTimeout());
UndertowHTTPDestination jd2 = (UndertowHTTPDestination) factory.getDestination(getEndpointInfo("foo", "bar", "http://localhost:9001"), bus);
engine = (UndertowHTTPServerEngine) jd2.getEngine();
assertEquals(40000, engine.getMaxIdleTime());
assertEquals(99, engine.getThreadingParameters().getMinThreads());
assertEquals(777, engine.getThreadingParameters().getMaxThreads());
assertNotNull("The handlers should not be null", engine.getHandlers());
assertEquals(1, engine.getHandlers().size());
UndertowHTTPDestination jd3 = (UndertowHTTPDestination) factory.getDestination(getEndpointInfo("sna", "foo", "https://localhost:9002"), bus);
engine = (UndertowHTTPServerEngine) jd3.getEngine();
assertEquals(111, engine.getThreadingParameters().getMinThreads());
assertEquals(120, engine.getThreadingParameters().getMaxThreads());
assertEquals(engine.getTlsServerParameters().getClientAuthentication().isWant(), true);
assertEquals(engine.getTlsServerParameters().getClientAuthentication().isRequired(), true);
UndertowHTTPDestination jd4 = (UndertowHTTPDestination) factory.getDestination(getEndpointInfo("sna", "foo2", "https://localhost:9003"), bus);
engine = (UndertowHTTPServerEngine) jd4.getEngine();
assertEquals(engine.getTlsServerParameters().getClientAuthentication().isWant(), false);
assertEquals(engine.getTlsServerParameters().getClientAuthentication().isRequired(), false);
UndertowHTTPDestination jd5 = (UndertowHTTPDestination) factory.getDestination(getEndpointInfo("sna", "foo", "http://localhost:9100"), bus);
engine = (UndertowHTTPServerEngine) jd5.getEngine();
String r = "expected fallback thread parameters configured for port 0";
assertNotNull(r, engine.getThreadingParameters());
assertEquals(r, 21, engine.getThreadingParameters().getMinThreads());
assertEquals(r, 389, engine.getThreadingParameters().getMaxThreads());
}
Aggregations