use of org.apache.openejb.assembler.classic.HandlerChainInfo in project tomee by apache.
the class HandlerResolverImplTest method testMixedMatching.
public void testMixedMatching() throws Exception {
final HandlerChains handlerChains = readHandlerChains("/handlers_mixed.xml");
assertEquals(3, handlerChains.getHandlerChain().size());
final List<HandlerChainInfo> handlerChainInfos = ConfigurationFactory.toHandlerChainInfo(handlerChains);
final List<HandlerChainData> handlerChainDatas = WsBuilder.toHandlerChainData(handlerChainInfos, getClass().getClassLoader());
final HandlerResolverImpl resolver = new HandlerResolverImpl(handlerChainDatas, null, new InitialContext());
List<Handler> handlers = null;
handlers = resolver.getHandlerChain(new TestPortInfo(null, null, null));
assertEquals(0, handlers.size());
final QName serviceName1 = new QName("http://java.sun.com/xml/ns/javaee", "Bar");
final QName portName1 = new QName("http://java.sun.com/xml/ns/javaee", "FooBar");
final String binding1 = "##XML_HTTP";
handlers = resolver.getHandlerChain(new TestPortInfo(binding1, portName1, serviceName1));
assertEquals(3, handlers.size());
final String binding2 = "##SOAP11_HTTP";
handlers = resolver.getHandlerChain(new TestPortInfo(binding2, portName1, serviceName1));
assertEquals(2, handlers.size());
final QName serviceName2 = new QName("http://java.sun.com/xml/ns/javaee", "Baaz");
final QName portName2 = new QName("http://java.sun.com/xml/ns/javaee", "Baaz");
handlers = resolver.getHandlerChain(new TestPortInfo(binding1, portName2, serviceName2));
assertEquals(1, handlers.size());
}
use of org.apache.openejb.assembler.classic.HandlerChainInfo in project tomee by apache.
the class HandlerResolverImplTest method testPortMatching.
public void testPortMatching() throws Exception {
final HandlerChains handlerChains = readHandlerChains("/handlers_port.xml");
assertEquals(3, handlerChains.getHandlerChain().size());
final List<HandlerChainInfo> handlerChainInfos = ConfigurationFactory.toHandlerChainInfo(handlerChains);
final List<HandlerChainData> handlerChainDatas = WsBuilder.toHandlerChainData(handlerChainInfos, getClass().getClassLoader());
final HandlerResolverImpl resolver = new HandlerResolverImpl(handlerChainDatas, null, new InitialContext());
List<Handler> handlers = null;
handlers = resolver.getHandlerChain(new TestPortInfo(null, null, null));
assertEquals(0, handlers.size());
final QName portName1 = new QName("http://java.sun.com/xml/ns/javaee", "Bar");
handlers = resolver.getHandlerChain(new TestPortInfo(null, portName1, null));
assertEquals(1, handlers.size());
final QName portName2 = new QName("http://java.sun.com/xml/ns/javaee", "Foo");
handlers = resolver.getHandlerChain(new TestPortInfo(null, portName2, null));
assertEquals(2, handlers.size());
final QName portName3 = new QName("http://java.sun.com/xml/ns/javaee", "FooBar");
handlers = resolver.getHandlerChain(new TestPortInfo(null, portName3, null));
assertEquals(1, handlers.size());
final QName portName4 = new QName("http://java.sun.com/xml/ns/javaee", "BarFoo");
handlers = resolver.getHandlerChain(new TestPortInfo(null, portName4, null));
assertEquals(0, handlers.size());
}
Aggregations