Package org.mule.api.client

Examples of org.mule.api.client.LocalMuleClient.send()


    @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


    @Test
    public void commitsChangesWhenMpIsNotTransactionalOnRollback() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();
        MuleMessage response = client.send("vm://rollbackWithNonTransactionalMP", 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", "Mercury"), new Field("POSITION", 4)));
View Full Code Here

    @Test
    public void commitsChangesWhenMpIsNotTransactionalOnCommit() throws Exception
    {
        LocalMuleClient client = muleContext.getClient();
        MuleMessage response = client.send("vm://rollbackWithNonTransactionalMP", 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", "Mercury"), new Field("POSITION", 4)));
View Full Code Here

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

        List<MuleMessage> chunks = (List<MuleMessage>) response.getPayload();
        assertEquals(2, chunks.size());
        assertThat(chunks.get(0), is(instanceOf(List.class)));
        assertRecords(chunks.get(0), getVenusRecord(), getEarthRecord());
View Full Code Here

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

        assertThat(response.getPayloadAsString(), equalTo(TEST_MESSAGE));
        assertTableCreation(response.<Integer>getInboundProperty("updateCount"));
    }
}
View Full Code Here

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

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

        assertMessageContains(response, getAllPlanetRecords());

        assertThat(errorCount, equalTo(EXPECTED_CONNECTION_ERRORS));
    }
View Full Code Here

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

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

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

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

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

        assertMessageContains(response, getExpectedRecords());
    }

    public Record[] getExpectedRecords()
View Full Code Here

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

        assertThat(response.getPayload(), is(instanceOf(List.class)));
        List generatedKeys = (List) response.getPayload();
        assertThat(generatedKeys.size(), equalTo(1));
        assertThat(generatedKeys.get(0), is(instanceOf(Map.class)));
View Full Code Here

        LocalMuleClient client = muleContext.getClient();

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

        MuleMessage result = client.send("http://localhost:" + port.getNumber() + "/helloworld/sayHelloWithJson/World", TEST_MESSAGE, props);

        assertEquals((Integer) HttpConstants.SC_OK, result.getInboundProperty(HttpConnector.HTTP_STATUS_PROPERTY, 0));
        assertEquals(getHelloWorldMessage(), result.getPayloadAsString());
    }
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.