Examples of MuleClient


Examples of org.mule.module.client.MuleClient

        assertEquals((String)m.getPayload(), "Marie");
    }

    public void testCaseGoodAuthenticationBadAuthorisation() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);
        Map props = new HashMap();

        EncryptionStrategy strategy = muleContext
            .getSecurityManager()
            .getEncryptionStrategy("PBE");
        String header = MuleCredentials.createHeader("anon", "anon", "PBE", strategy);
        props.put(MuleProperties.MULE_USER_PROPERTY, header);
        client.dispatch("vm://test", "Marie", props);
        MuleMessage m = client.request("vm://output", 3000);
        assertNull(m);
    }
View Full Code Here

Examples of org.mule.module.client.MuleClient

        client.dispatchDirect("TestReceiverUMO", "Test Client dispatch message", null);
    }

    public void testClientSend() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);

        MuleMessage message = client.send(getDispatchUrl(), "Test Client Send message", null);
        assertNotNull(message);
        assertEquals("Received: Test Client Send message", message.getPayload());
    }
View Full Code Here

Examples of org.mule.module.client.MuleClient

        assertNull(m);
    }

    public void testCaseBadAuthentication() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);
        Map props = new HashMap();

        EncryptionStrategy strategy = muleContext
            .getSecurityManager()
            .getEncryptionStrategy("PBE");
        String header = MuleCredentials.createHeader("anonX", "anonX", "PBE", strategy);
        props.put(MuleProperties.MULE_USER_PROPERTY, header);
        client.dispatch("vm://test", "USD,MTL", props);
        MuleMessage m = client.request("vm://output", 3000);
        assertNull(m);
    }
View Full Code Here

Examples of org.mule.module.client.MuleClient

        assertEquals("Received: Test Client Send message", message.getPayload());
    }

    public void testClientMultiSend() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);

        for (int i = 0; i < INTERATIONS; i++)
        {
            MuleMessage message = client.send(getDispatchUrl(), "Test Client Send message " + i, null);
            assertNotNull(message);
            assertEquals("Received: Test Client Send message " + i, message.getPayload());
        }
    }
View Full Code Here

Examples of org.mule.module.client.MuleClient

        }
    }

    public void testClientMultiDispatch() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);

        int i = 0;
        // to init
        client.dispatch(getDispatchUrl(), "Test Client Send message " + i, null);
        long start = System.currentTimeMillis();
        for (i = 0; i < INTERATIONS; i++)
        {
            client.dispatch(getDispatchUrl(), "Test Client Send message " + i, null);
        }
        long time = System.currentTimeMillis() - start;
        logger.debug(i + " took " + time + "ms to process");
        Thread.sleep(1000);
    }
View Full Code Here

Examples of org.mule.module.client.MuleClient

        Thread.sleep(1000);
    }

    public void testClientDispatchAndReceiveOnReplyTo() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);

        Map props = new HashMap();
        props.put(JmsConstants.JMS_REPLY_TO, "replyTo.queue");

        long start = System.currentTimeMillis();
        int i = 0;
        for (i = 0; i < INTERATIONS; i++)
        {
            logger.debug("Sending message " + i);
            client.dispatch(getDispatchUrl(), "Test Client Dispatch message " + i, props);
        }
        long time = System.currentTimeMillis() - start;
        logger.debug("It took " + time + " ms to send " + i + " messages");

        Thread.sleep(5000);
        start = System.currentTimeMillis();
        for (i = 0; i < INTERATIONS; i++)
        {
            MuleMessage message = client.request("jms://replyTo.queue", 5000);
            assertNotNull("message should not be null from Reply queue", message);
            logger.debug("Count is " + i);
            logger.debug("ReplyTo Message is: " + message.getPayloadAsString());
            assertTrue(message.getPayloadAsString().startsWith("Received"));
        }
View Full Code Here

Examples of org.mule.module.client.MuleClient

        return "org/mule/test/integration/notifications/component-message-notification-test.xml";
    }

    public void doTest() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);
        assertNotNull(client.send("vm://in-1?connector=direct", "hello sweet world", null));
        client.dispatch("vm://in-2?connector=direct", "goodbye cruel world", null);
        assertNotNull(client.request("vm://out-2?connector=queue", 5000));
    }
View Full Code Here

Examples of org.mule.module.client.MuleClient

    }

    @Override
    public void doTest() throws Exception
    {
        final MuleClient client = new MuleClient(muleContext);
        assertNotNull(client.send("vm://in-1?connector=direct", "hello sweet world", null));
        client.dispatch("vm://in-2?connector=direct", "goodbye cruel world", null);
        assertNotNull(client.request("vm://out-2?connector=queue", 5000));
    }
View Full Code Here

Examples of org.mule.module.client.MuleClient

                   inboundEndpointName)).getAddress();
    }
   
    public void testRequestResponse() throws Throwable
    {
        MuleClient client = new MuleClient(muleContext);
        MuleMessage result = client.send(getMuleAddress(client, "inMyComponent2") + "/mycomponent2?method=echo",
            "test", null);
        assertNotNull(result);
        assertEquals("test", result.getPayloadAsString());
    }
View Full Code Here

Examples of org.mule.module.client.MuleClient

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

    public void testRequestResponseComplex() throws Exception
    {
        MuleClient client = new MuleClient(muleContext);

        MuleMessage result = client.send(
            getMuleAddress(client, "inMyComponent3") + "/mycomponent3?method=getPerson", "Fred", null);
        assertNotNull(result);
        logger.debug(result.getPayload());
        assertTrue(result.getPayload() instanceof Person);
        assertEquals("Fred", ((Person)result.getPayload()).getFirstName());
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.