Package org.jboss.soa.esb.testutils

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


        wsdlServer.start();
        try {
            wsEndpointServer.start();
            try {
                new AbstractTestRunner() {
                    public void test() throws Exception {
                        ServiceInvoker invoker = new ServiceInvoker("OrderManagement", "GoodbyeService");
                        Message message = MessageFactory.getInstance().getMessage();
                        Map params = new HashMap();
View Full Code Here


    protected void tearDown() throws Exception {
        System.setProperty(Environment.DEFAULT_INVM_SCOPE, "NONE");
    }

    public void test_JBESB_1428_01() throws Exception {
        new AbstractTestRunner() {
            public void test() throws Exception {
                String response = (String) sendMessageToServer("http://localhost:8769", "Hi there!!");
                assertEquals("<ack/>", response);
            }
        }.setServiceConfig("jbr-async-config-01.xml").run();
View Full Code Here

            }
        }.setServiceConfig("jbr-async-config-01.xml").run();
    }

    public void test_JBESB_1428_02() throws Exception {
        new AbstractTestRunner() {
            public void test() throws Exception {
                String response = (String) sendMessageToServer("http://localhost:8769", "Hi there!!");
                assertEquals("<async_ack_from-file/>", response);
            }
        }.setServiceConfig("jbr-async-config-02.xml").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", "ServiceName");
                Message message = MessageFactory.getInstance().getMessage();

                message.getBody().add("Hi there!");
                invoker.deliverAsync(message);

                waitForMockSet(message);
                assertTrue("Message equality", checkMessageEquality(message, MockAction.message));
            }
        }.setServiceConfig("in-listener-config-01.xml");

        testRunner.run();
    }
View Full Code Here

        testRunner.run();
    }

    public void test_async_lockstep() throws Exception {
        AbstractTestRunner testRunner = new AbstractTestRunner() {
            public void test() throws Exception {
                // Test that we can invoke them....
                invokeService("ServiceCat", "Service1");
                invokeService("ServiceCat", "Service2");

                // Test that the EPRs are as we expected...
                List<EPR> eprs = RegistryUtil.getEprs("ServiceCat", "Service1");
                assertEquals(1, eprs.size());
                assertEquals(false, ((InVMEpr)eprs.get(0)).getLockstep());
                assertEquals(10000, ((InVMEpr)eprs.get(0)).getLockstepWaitTime());

                eprs = RegistryUtil.getEprs("ServiceCat", "Service2");
                assertEquals(1, eprs.size());
                assertEquals(true, ((InVMEpr)eprs.get(0)).getLockstep());
                assertEquals(4000, ((InVMEpr)eprs.get(0)).getLockstepWaitTime());
            }
        }.setServiceConfig("in-listener-config-04.xml");

        testRunner.run();
    }
View Full Code Here

        testRunner.run();
    }

    public void test_sync_noerror() throws Exception {
        AbstractTestRunner testRunner = new AbstractTestRunner() {
            public void test() throws Exception {
                ServiceInvoker invoker = new ServiceInvoker("ServiceCat", "ServiceName");
                Message message = MessageFactory.getInstance().getMessage();

                message.getBody().add("Hi there!");
                Message response = invoker.deliverSync(message, 2000);

                assertTrue("Message equality", checkMessageEquality(message, MockAction.message));
                assertTrue("Message equality", checkMessageEquality(message, response));
            }
        }.setServiceConfig("in-listener-config-01.xml");

        testRunner.run();
    }
View Full Code Here

        testRunner.run();
    }

    public void test_sync_error() throws Exception {
        AbstractTestRunner testRunner = new AbstractTestRunner() {
            public void test() throws Exception {
                ServiceInvoker invoker = new ServiceInvoker("ServiceCat", "ServiceName");
                Message message = MessageFactory.getInstance().getMessage();

                message.getBody().add("Hi there!");
                MockAction.exception = new ActionProcessingException("invm_sync_error");
                try {
                    invoker.deliverSync(message, 2000);
                    fail("Expected FaultMessageException.");
                } catch(FaultMessageException e) {
                    assertEquals("org.jboss.soa.esb.actions.ActionProcessingException: invm_sync_error", e.getMessage());
                }
            }
        }.setServiceConfig("in-listener-config-01.xml");

        testRunner.run();
    }
View Full Code Here

        String maxThreads = configUtil.getListenerConfig("InVM-0").getAttribute(ListenerTagNames.MAX_THREADS_TAG);
        assertEquals("10", maxThreads);
    }

    public void test_passByValue() throws Exception {
        AbstractTestRunner testRunner = new AbstractTestRunner() {
            public void test() throws Exception {
                ServiceInvoker invoker = new ServiceInvoker("ServiceCat", "ServiceName");
                Message message = MessageFactory.getInstance().getMessage();

                message.getBody().add("This message was passed by value!");
                invoker.deliverSync(message, 2000);

                assertTrue(message != MockAction.message);
                assertEquals("This message was passed by value!", MockAction.message.getBody().get());
            }
        }.setServiceConfig("in-listener-config-05.xml");

        testRunner.run();
    }
View Full Code Here

        testRunner.run();
    }

    public void test_sync_multithreaded() throws Exception {
        AbstractTestRunner testRunner = new AbstractTestRunner() {
            public void test() throws Exception {
                ServiceInvoker invoker = new ServiceInvoker("ServiceCat", "ServiceName");
                ClientInvokerThread[] clients = new ClientInvokerThread[10];

                // Create the clients...
                for (int i = 0; i < clients.length; i++) {
                    clients[i] = new ClientInvokerThread(invoker);
                }

                // Start the clients...
                for (int i = 0; i < clients.length; i++) {
                    clients[i].start();
                }

                // Wait for the clients to be "done"...
                boolean allNotDone = true;
                while(allNotDone) {
                    sleep(100);
                    allNotDone = false;
                    for (int i = 0; i < clients.length; i++) {
                        if(!clients[i].done) {
                            allNotDone = true;
                            break;
                        }
                    }
                }

                // Check were there any assertion failures...
                for (int i = 0; i < clients.length; i++) {
                    if(clients[i].thrown != null) {
                        fail("Thread " + i + " was in error: " + clients[i].thrown.getMessage());
                    }
                }
            }
        }.setServiceConfig("in-listener-config-03.xml");

        testRunner.run();
    }
View Full Code Here

        ResponseAction.responseMessage = null;
        ResponseAction.exception = null;
    }

    public void test_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.responseMessage = MessageFactory.getInstance().getMessage();
                ResponseAction.responseMessage.getBody().add("Goodbye");

                Message response = invoker.deliverSync(request, 10000);
                assertEquals("Goodbye", response.getBody().get());
            }
        }.setServiceConfig("sync-invoker-config-01.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.