Package org.mule.api.client

Examples of org.mule.api.client.LocalMuleClient


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

    public void testConsumeFeed() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();
        FeedReceiver component = (FeedReceiver)getComponent("feedConsumer");
        component.getReceivedEntries().set(0);
        String feed = loadResourceAsString("sample-feed.atom");
        client.dispatch("jms://feed.in", feed, null);
        Thread.sleep(2000);
        assertEquals(25, component.getCount());
    }
View Full Code Here


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

    public void testConsumeSplitFeed() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();
        FeedReceiver component = (FeedReceiver)getComponent("feedConsumer");
        component.getReceivedEntries().set(0); //reset since the build reports that it's getting incremented someplace else
        String feed = loadResourceAsString("sample-feed.atom");
        client.dispatch("jms://feed.split.in", feed, null);
        Thread.sleep(5000);               
        assertEquals(25, component.getCount());
    }
View Full Code Here

    @Test
    public void testReceivesComponentExceptionMessage() throws Exception
    {
        MuleMessage request = new DefaultMuleMessage(requestPayload, (Map<String, Object>) null, muleContext);
        LocalMuleClient client = muleContext.getClient();
        MuleMessage received = client.send("http://localhost:" + dynamicPort.getNumber() + "/hello", request);

        assertTrue("Component exception was not managed", received.getPayloadAsString().contains(ERROR_MESSAGE));
    }
View Full Code Here

    }

    @Test
    public void testRequestResponse() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();

        MuleMessage response = client.send("vm://testRequestResponse", TEST_MESSAGE, null);

        Map payload = (Map) response.getPayload();
        if (testDatabase instanceof MySqlTestDatabase)
        {
            assertThat(payload.size(), equalTo(2));
View Full Code Here

    }

    @Test
    public void usesCustomTarget() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();
        MuleMessage response = client.send("vm://storedProcedureCustomTarget", TEST_MESSAGE, null);

        assertThat(response.getPayloadAsString(), equalTo(TEST_MESSAGE));
        assertThat(response.<StatementResultIterator>getInboundProperty("statementResult"), CoreMatchers.is(instanceOf(Map.class)));
        verifyUpdatedRecord();
    }
View Full Code Here

    }

    @Test
    public void testRequestResponse() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();

        MuleMessage response = client.send("vm://testRequestResponse", TEST_MESSAGE, null);
        assertThat(response.getPayload(), is(instanceOf(Map.class)));
        Map mapPayload = (Map) response.getPayload();
        int expectedUpdateCount = testDatabase instanceof DerbyTestDatabase ? 0 : 1;
        assertThat((Integer) mapPayload.get("updateCount1"), equalTo(expectedUpdateCount));
View Full Code Here

    }

    @Test
    public void usesParameterizedQuery() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();

        MuleMessage response = client.send("vm://selectParameterizedQuery", MARS.getName(), null);

        assertMessageContains(response, getMarsRecord());
    }
View Full Code Here

    protected abstract String getTransactionManagerResource();

    @Test
    public void commitsChanges() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();
        MuleMessage response = client.send("vm://testCommit", TEST_MESSAGE, null);

        assertEquals(1, response.getPayload());

        List<Map<String, String>> result = selectData("select * from PLANET where POSITION=4", getDefaultDataSource());
        assertRecords(result, new Record(new Field("NAME", "Mercury"), new Field("POSITION", 4)));
View Full Code Here

    }

    @Test
    public void deletesInBulkModeFromCustomSource() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();

        MuleMessage response = client.send("vm://deleteBulkCustomSource", TEST_MESSAGE, null);

        assertBulkDelete(response);
    }
View Full Code Here

    }

    @Test
    public void rollbacksChanges() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();
        MuleMessage response = client.send("vm://testRollback", TEST_MESSAGE, null);

        assertTrue(response.getPayload() instanceof NullPayload);

        List<Map<String, String>> result = selectData("select * from PLANET where POSITION=4", getDefaultDataSource());
        assertRecords(result, new Record(new Field("NAME", MARS.getName()), new Field("POSITION", 4)));
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.