FileDocCategorySizeDatePackage
TestJAXRPCHandlerInfoChain.javaAPI DocApache Axis 1.44945Sat Apr 22 18:57:28 BST 2006test.wsdd

TestJAXRPCHandlerInfoChain

public class TestJAXRPCHandlerInfoChain extends TestCase implements javax.xml.rpc.handler.Handler
Tests - if roles declared in handlerInfoChains are passed to the service method via the MessageContext - if parameters are passed to the handler - if the callback methods of an JAXRPC handler are called
author
Thomas Bayer (bayer@oio.de)

Fields Summary
static final String
SERVICE_NAME
static final String
tns
static final String
ROLE_ONE
static final String
ROLE_TWO
org.apache.axis.server.AxisServer
server
org.apache.axis.transport.local.LocalTransport
transport
static boolean
roleOneFound
static boolean
roleTwoFound
static boolean
initCalled
static boolean
handleRequestCalled
static boolean
handleResponseCalled
static boolean
methodCalled
static final String
wsdd
Constructors Summary
public TestJAXRPCHandlerInfoChain()


      
        super("test");
    
public TestJAXRPCHandlerInfoChain(String s)

        super(s);
    
Methods Summary
public voiddestroy()

    
public voiddoSomething()

        methodCalled = true;
    
public javax.xml.namespace.QName[]getHeaders()

        return null;
    
public booleanhandleFault(javax.xml.rpc.handler.MessageContext mc)

        return true;
    
public booleanhandleRequest(javax.xml.rpc.handler.MessageContext mc)


        String[] roles = ((SOAPMessageContext) mc).getRoles();
        for (int i = 0; i < roles.length; i++) {            
            if (ROLE_ONE.equals(roles[i]))
                roleOneFound = true;
            if (ROLE_TWO.equals(roles[i]))
                roleTwoFound = true;                            
        }

        handleRequestCalled = true;
        return true;
    
public booleanhandleResponse(javax.xml.rpc.handler.MessageContext mc)

        handleResponseCalled = true;
        return true;
    
public voidinit(javax.xml.rpc.handler.HandlerInfo handlerInfo)

        assertEquals("hossa", (String) handlerInfo.getHandlerConfig().get("param1"));
        initCalled = true;
    
protected voidsetUp()

        transport = new LocalTransport(new AxisServer(new XMLStringProvider(wsdd)));
        transport.setRemoteService(SERVICE_NAME);
    
public voidtestJAXRPCHandlerRoles()

        
        Call call = new Call(new Service());
        call.setTransport(transport);

        call.invoke("doSomething", null);
        
        assertTrue( roleOneFound);
        assertTrue( roleTwoFound);        
        assertTrue( initCalled);        
        assertTrue( handleRequestCalled);        
        assertTrue( handleResponseCalled);        
        assertTrue( methodCalled);