Package org.mule.api.client

Examples of org.mule.api.client.MuleClient


        return "jbpm-component-functional-test.xml";
    }

    public void testNoException() throws Exception
    {
        MuleClient client = muleContext.getClient();
        client.send("vm://exception", "testNoException", null);                                 

        // Both messages should have been sent.
        assertNotNull(client.request("vm://queueC", 1000));           
        assertNotNull(client.request("vm://queueD", 1000));           
    }
View Full Code Here


        assertNotNull(client.request("vm://queueD", 1000));           
    }

    public void testExceptionInService() throws Exception
    {
        MuleClient client = muleContext.getClient();       
        try
        {
            client.send("vm://exception", "testExceptionInService", null);                     
            fail("Should have thrown an exception");
        }
        catch (Exception e)
        {
            assertTrue(ExceptionUtils.getRootCause(e) instanceof FunctionalTestException);
        }
       
        // The first message should have been sent, but not the second one.
        assertNotNull(client.request("vm://queueC", 1000));           
        assertNull(client.request("vm://queueD", 1000));           
    }
View Full Code Here

        assertNull(client.request("vm://queueD", 1000));           
    }

    public void testExceptionInTransformer() throws Exception
    {
        MuleClient client = muleContext.getClient();
       
        try
        {
            client.send("vm://exception", "testExceptionInTransformer", null);
            fail("Should have thrown an exception");
        }
        catch (Exception e)
        {
            assertTrue(ExceptionUtils.getRootCause(e) instanceof TransformerException);
        }
       
        // The first message should have been sent, but not the second one.
        assertNotNull(client.request("vm://queueC", 1000));           
        assertNull(client.request("vm://queueD", 1000));           
    }
View Full Code Here

        return "spring-jbpm-component.xml";
    }

    public void testSimpleProcess() throws Exception
    {
        MuleClient client = muleContext.getClient();
        BPMS bpms = muleContext.getRegistry().lookupObject(BPMS.class);
        assertNotNull(bpms);

        // Create a new process.
        MuleMessage response = client.send("vm://simple", "data", null);
        Object process = response.getPayload();

        String processId = (String)bpms.getId(process);
        // The process should be started and in a wait state.
        assertFalse(processId == null);
        assertEquals("dummyState", bpms.getState(process));

        // Advance the process one step.
        Map props = new HashMap();
        props.put(Process.PROPERTY_PROCESS_ID, processId);
        response = client.send("vm://simple", null, props);
        process = response.getPayload();

        // The process should have ended.
        assertTrue(bpms.hasEnded(process));
    }
View Full Code Here

        return "jbpm-component-functional-test.xml";
    }

    public void testSimpleProcess() throws Exception
    {
        MuleClient client = muleContext.getClient();
        BPMS bpms = muleContext.getRegistry().lookupObject(BPMS.class);
        assertNotNull(bpms);

        // Create a new process.
        MuleMessage response = client.send("vm://simple", "data", null);
        Object process = response.getPayload();

        String processId = (String)bpms.getId(process);
        // The process should be started and in a wait state.
        assertFalse(processId == null);
        assertEquals("dummyState", bpms.getState(process));

        // Advance the process one step.
        Map props = new HashMap();
        props.put(Process.PROPERTY_PROCESS_ID, processId);
        response = client.send("vm://simple", null, props);
        process = response.getPayload();

        // The process should have ended.
        assertTrue(bpms.hasEnded(process));
    }
View Full Code Here

        return "jbpm-component-functional-test.xml";
    }

    public void testVariables() throws Exception
    {
        MuleClient client = muleContext.getClient();
        BPMS bpms = muleContext.getRegistry().lookupObject(BPMS.class);
        assertNotNull(bpms);

        Map<String, Object> props = new HashMap<String, Object>();
        props.put("foo", "bar");
        MuleMessage response = client.send("vm://variables", "data", props);
        String processId = (String)bpms.getId(response.getPayload());
        assertNotNull(processId);

        response = client.request("vm://queueA", TIMEOUT);
        assertNotNull(response);
        assertEquals("bar", response.getInboundProperty("foo"));
        assertEquals(0.75, response.getInboundProperty("fraction"));

        // Advance the process
        props = new HashMap<String, Object>();
        props.put(Process.PROPERTY_PROCESS_ID, processId);
        props.put("straw", "berry");
        props.put("time", new Date());
        response = client.send("vm://variables", "data", props);
       
        response = client.request("vm://queueB", TIMEOUT);
        assertNotNull(response);
        assertEquals("bar", response.getInboundProperty("foo"));
        assertEquals(0.75, response.getInboundProperty("fraction"));
        assertEquals("berry", response.getInboundProperty("straw"));
        final Object o = response.getInboundProperty("time");
View Full Code Here

public class WSRMTest extends DynamicPortTestCase
{
    public void testAnonymous() throws Exception
    {
        MuleClient client = new DefaultLocalMuleClient(muleContext);
        MuleMessage result = client.send("anonymousReplyClientEndpoint", new DefaultMuleMessage("test", muleContext));       
        assertEquals("Hello test", result.getPayloadAsString());
    }
View Full Code Here

        assertEquals("Hello test", result.getPayloadAsString());
    }

    public void testDecoupled() throws Exception
    {
        MuleClient client = new DefaultLocalMuleClient(muleContext);
        MuleMessage result = client.send("decoupledClientEndpoint", new DefaultMuleMessage("test", muleContext));       
        assertEquals("Hello test", result.getPayloadAsString());
    }
View Full Code Here

    public void testSendFeed() throws Exception
    {
        InputStream input = SampleFeed.feedAsStream();

        MuleClient client = muleContext.getClient();
        client.dispatch("vm://fromTest", input, null);

        assertTrue(receiveLatch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS));

        Object payload = message.getPayload();
        assertTrue(payload instanceof SyndFeed);
View Full Code Here

        ScheduledDispatchJobConfig jobConfig = new ScheduledDispatchJobConfig();
        jobConfig.setMuleContext(muleContext);
        jobConfig.setEndpointRef("vm://quartz.in");
        props.put(QuartzConnector.PROPERTY_JOB_CONFIG, jobConfig);

        MuleClient client = muleContext.getClient();
        client.dispatch("vm://quartz.scheduler1", NullPayload.getInstance(), props);
        assertTrue(count.await(7000));

        // now that the scheduler sent the event, null out the event callback to avoid CountdownCallback
        // report more messages than requested during shutdown of the test/Mule server
        component.setEventCallback(null);
View Full Code Here

TOP

Related Classes of org.mule.api.client.MuleClient

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.