use of org.apache.cxf.transport.http.HTTPTransportFactory in project cxf by apache.
the class UndertowHTTPDestinationTest method testRandomPortAllocation.
@Test
public void testRandomPortAllocation() throws Exception {
bus = BusFactory.getDefaultBus(true);
transportFactory = new HTTPTransportFactory();
ServiceInfo serviceInfo = new ServiceInfo();
serviceInfo.setName(new QName("bla", "Service"));
EndpointInfo ei = new EndpointInfo(serviceInfo, "");
ei.setName(new QName("bla", "Port"));
Destination d1 = transportFactory.getDestination(ei, bus);
URL url = new URL(d1.getAddress().getAddress().getValue());
assertTrue("No random port has been allocated", url.getPort() > 0);
}
use of org.apache.cxf.transport.http.HTTPTransportFactory in project cxf by apache.
the class UndertowHTTPDestinationTest method testContinuationsIgnored.
@Test
public void testContinuationsIgnored() throws Exception {
HttpServletRequest httpRequest = EasyMock.createMock(HttpServletRequest.class);
ServiceInfo serviceInfo = new ServiceInfo();
serviceInfo.setName(new QName("bla", "Service"));
EndpointInfo ei = new EndpointInfo(serviceInfo, "");
ei.setName(new QName("bla", "Port"));
final UndertowHTTPServerEngine httpEngine = new UndertowHTTPServerEngine();
httpEngine.setContinuationsEnabled(false);
UndertowHTTPServerEngineFactory factory = new UndertowHTTPServerEngineFactory() {
@Override
public UndertowHTTPServerEngine retrieveUndertowHTTPServerEngine(int port) {
return httpEngine;
}
};
Bus b2 = new ExtensionManagerBus();
transportFactory = new HTTPTransportFactory();
b2.setExtension(factory, UndertowHTTPServerEngineFactory.class);
TestUndertowDestination testDestination = new TestUndertowDestination(b2, transportFactory.getRegistry(), ei, factory);
testDestination.finalizeConfig();
Message mi = testDestination.retrieveFromContinuation(httpRequest);
assertNull("Continuations must be ignored", mi);
}
use of org.apache.cxf.transport.http.HTTPTransportFactory in project cxf by apache.
the class UndertowHTTPDestinationTest method testServerPolicyInServiceModel.
@Test
public void testServerPolicyInServiceModel() throws Exception {
policy = new HTTPServerPolicy();
address = getEPR("bar/foo");
bus = BusFactory.getDefaultBus(true);
transportFactory = new HTTPTransportFactory();
ServiceInfo serviceInfo = new ServiceInfo();
serviceInfo.setName(new QName("bla", "Service"));
endpointInfo = new EndpointInfo(serviceInfo, "");
endpointInfo.setName(new QName("bla", "Port"));
endpointInfo.addExtensor(policy);
engine = EasyMock.createMock(UndertowHTTPServerEngine.class);
EasyMock.replay();
endpointInfo.setAddress(NOWHERE + "bar/foo");
UndertowHTTPDestination dest = new EasyMockUndertowHTTPDestination(bus, transportFactory.getRegistry(), endpointInfo, null, engine);
assertEquals(policy, dest.getServer());
}
Aggregations