Package org.mule.module.client

Examples of org.mule.module.client.MuleClient


        assertTrue(exceptionPayload.getRootException() instanceof MalformedEndpointException);
    }

    public void testClientComponentException() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);
        RemoteDispatcher dispatcher = client.getRemoteDispatcher("tcp://localhost:25551");
        MuleMessage result = dispatcher.sendRemote("vm://test.queue.2", new Date(), null);
        assertNotNull(result);
        ExceptionPayload exceptionPayload = result.getExceptionPayload();
        assertNotNull(exceptionPayload);
        assertTrue(exceptionPayload.getRootException().getClass().getName(),
View Full Code Here


        assertEquals("request", message.getPayloadAsString());
    }

    public void testHttpSyncResponseTransformer() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);
        MuleMessage message = client.send("http://localhost:4447", "request", null);
        assertNotNull(message);

        String server = message.getInboundProperty(HttpConstants.HEADER_SERVER);
        assertTrue(server.startsWith("Mule"));
View Full Code Here

    // ***** RESPONSE ENDPONTS ON INBOUND ENDPOINTS USED FOR REMOTE-SYNC RESPONSE AFTER ROUTRING *****
    // Applied by ReplyToHandler

    public void testJmsSyncResponseTransformer() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);
        MuleMessage message = client.send("jms://sync", "request", null);
        assertNotNull(message);
        assertEquals("request" + CUSTOM_RESPONSE, message.getPayloadAsString());
    }
View Full Code Here

    // ***** RESPONSE ENDPONTS ON OUTBOUND ENDPOINT *****
    // Applied by DefaultMuleSession once result message is received from remote endpoint.

    public void testVmSyncOutboundEndpointResponseTransformer() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);
        MuleMessage message = client.send("vm://syncOutboundEndpointResponseTransformer", "request", null);
        assertNotNull(message);
         assertEquals("request" + VM_OUTBOUND + VM_INBOUND + VM_OUT_IN_RESP + CUSTOM_RESPONSE + VM_RESPONSE,
         message.getPayloadAsString());
    }
View Full Code Here

         message.getPayloadAsString());
    }

    public void testJmsRemoteSync() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);
        MuleMessage message = client.send("vm://jmsSync", "request", null);
        assertNotNull(message);

        assertEquals("request" + VM_OUT_IN_RESP, message.getPayloadAsString());
    }
View Full Code Here

        assertEquals("request" + VM_OUT_IN_RESP, message.getPayloadAsString());
    }

    public void testJmsSyncOutboundEndpointResponseTransformer() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);
        MuleMessage message = client.send("vm://jmsSyncOutboundEndpointResponseTransformer", "request", null);
        assertNotNull(message);
        assertEquals("request" + VM_OUTBOUND + VM_INBOUND + CUSTOM_RESPONSE + VM_RESPONSE, message.getPayloadAsString());
    }
View Full Code Here

        assertEquals("request" + VM_OUTBOUND + VM_INBOUND + CUSTOM_RESPONSE + VM_RESPONSE, message.getPayloadAsString());
    }

    public void testChainedRouterOutboundEndpointResponseTransformer() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);
        MuleMessage message = client.send("vm://chainedRouterOutboundEndpointResponseTransformer", "request", null);
        assertNotNull(message);
        assertEquals("request" + VM_OUTBOUND + VM_INBOUND + VM_OUT_IN_RESP + VM_OUT_IN_RESP + CUSTOM_RESPONSE
                     + CUSTOM_RESPONSE + VM_RESPONSE, message.getPayloadAsString());
    }
View Full Code Here

                     + CUSTOM_RESPONSE + VM_RESPONSE, message.getPayloadAsString());
    }

    public void testNestedRouterOutboundEndpointResponseTransformer() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);
        MuleMessage message = client.send("vm://nestedRouterOutboundEndpointResponseTransformer", "request", null);
        assertNotNull(message);
        assertEquals("request" + VM_OUTBOUND + VM_INBOUND + VM_OUT_IN_RESP + CUSTOM_RESPONSE + CUSTOM_RESPONSE
                     + VM_RESPONSE, message.getPayloadAsString());
    }
View Full Code Here

        return "org/mule/test/integration/client/mule-client-listener-config.xml";
    }

    public void doTestRegisterListener(String component, String endpoint, boolean canSendWithoutReceiver) throws Exception
    {
        MuleClient client = new MuleClient(muleContext);

        try
        {
            client.send(endpoint, "Test Client Send message", null);
        }
        catch (DispatchException e)
        {
            if (!canSendWithoutReceiver)
            {
                assertTrue(e instanceof DispatchException);
                assertTrue(e.getCause() instanceof NoReceiverForEndpointException);
            }
        }
       
        Service c = muleContext.getRegistry().lookupService(component);
        c.start();

        MuleMessage message = client.send(endpoint, "Test Client Send message", null);
        assertNotNull(message);
        assertEquals("Received: Test Client Send message", message.getPayloadAsString());

        // The SpringRegistry is read-only so we can't unregister the service!
        //muleContext.getRegistry().unregisterComponent("vmComponent");
        c.stop();

        try
        {
            client.send(endpoint, "Test Client Send message", null);
        }
        catch (DispatchException e)
        {
            if (!canSendWithoutReceiver)
            {
View Full Code Here

        return "org/mule/test/integration/routing/outbound/multicaster-async-test.xml";
    }

    public void testSplitter() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);
        client.dispatch("vm://distributor.queue", new Apple(), null);

        List<Object> results = new ArrayList<Object>(3);

        MuleMessage result = client.request("vm://collector.queue", 5000);
        assertNotNull(result);
        results.add(result.getPayload());

        result = client.request("vm://collector.queue", 3000);
        assertNotNull(result);
        results.add(result.getPayload());

        result = client.request("vm://collector.queue", 3000);
        assertNotNull(result);
        results.add(result.getPayload());

        assertTrue(results.contains("Apple Received in ServiceOne"));
        assertTrue(results.contains("Apple Received in ServiceTwo"));
View Full Code Here

TOP

Related Classes of org.mule.module.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.