Search in sources :

Example 1 with TestConnectorQueueHandler

use of org.mule.functional.api.component.TestConnectorQueueHandler in project mule by mulesoft.

the class HeisenbergMessageSourceTestCase method sourceFailsOnSuccessBodyCallsOnErrorAndOnTerminate.

@Test
public void sourceFailsOnSuccessBodyCallsOnErrorAndOnTerminate() throws Exception {
    startFlow("sourceFailsOnSuccessBodyCallsOnErrorAndOnTerminate");
    probe(TIMEOUT_MILLIS, POLL_DELAY_MILLIS, () -> assertState(true, true, true));
    assertThat(HeisenbergSource.terminateStatus, is(ERROR_BODY));
    assertThat(HeisenbergSource.error, not(empty()));
    TestConnectorQueueHandler queueHandler = new TestConnectorQueueHandler(registry);
    assertThat(queueHandler.read(OUT, RECEIVE_TIMEOUT).getMessage(), hasPayload(equalTo("Expected.")));
}
Also used : TestConnectorQueueHandler(org.mule.functional.api.component.TestConnectorQueueHandler) Test(org.junit.Test)

Example 2 with TestConnectorQueueHandler

use of org.mule.functional.api.component.TestConnectorQueueHandler in project mule by mulesoft.

the class QueueWriterMessageProcessor method initialise.

@Override
public void initialise() throws InitialisationException {
    if (attributeEvaluator == null) {
        String attribute = content == null ? "#[payload]" : content;
        if (contentJavaType != null) {
            attributeEvaluator = new AttributeEvaluator(attribute, fromType(contentJavaType));
        } else {
            attributeEvaluator = new AttributeEvaluator(attribute);
        }
    }
    attributeEvaluator.initialize(expressionManager);
    queueHandler = new TestConnectorQueueHandler(registry);
}
Also used : TestConnectorQueueHandler(org.mule.functional.api.component.TestConnectorQueueHandler) AttributeEvaluator(org.mule.runtime.core.privileged.util.AttributeEvaluator)

Example 3 with TestConnectorQueueHandler

use of org.mule.functional.api.component.TestConnectorQueueHandler in project mule by mulesoft.

the class HeisenbergMessageSourceTestCase method sourceFailsOnSuccessParametersCallsOnErrorAndOnTerminate.

@Test
public void sourceFailsOnSuccessParametersCallsOnErrorAndOnTerminate() throws Exception {
    startFlow("sourceWithInvalidSuccessParameter");
    probe(TIMEOUT_MILLIS, POLL_DELAY_MILLIS, () -> assertState(false, true, true));
    assertThat(HeisenbergSource.terminateStatus, is(ERROR_INVOKE));
    assertThat(HeisenbergSource.error, not(empty()));
    TestConnectorQueueHandler queueHandler = new TestConnectorQueueHandler(registry);
    assertThat(queueHandler.read(OUT, RECEIVE_TIMEOUT).getMessage(), hasPayload(equalTo("Expected.")));
}
Also used : TestConnectorQueueHandler(org.mule.functional.api.component.TestConnectorQueueHandler) Test(org.junit.Test)

Aggregations

TestConnectorQueueHandler (org.mule.functional.api.component.TestConnectorQueueHandler)3 Test (org.junit.Test)2 AttributeEvaluator (org.mule.runtime.core.privileged.util.AttributeEvaluator)1