Package org.apache.axis

Examples of org.apache.axis.SimpleChain


    }

    public void testSimpleChainFaultAfterInvoke()
    {
        try {
            SimpleChain c = new SimpleChain();

            for (int i = 0; i < 5; i++) {
                c.addHandler(new TestHandler(i));
            }

            TestMessageContext mc = new TestMessageContext();
            c.invoke(mc);
            c.onFault(mc);
            assertEquals("Some onFaults were missed", mc.count(), 0);

        } catch (Exception ex) {
            assertTrue("Unexpected exception", false);
            ex.printStackTrace();
View Full Code Here



    public void testSimpleChainFaultDuringInvoke()
    {
        try {
            SimpleChain c = new SimpleChain();

            for (int i = 0; i < 5; i++) {
                TestHandler th = new TestHandler(i);
                if (i == 3) {
                    th.setToFault();
                }
                c.addHandler(th);
            }


            TestMessageContext mc = new TestMessageContext();
            try {
                c.invoke(mc);
                assertTrue("Testcase error - didn't throw fault", false);
            } catch (AxisFault f) {
                assertEquals("Some onFaults were missed", mc.count(), 0);
            }
View Full Code Here

      // the handler instance to validate
      // NOTE:must execute before the handler that throws the fault
      TestHandler testHandler = null;

        try {
            SimpleChain c = new SimpleChain();

            for (int i = 0; i < 5; i++) {
                TestHandler th = new TestHandler(i);
                if (i == 2)
                  testHandler = th;

                if (i == 3) {
                    th.setToFault();
                }
                c.addHandler(th);
            }


            TestMessageContext mc = new TestMessageContext();
            try {
                c.invoke(mc);
                assertTrue("Testcase error - didn't throw fault", false);
            } catch (AxisFault f) {
                // did we save off the fault string?
              assertEquals("faultstring does not match constant",
                testHandler.getFaultCatch(),TestChainFault.FAULT_MESSAGE);
View Full Code Here

    }

    public void setUp() throws Exception {
        engine.init();
        localTransport.setUrl(localURL);
        SimpleChain chain = new SimpleChain();
        chain.addHandler(new TestFaultHandler());
        chain.addHandler(new TestHandler());
        SOAPService service = new SOAPService(chain,
                                              new RPCProvider(),
                                              null);
       
        service.setOption("className", TestService.class.getName());
View Full Code Here

    }

    public void testSimpleChainFaultAfterInvoke()
    {
        try {
            SimpleChain c = new SimpleChain();

            for (int i = 0; i < 5; i++) {
                c.addHandler(new TestHandler(i));
            }

            TestMessageContext mc = new TestMessageContext();
            c.invoke(mc);
            c.onFault(mc);
            assertEquals("Some onFaults were missed", mc.count(), 0);

        } catch (Exception ex) {
            assertTrue("Unexpected exception", false);
            ex.printStackTrace();
View Full Code Here


    public void testSimpleChainFaultDuringInvoke()
    {
        try {
            SimpleChain c = new SimpleChain();

            for (int i = 0; i < 5; i++) {
                TestHandler th = new TestHandler(i);
                if (i == 3) {
                    th.setToFault();
                }
                c.addHandler(th);
            }


            TestMessageContext mc = new TestMessageContext();
            try {
                c.invoke(mc);
                assertTrue("Testcase error - didn't throw fault", false);
            } catch (AxisFault f) {
                assertEquals("Some onFaults were missed", mc.count(), 0);
            }
View Full Code Here

      // the handler instance to validate
      // NOTE:must execute before the handler that throws the fault
      TestHandler testHandler = null;

        try {
            SimpleChain c = new SimpleChain();

            for (int i = 0; i < 5; i++) {
                TestHandler th = new TestHandler(i);
                if (i == 2)
                  testHandler = th;

                if (i == 3) {
                    th.setToFault();
                }
                c.addHandler(th);
            }


            TestMessageContext mc = new TestMessageContext();
            try {
                c.invoke(mc);
                assertTrue("Testcase error - didn't throw fault", false);
            } catch (AxisFault f) {
                // did we save off the fault string?
              assertEquals("faultstring does not match constant",
                testHandler.getFaultCatch(),TestChainFault.FAULT_MESSAGE);
View Full Code Here

        public void invoke(MessageContext msgContext) throws AxisFault {}
    }

    public void testSimpleChainAddHandler()
    {
        SimpleChain c = new SimpleChain();

        Handler h1 = new TestHandler();
        assertTrue("Empty chain has a handler", !c.contains(h1));

        c.addHandler(h1);
        assertTrue("Added handler not in chain", c.contains(h1));
    }
View Full Code Here

    }

    public void testSimpleChainAddHandlerAfterInvoke()
    {
        try {
            SimpleChain c = new SimpleChain();
            Handler h1 = new TestHandler();
            c.addHandler(h1);

            // A null engine is good enough for this test
            MessageContext mc = new MessageContext(null);
            c.invoke(mc);

            // while testing, disable noise
            boolean oldLogging = InternalException.getLogging();
            InternalException.setLogging(false);

            try {
                Handler h2 = new TestHandler();
                c.addHandler(h2);
                assertTrue("Handler added after chain invoked", false);
            } catch (Exception e) {
                // Correct behaviour. Exact exception isn't critical
            }
View Full Code Here

    }

    public void testSimpleChainFaultAfterInvoke()
    {
        try {
            SimpleChain c = new SimpleChain();

            for (int i = 0; i < 5; i++) {
                c.addHandler(new TestHandler(i));
            }

            TestMessageContext mc = new TestMessageContext();
            c.invoke(mc);
            c.onFault(mc);
            assertEquals("Some onFaults were missed", mc.count(), 0);

        } catch (Exception ex) {
            assertTrue("Unexpected exception", false);
            ex.printStackTrace();
View Full Code Here

TOP

Related Classes of org.apache.axis.SimpleChain

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.