Package org.mule.tck.functional

Examples of org.mule.tck.functional.FunctionalTestComponent


    }

    @Test
    public void testAsyncPostWithPersistentSedaQueue() throws Exception
    {
        FunctionalTestComponent component = getFunctionalTestComponent("AsyncPersistentQueueService");
        component.setEventCallback(new EventCallback()
        {
            @Override
            public void eventReceived(MuleEventContext context, Object comp) throws Exception
            {
                Thread.sleep(200);
View Full Code Here


            }
        });

        final Latch endDlqFlowLatch = new Latch();
        LocalMuleClient client = muleContext.getClient();
        FunctionalTestComponent functionalTestComponent = getFunctionalTestComponent("dlq-out");
        functionalTestComponent.setEventCallback(new EventCallback()
        {
            @Override
            public void eventReceived(MuleEventContext context, Object component) throws Exception
            {
                endDlqFlowLatch.release();
View Full Code Here

    FunctionalTestComponent ftc;
   
    @Before
    public void initFunctionaTestComponent()
    {
        ftc = new FunctionalTestComponent();
        ftc.setThrowException(true);
    }
View Full Code Here

    @Override
    protected void doSetUp() throws Exception
    {
        super.doSetUp();

        FunctionalTestComponent testComponent = getFunctionalTestComponent("test validator");
        testComponent.setEventCallback(new EventCallback()
        {
            @Override
            public void eventReceived(MuleEventContext context, Object component) throws Exception
            {
                receiveLatch.countDown();
View Full Code Here

    public void testResequencer() throws Exception
    {
        MuleClient client = muleContext.getClient();
        client.dispatch("vm://splitter", Arrays.asList("a", "b", "c", "d", "e", "f"), null);

        FunctionalTestComponent resequencer = getFunctionalTestComponent("test validator");

        assertTrue(receiveLatch.await(30, TimeUnit.SECONDS));

        assertEquals("Wrong number of messages received.", 6, resequencer.getReceivedMessagesCount());
        assertEquals("Sequence wasn't reordered.", "a", resequencer.getReceivedMessage(1));
        assertEquals("Sequence wasn't reordered.", "b", resequencer.getReceivedMessage(2));
        assertEquals("Sequence wasn't reordered.", "c", resequencer.getReceivedMessage(3));
        assertEquals("Sequence wasn't reordered.", "d", resequencer.getReceivedMessage(4));
        assertEquals("Sequence wasn't reordered.", "e", resequencer.getReceivedMessage(5));
        assertEquals("Sequence wasn't reordered.", "f", resequencer.getReceivedMessage(6));
    }
View Full Code Here

    }
   
    private void callVmAndThrowException(Object payload, final Exception exceptionToThrow, final String expectedMessage) throws Exception
    {
        MuleClient client = muleContext.getClient();
        FunctionalTestComponent ftc = getFunctionalTestComponent("matchesCorrectExceptionStrategyUsingExceptionType");
        ftc.setEventCallback(new EventCallback()
        {
            @Override
            public void eventReceived(MuleEventContext context, Object component) throws Exception
            {
                throw exceptionToThrow;
View Full Code Here

        public void onNotification(ExceptionNotification notification)
            {
                exceptionLatch.release();
            }
        });
        FunctionalTestComponent failingFlow = getFunctionalTestComponent("failingFlow");
        failingFlow.setEventCallback(new EventCallback()
        {
            public void eventReceived(MuleEventContext context, Object component) throws Exception
            {
                throw exceptionHolder.get();
            }
View Full Code Here

    public void testGracefulShutdownTimeout() throws Exception
    {
        final Latch latch = new Latch();

        FlowConstruct service = muleContext.getRegistry().lookupFlowConstruct("TestService");
        FunctionalTestComponent testComponent = (FunctionalTestComponent) getComponent(service);
        testComponent.setEventCallback(new EventCallback()
        {
            @Override
            public void eventReceived(MuleEventContext context, Object component) throws Exception
            {
                Thread.sleep(5500);
View Full Code Here

                    correlationTimeoutCount.incrementAndGet();
                }
            }
        });

        FunctionalTestComponent vortex = (FunctionalTestComponent) getComponent("vortex");
        FunctionalTestComponent aggregator = (FunctionalTestComponent) getComponent("aggregator");

        MuleClient client = muleContext.getClient();
        List<String> list = Arrays.asList("first", "second");
        client.dispatch("vm://splitter", list, null);

        Thread.sleep(5000);

        // no correlation timeout should ever fire
        assertEquals("Correlation timeout should not have happened.", 0, correlationTimeoutCount.intValue());

        // should receive only the second message
        assertEquals("Vortex received wrong number of messages.", 1, vortex.getReceivedMessagesCount());
        assertEquals("Wrong message received", "second", vortex.getLastReceivedMessage());

        // should receive only the first part
        assertEquals("Aggregator received wrong number of messages.", 1,
            aggregator.getReceivedMessagesCount());
        assertEquals("Wrong message received", Arrays.asList("first"), aggregator.getLastReceivedMessage());

        // wait for the vortex timeout (6000ms for vortext + 2000ms for aggregator
        // timeout + some extra for a test)
        Thread.sleep(9000);

        // now get the messages which were lagging behind
        // it will receive only one (first) as second will be discarded by the worker
        // because it has already dispatched one with the same group id
        assertEquals("Other messages never received by aggregator.", 1, aggregator.getReceivedMessagesCount());
        assertNotNull(client.request("vm://out?connector=queue", 10000));
    }
View Full Code Here

    @Override
    protected void doSetUp() throws Exception
    {
        super.doSetUp();

        FunctionalTestComponent testComponent = (FunctionalTestComponent) getComponent("ObjectToXml");
        assertNotNull(testComponent);
        testComponent.setEventCallback(new Callback(latch));
    }
View Full Code Here

TOP

Related Classes of org.mule.tck.functional.FunctionalTestComponent

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.