FileDocCategorySizeDatePackage
TestScopeOption.javaAPI DocApache Axis 1.42855Sat Apr 22 18:57:26 BST 2006test.wsdd

TestScopeOption

public class TestScopeOption extends junit.framework.TestCase

Fields Summary
static final String
HANDLER_NAME
static final String
doc1
static final String
doc2
Constructors Summary
public TestScopeOption(String name)


        
        super(name);
    
Methods Summary
public static voidmain(java.lang.String[] args)

        TestScopeOption tester = new TestScopeOption("foo");
        tester.testPerAccessScope();
    
protected voidsetup()

    
public static junit.framework.Testsuite()

        return new TestSuite(TestScopeOption.class);
    
public voidtestPerAccessScope()
Initialize an engine with a single handler with per-access scope. Then get the handler from the engine twice, and confirm that we get two different objects.

        String doc = doc1 + "per-access" + doc2;
        XMLStringProvider provider = new XMLStringProvider(doc);
        AxisServer server = new AxisServer(provider);
        
        Handler h1 = server.getHandler(HANDLER_NAME);
        assertNotNull("Couldn't get first logger handler from engine!", h1);
        
        Handler h2 = server.getHandler(HANDLER_NAME);
        assertNotNull("Couldn't get second logger handler from engine!", h2);
        
        assertTrue("Per-access Handlers were identical!", (h1 != h2));
    
public voidtestSingletonScope()
Initialize an engine with a single handler of singleton scope. Then get the handler from the engine twice, and confirm that we get the same object both times.

        String doc = doc1 + "singleton" + doc2;
        XMLStringProvider provider = new XMLStringProvider(doc);
        AxisServer server = new AxisServer(provider);
        
        Handler h1 = server.getHandler(HANDLER_NAME);
        assertNotNull("Couldn't get first logger handler from engine!", h1);
        
        Handler h2 = server.getHandler(HANDLER_NAME);
        assertNotNull("Couldn't get second logger handler from engine!", h2);
        
        assertTrue("Singleton Handlers were different!", (h1 == h2));