Package org.mule.api.client

Examples of org.mule.api.client.MuleClient.dispatch()


        Customer c = new Customer("Ross Mason", 1234);
        CustomerQuoteRequest request = new CustomerQuoteRequest(c, 100000, 48);

        for (int i = 0; i < getNumberOfRequests(); i++)
        {
            client.dispatch("CustomerRequests", request, null);
        }
       
        MuleMessage result;
        for (int i = 0; i < getNumberOfRequests(); i++)
        {
View Full Code Here


    }

    public void testFirstSuccessfulWithOneWayEndpoints() throws Exception
    {
        MuleClient client = muleContext.getClient();
        client.dispatch("vm://input4.in", TEST_MESSAGE, null);

        MuleMessage response = client.request("vm://output4.out", RECEIVE_TIMEOUT);
        assertNotNull(response);
        assertEquals(TEST_MESSAGE, response.getPayload());
    }
View Full Code Here

    public void testInboundScopeAsynchronous() throws Exception
    {
        MuleClient client = muleContext.getClient();
        MuleMessage message = new DefaultMuleMessage(TEST_MESSAGE, muleContext);
        message.setProperty("foo", "bar", PropertyScope.INBOUND);
        client.dispatch("vm://in-asynch", message);
        MuleMessage response = client.request("vm://out-asynch", 1000);
        assertNotNull(response);
        assertNull("Property should not have been propogated for this scope", response.getProperty("foo", PropertyScope.INBOUND));
    }
View Full Code Here

    public void testOutboundScopeAsynchronous() throws Exception
    {
        MuleClient client = muleContext.getClient();
        MuleMessage message = new DefaultMuleMessage(TEST_MESSAGE, muleContext);
        message.setProperty("foo", "bar", PropertyScope.OUTBOUND);
        client.dispatch("vm://in-asynch", message);
        MuleMessage response = client.request("vm://out-asynch", 1000);
        assertNotNull(response);
        assertNull("Property should not have been propogated for this scope", response.getProperty("foo", PropertyScope.OUTBOUND));
    }
View Full Code Here

    public void testInvocationScopeAsynchronous() throws Exception
    {
        MuleClient client = muleContext.getClient();
        MuleMessage message = new DefaultMuleMessage(TEST_MESSAGE, muleContext);
        message.setProperty("foo", "bar", PropertyScope.INVOCATION);
        client.dispatch("vm://in-asynch", message);
        MuleMessage response = client.request("vm://out-asynch", 1000);
        assertNotNull(response);
        assertEquals("bar", response.getProperty("foo", PropertyScope.INVOCATION));
    }
View Full Code Here

    public void testSessionScopeAsynchronous() throws Exception
    {
        MuleClient client = muleContext.getClient();
        MuleMessage message = new DefaultMuleMessage(TEST_MESSAGE, muleContext);
        message.setProperty("foo", "bar", PropertyScope.SESSION);
        client.dispatch("vm://in-asynch", message);
        MuleMessage response = client.request("vm://out-asynch", 1000);
        assertNotNull(response);
        assertEquals("bar", response.getProperty("foo", PropertyScope.SESSION));
    }
}
View Full Code Here

        String valueExpression = DateUtils.formatTimeStamp(Calendar.getInstance().getTime(), "ssmmhh");

        MuleMessage message = new DefaultMuleMessage("hi", muleContext);
        message.setProperty("originalId", id, PropertyScope.OUTBOUND);
        message.setProperty("valueId", valueExpression, PropertyScope.OUTBOUND);
        client.dispatch("vm://in", message);

        MuleMessage requestMessage = client.request("vm://forProcessing", FunctionalTestCase.RECEIVE_TIMEOUT);
        assertNotNull(requestMessage);

        message = new DefaultMuleMessage("hi", muleContext);
View Full Code Here

                throw new FunctionalTestException();
            }
        };
        ftc.setEventCallback(callback);

        client.dispatch(DESTINATION, TEST_MESSAGE, null);

        Thread.sleep(2000);
        mrexFired.await(timeout, TimeUnit.MILLISECONDS);
        assertEquals("MessageRedeliveredException never fired.", 0, mrexFired.getCount());
        assertEquals("Wrong number of delivery attempts", MAX_REDELIVERY + 1, callback.getCallbackCount());
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

        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
Copyright © 2018 www.massapi.com. 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.