Package org.mule.api.client

Examples of org.mule.api.client.LocalMuleClient


        return "org/mule/test/message/vm-property-scope.xml";
    }

    public void testRequestResponseChain() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();
        MuleMessage message = new DefaultMuleMessage("test", muleContext);
        message.setOutboundProperty("foo", "fooValue");

        MuleMessage result = client.send("inbound2", message);
        assertEquals("test bar", result.getPayload());
        assertEquals("fooValue", result.<Object>getInboundProperty("foo"));
    }
View Full Code Here


        return "org/mule/test/message/jms-property-scope.xml";
    }

    public void testRequestResponse() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();
        MuleMessage message = new DefaultMuleMessage("test", muleContext);
        message.setOutboundProperty("foo", "fooValue");
        message.setReplyTo("jms://reply");

        client.dispatch("inbound", message);
        MuleMessage result = client.request("jms://reply", 10000);

        assertNotNull(result);
        assertEquals("test bar", result.getPayload());
        assertEquals("fooValue", result.<Object>getInboundProperty("foo"));
    }
View Full Code Here

        assertEquals(out2.getPayload(), out3.getPayload());
    }
   
    public void testDefaultExceptionStrategyNonEndpoint() throws Exception
    {
        LocalMuleClient mc = muleContext.getClient();

        mc.dispatch("vm://in3", "test", null);

        MuleMessage out4 = mc.request("vm://out4", FunctionalTestCase.RECEIVE_TIMEOUT);
        assertEquals("ERROR!", out4.getPayloadAsString());
    }
View Full Code Here

*/
public abstract class AbstractPropertyScopeTestCase extends DynamicPortTestCase
{
    public void testRequestResponse() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();
        MuleMessage message = new DefaultMuleMessage("test", muleContext);
        message.setOutboundProperty("foo", "fooValue");

        MuleMessage result = client.send("inbound", message);
        assertEquals("test bar", result.getPayloadAsString());
        assertEquals("fooValue", result.<Object> getInboundProperty("foo"));
    }
View Full Code Here

                assertEquals("We should have an attachment with foo", "foo" , IOUtils.toString(dh.getInputStream()));
                assertEquals("text/plain; charset=ISO-8859-1", dh.getContentType());
            }
        });

        LocalMuleClient client = muleContext.getClient();
        MuleMessage msg = new DefaultMuleMessage("test",  muleContext);
        msg.addOutboundAttachment("attach1", new DataHandler(new StringDataSource("foo", "attach1")));

        MuleMessage result = client.send("endpoint1", msg);
        assertEquals("We should have no attachments coming back", 0, result.getInboundAttachmentNames().size());
    }
View Full Code Here

        return "jetty-http-functional-test.xml";
    }

    public void testNonRootUrls() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();
        Map props = new HashMap();
        props.put(HttpConstants.HEADER_CONTENT_TYPE, "text/plain;charset=UTF-8");
        MuleMessage result = client.send("anotherClientEndpoint", TEST_MESSAGE, props);
        assertEquals(TEST_MESSAGE + " Received", result.getPayloadAsString());
    }
View Full Code Here

        return "jms-rss-consume.xml";
    }

    public void testConsumeFeed() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();
        String feed = SampleFeed.feedAsString();
        client.dispatch("jms://feed.in", feed, null);
        Thread.sleep(3000);
        FeedReceiver component = (FeedReceiver) getComponent("feedConsumer");
        assertEquals(25, component.getCount());
    }
View Full Code Here

        assertEquals(25, component.getCount());
    }

    public void testConsumeSplitFeed() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();
        String feed = SampleFeed.feedAsString();
        client.dispatch("jms://feed.split.in", feed, null);
        Thread.sleep(3000);
        EntryReceiver component = (EntryReceiver) getComponent("feedSplitterConsumer");
        assertEquals(25, component.getCount());
    }
View Full Code Here

        return "filter-conf.xml";
    }

    public void testAcceptFilter() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();

        MuleMessage result;
//        = client.send("http://localhost:9002/bar/foo", "test", null);
//        assertEquals("test test", result.getPayloadAsString());

        result = client.send("http://localhost:9002/baz", "test", null);
        assertEquals("test received", result.getPayloadAsString());
    }
View Full Code Here

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

    public void testUnAcceptFilter() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();

        Map<String, Object> props = new HashMap<String, Object>();
        props.put(HttpConnector.HTTP_METHOD_PROPERTY, "HEAD");

        MuleMessage result = client.send("http://localhost:9002/baz", "test", props);
        //assertEquals(new Integer(0), result.getInboundProperty(HttpConstants.HEADER_CONTENT_LENGTH, new Integer(-1)));
        assertEquals(new Integer(HttpConstants.SC_NOT_ACCEPTABLE), result.getInboundProperty(HttpConnector.HTTP_STATUS_PROPERTY, new Integer(-1)));

        result = client.send("http://localhost:9002/quo", "test", null);
        //assertEquals(new Integer(0), result.getInboundProperty(HttpConstants.HEADER_CONTENT_LENGTH, new Integer(-1)));
        assertEquals(new Integer(HttpConstants.SC_NOT_ACCEPTABLE), result.getInboundProperty(HttpConnector.HTTP_STATUS_PROPERTY, new Integer(-1)));
    }
View Full Code Here

TOP

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

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.