Search in sources :

Example 6 with HandlerChainInfo

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());
}
Also used : HandlerChainInfo(org.apache.openejb.assembler.classic.HandlerChainInfo) QName(javax.xml.namespace.QName) Handler(javax.xml.ws.handler.Handler) HandlerChains(org.apache.openejb.jee.HandlerChains) InitialContext(javax.naming.InitialContext)

Example 7 with HandlerChainInfo

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());
}
Also used : HandlerChainInfo(org.apache.openejb.assembler.classic.HandlerChainInfo) QName(javax.xml.namespace.QName) Handler(javax.xml.ws.handler.Handler) HandlerChains(org.apache.openejb.jee.HandlerChains) InitialContext(javax.naming.InitialContext)

Aggregations

HandlerChainInfo (org.apache.openejb.assembler.classic.HandlerChainInfo)7 InitialContext (javax.naming.InitialContext)5 Handler (javax.xml.ws.handler.Handler)5 HandlerChains (org.apache.openejb.jee.HandlerChains)5 QName (javax.xml.namespace.QName)3 ArrayList (java.util.ArrayList)2 HandlerInfo (org.apache.openejb.assembler.classic.HandlerInfo)1 PortInfo (org.apache.openejb.assembler.classic.PortInfo)1 Handler (org.apache.openejb.jee.Handler)1 HandlerChain (org.apache.openejb.jee.HandlerChain)1 ParamValue (org.apache.openejb.jee.ParamValue)1 PortComponent (org.apache.openejb.jee.PortComponent)1 ServiceImplBean (org.apache.openejb.jee.ServiceImplBean)1 WebserviceDescription (org.apache.openejb.jee.WebserviceDescription)1