Package org.jboss.soa.esb.testutils

Examples of org.jboss.soa.esb.testutils.AbstractTestRunner


        testRunner.run();
    }

    public void test_exception_fail() throws Exception {
        AbstractTestRunner testRunner = new AbstractTestRunner() {
            public void test() throws Exception {
                ServiceInvoker invoker = new ServiceInvoker("Services", "ServiceA");
                Message request = MessageFactory.getInstance().getMessage();

                request.getBody().add("Hello");

                ResponseAction.exception = new ActionProcessingException("Exception!!");

                try {
                    invoker.deliverSync(request, 10000);
                    fail("Expected FaultMessageException");
                } catch(FaultMessageException e) {
                    assertEquals("Error delivering message to service 'Services:ServiceB'", e.getCause().getMessage());
                }
            }
        }.setServiceConfig("sync-invoker-config-01.xml");

        testRunner.run();
    }
View Full Code Here


        testRunner.run();
    }

    public void test_exception_OK() throws Exception {
        AbstractTestRunner testRunner = new AbstractTestRunner() {
            public void test() throws Exception {
                ServiceInvoker invoker = new ServiceInvoker("Services", "ServiceA");
                Message request = MessageFactory.getInstance().getMessage();

                request.getBody().add("Hello");

                ResponseAction.exception = new ActionProcessingException("Exception!!");

                invoker.deliverSync(request, 10000);
            }
        }.setServiceConfig("sync-invoker-config-02.xml");

        testRunner.run();
    }
View Full Code Here

        testRunner.run();
    }

    public void x_test_transaction_not_suspend() throws Exception {
        AbstractTestRunner testRunner = new AbstractTestRunner() {
            public void test() throws Exception {
                SuspendedTransactionStrategy suspendedTxStrategy = new SuspendedTransactionStrategy();

                TransactionStrategy.setTransactionStrategy(suspendedTxStrategy);
                try {
                    ServiceInvoker invoker = new ServiceInvoker("Services", "ServiceA");
                    Message request = MessageFactory.getInstance().getMessage();
                    ResponseAction.responseMessage = MessageFactory.getInstance().getMessage();

                    request.getBody().add("Hello");

                    // Need to deliver async here because we're in a transaction (mock transaction)...
                    invoker.deliverAsync(request);
                    ResponseAction.waitForMessage(10000);
                } finally {
                    TransactionStrategy.setTransactionStrategy(new TransactionStrategy.NullTransactionStrategy());
                }

                assertFalse(suspendedTxStrategy.suspended);
                assertFalse(suspendedTxStrategy.resumed);
            }
        }.setServiceConfig("sync-invoker-config-01.xml");

        testRunner.run();
    }
View Full Code Here

        System.setProperty(Environment.DEFAULT_INVM_SCOPE, "NONE");
        MockAction.exception = null;
    }

    public void test_async() throws Exception {
        AbstractTestRunner testRunner = new AbstractTestRunner() {
            public void test() throws Exception {
                ServiceInvoker invoker = new ServiceInvoker("ServiceCat", "CallService");
                Message message = MessageFactory.getInstance().getMessage();
                ActionProcessingException exception = new ActionProcessingException("Exception!!!");

                message.getHeader().getCall().setFrom(new LogicalEPR("A", "B"));
                Message faultMessage = Factory.createErrorMessage(Factory.UNEXPECTED_ERROR, message, exception);

                // Should not get a MessageDeliverException...
                invoker.deliverAsync(faultMessage);

                // Mock action should have received faultMessage...
                waitForMockSet(faultMessage);
                assertTrue("Message equality", checkMessageEquality(faultMessage, MockAction.message));
            }
        }.setServiceConfig("JBESB-2227-config-01.xml");

        testRunner.run();
    }
View Full Code Here

        testRunner.run();
    }

    public void x_test_transaction_suspend() throws Exception {
        AbstractTestRunner testRunner = new AbstractTestRunner() {
            public void test() throws Exception {
                SuspendedTransactionStrategy suspendedTxStrategy = new SuspendedTransactionStrategy();

                TransactionStrategy.setTransactionStrategy(suspendedTxStrategy);
                try {
                    ServiceInvoker invoker = new ServiceInvoker("Services", "ServiceA");
                    Message request = MessageFactory.getInstance().getMessage();
                    ResponseAction.responseMessage = MessageFactory.getInstance().getMessage();

                    request.getBody().add("Hello");

                    // Need to deliver async here because we're in a transaction (mock transaction)...
                    invoker.deliverAsync(request);
                    ResponseAction.waitForMessage(10000);
                } finally {
                    TransactionStrategy.setTransactionStrategy(new TransactionStrategy.NullTransactionStrategy());
                }

                assertTrue(suspendedTxStrategy.suspended);
                assertTrue(suspendedTxStrategy.resumed);
            }
        }.setServiceConfig("sync-invoker-config-03.xml");

        testRunner.run();
    }
View Full Code Here

TOP

Related Classes of org.jboss.soa.esb.testutils.AbstractTestRunner

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.