Package org.mule.api.client

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


        ScheduledDispatchJobConfig jobConfig = new ScheduledDispatchJobConfig();
        jobConfig.setMuleContext(muleContext);
        jobConfig.setEndpointRef("vm://quartz.in");

        MuleClient client = muleContext.getClient();
        client.dispatch("vm://quartz.scheduler2", jobConfig, null);
        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


    public void testSendFeed() throws Exception
    {
        InputStream input = getFeedInput();
       
        MuleClient client = muleContext.getClient();
        client.dispatch("vm://fromTest", input, null);
       
        assertTrue(receiveLatch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS));
       
        Object payload = message.getPayload();
        assertTrue(payload instanceof Feed);
View Full Code Here

 
  public void flow(String flowName, DelegateExecution execution) throws MuleException {
   
    MuleClient client = context.getClient();
   
    client.dispatch("vm://" + flowName, execution.getVariables(), null);

    // if we want to be able to write return values back into the
    // result-variable in fox, we could alternatively use "request-respond"
    // pattern and call/ return client.send(url, message) here. In the flow,
    // we would then have to set exchange-pattern="request-response"
View Full Code Here

    public void testCxfClientExceptionStrategy() throws Exception
    {
        MuleMessage request = new DefaultMuleMessage("hello", (Map<String,Object>)null, muleContext);

        MuleClient client = muleContext.getClient();
        client.dispatch("vm://helloClient", request);

        MuleMessage out = client.request("vm://out", FunctionalTestCase.RECEIVE_TIMEOUT);

        assertNotNull(out);
        assertTrue(out.getPayload() instanceof ExceptionMessage);
View Full Code Here

        Map<String, Object> properties = new HashMap<String, Object>();
        properties.put("recipient", "mule2@localhost");
        MuleMessage message = new DefaultMuleMessage(TEST_MESSAGE, properties, muleContext);

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

        assertTrue(latch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS));
    }

    private void configureTestComponent() throws Exception
View Full Code Here

    public void testEncryptDecrypt() throws Exception
    {
        String payload = "this is a super simple test. Hope it works!!!";
        MuleClient client = muleContext.getClient();

        client.dispatch("vm://in", new DefaultMuleMessage(payload, muleContext));

        MuleMessage message = client.request("vm://out", 5000);
        assertNull(message);

        assertNotNull("flow's exception strategy should have caught an exception", exceptionFromFlow);
View Full Code Here

    @Test
    public void testMessageTransformation() throws Exception
    {
        MuleClient client = muleContext.getClient();
        client.dispatch("vm://fromTest", createOutboundMessage());

        MuleMessage response = client.request("vm://toTest", RECEIVE_TIMEOUT);
        assertNotNull(response);

        String payload = response.getPayloadAsString();
View Full Code Here

    public void outboundHttpContentTypeTest() throws Exception
    {
        MuleClient client = muleContext.getClient();
        Map<String,Object> msgProps = new HashMap<String,Object>();
        msgProps.put("custom-header", "value-custom-header");
        client.dispatch("vm://in", "HelloWorld!", msgProps);

        MuleMessage reply = client.request("vm://out", 120000);
        Map<String, Object> headers = (Map<String, Object>) reply.getPayload();

        for (String header : HttpConstants.REQUEST_HEADER_NAMES.values())
View Full Code Here

        outboundProperties.put("cookies", cookiesObject);

        MuleClient client = muleContext.getClient();
        MuleMessage message = new DefaultMuleMessage(TEST_MESSAGE, outboundProperties, muleContext);

        client.dispatch("vm://vm-in", message);

        assertTrue(latch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS));
        assertTrue(cookieFound);
    }
View Full Code Here

                    props.put(MuleProperties.MULE_REPLY_TO_PROPERTY, "vm://queue");
                    try
                    {
                        for (int j = 0; j < 20; j++)
                        {
                            client.dispatch(((InboundEndpoint) muleContext.getRegistry().lookupObject("inEchoService")).getAddress(),
                                new DefaultMuleMessage(buf, muleContext), props);
                        }

                    }
                    catch (MuleException e)
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.