Package org.mule.api.client

Examples of org.mule.api.client.MuleClient


        assertNotNull(result.getPayload());
    }
    @Test
    public void testEchoWsdlStaxBinding() throws Exception
    {
        MuleClient client = muleContext.getClient();
        MuleMessage result = client.request(((InboundEndpoint) muleContext.getRegistry()
            .lookupObject("httpInboundStax")).getAddress()
                                            + "?wsdl", 5000);
        assertNotNull(result.getPayload());
    }
View Full Code Here


    }

    @Test
    public void testEchoWsdlCustomBinding() throws Exception
    {
        MuleClient client = muleContext.getClient();
        MuleMessage result = client.request(((InboundEndpoint) muleContext.getRegistry()
            .lookupObject("httpInboundCustom")).getAddress()
                                            + "?wsdl", 5000);
        assertNotNull(result.getPayload());
    }
View Full Code Here

    }

    @Test
    public void testWsCall() throws Exception
    {
        MuleClient client = muleContext.getClient();
        MuleMessage result = client.send("vm://testin", new DefaultMuleMessage(testString, muleContext));
        assertNotNull(result.getPayload());
        assertEquals("Payload", testString, result.getPayloadAsString());
    }
View Full Code Here

    }

    @Test
    public void testWsCallWithUrlFromMessage() throws Exception
    {
        MuleClient client = muleContext.getClient();
        Map<String, Object> props = new HashMap<String, Object>();
        props.put("ws.service.url", "http://localhost:" + dynamicPort.getNumber()
                                            + "/services/TestUMO?method=onReceive");
        MuleMessage result = client.send("vm://testin2", testString, props);
        assertNotNull(result.getPayload());
        assertEquals("Payload", testString, result.getPayloadAsString());
    }
View Full Code Here

                         + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" "
                         + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + "<soap:Body>"
                         + "<ns1:echo xmlns:ns1=\"http://testmodels.cxf.module.mule.org/\">"
                         + "<text>Test String</text>" + "</ns1:echo>" + "</soap:Body>" + "</soap:Envelope>";

        MuleClient client = muleContext.getClient();
        MuleMessage result = client.send("http://localhost:" + HTTP_PORT + getContextPath()
                                         + "/services/mycomponent", request, null);
        String res = result.getPayloadAsString();

        assertTrue(res.indexOf("Test String") != -1);
    }
View Full Code Here

    }

    @Test
    public void testHttpGet() throws Exception
    {
        MuleClient client = muleContext.getClient();
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(HttpConnector.HTTP_METHOD_PROPERTY, "GET");
        MuleMessage result = client.send("http://localhost:" + HTTP_PORT + getContextPath()
                                         + "/services/mycomponent/echo/text/Test String", "", props);
        String res = result.getPayloadAsString();
        assertTrue(res.indexOf("Test String") != -1);
    }
View Full Code Here

    }

    @Test
    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

    }

    @Test
    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

    }

    @Test
    public void testEchoService() throws Exception
    {
        MuleClient client = muleContext.getClient();
        Map<String, Object> props = new HashMap<String, Object>();
        props.put("Content-Type", "application/soap+xml");
        InputStream xml = getClass().getResourceAsStream("/direct/direct-request.xml");
        MuleMessage result = client.send(((InboundEndpoint) muleContext.getRegistry()
            .lookupObject("httpInbound")).getAddress(), xml, props);
        assertTrue(result.getPayloadAsString().contains("Hello!"));
        String ct = result.getInboundProperty(HttpConstants.HEADER_CONTENT_TYPE, "");
        assertEquals("text/xml; charset=UTF-8", ct);
    }
View Full Code Here

    }

    @Test
    public void testEchoServiceEncoding() throws Exception
    {
        MuleClient client = muleContext.getClient();
        String message = LocaleMessageHandler.getString("test-data",
            Locale.JAPAN, "CxfBasicTestCase.testEchoServiceEncoding", new Object[]{});
        MuleMessage result = client.send("cxf:" + ((InboundEndpoint) muleContext.getRegistry()
                        .lookupObject("httpInbound")).getAddress() + "?method=echo", message, null);
        String ct = result.getInboundProperty(HttpConstants.HEADER_CONTENT_TYPE, "");

        assertEquals(message, result.getPayload());
        assertEquals("text/xml; charset=UTF-8", ct);
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.