use of org.mule.runtime.core.internal.processor.ResponseMessageProcessorAdapter in project mule by mulesoft.
the class DefaultMessageProcessorChainTestCase method testExceptionInResponse.
@Test
public void testExceptionInResponse() throws Exception {
DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
builder.chain(new ResponseMessageProcessorAdapter(new ExceptionThrowingMessageProcessor(illegalStateException)), getAppendingMP("1"));
expectedException.expect(is(illegalStateException));
process(builder.build(), getTestEventUsingFlow("0"));
}
use of org.mule.runtime.core.internal.processor.ResponseMessageProcessorAdapter in project mule by mulesoft.
the class DefaultMessageProcessorChainTestCase method testResponseProcessorInNestedChain.
@Test
public void testResponseProcessorInNestedChain() throws Exception {
DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
final ResponseMessageProcessorAdapter responseMessageProcessorAdapter = new ResponseMessageProcessorAdapter(getAppendingMP("c"));
responseMessageProcessorAdapter.setMuleContext(muleContext);
builder.chain(getAppendingMP("1"), newChain(empty(), getAppendingMP("a"), responseMessageProcessorAdapter, getAppendingMP("b")), getAppendingMP("2"));
assertThat(process(builder.build(), getTestEventUsingFlow("0")).getMessage().getPayload().getValue(), equalTo("01abc2"));
}
use of org.mule.runtime.core.internal.processor.ResponseMessageProcessorAdapter in project mule by mulesoft.
the class DefaultMessageProcessorChainTestCase method testResponseProcessor.
@Test
public void testResponseProcessor() throws Exception {
DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
final ResponseMessageProcessorAdapter responseMessageProcessorAdapter = new ResponseMessageProcessorAdapter(getAppendingMP("3"));
responseMessageProcessorAdapter.setMuleContext(muleContext);
builder.chain(getAppendingMP("1"), responseMessageProcessorAdapter, getAppendingMP("2"));
assertThat(process(builder.build(), getTestEventUsingFlow("0")).getMessage().getPayload().getValue(), equalTo("0123"));
}
use of org.mule.runtime.core.internal.processor.ResponseMessageProcessorAdapter in project mule by mulesoft.
the class DefaultMessageProcessorChainTestCase method testNestedResponseProcessor.
@Test
public void testNestedResponseProcessor() throws Exception {
DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
final ResponseMessageProcessorAdapter innerResponseMessageProcessorAdapter = new ResponseMessageProcessorAdapter(getAppendingMP("4"));
final ResponseMessageProcessorAdapter responseMessageProcessorAdapter = new ResponseMessageProcessorAdapter(newChain(empty(), innerResponseMessageProcessorAdapter, getAppendingMP("3")));
builder.chain(getAppendingMP("1"), responseMessageProcessorAdapter, getAppendingMP("2"));
process(builder.build(), getTestEventUsingFlow("0"));
assertThat(process(builder.build(), getTestEventUsingFlow("0")).getMessage().getPayload().getValue(), equalTo("01234"));
}
use of org.mule.runtime.core.internal.processor.ResponseMessageProcessorAdapter in project mule by mulesoft.
the class DefaultFlowTestCase method doSetUp.
@Override
protected void doSetUp() throws Exception {
super.doSetUp();
sensingMessageProcessor = getSensingNullMessageProcessor();
List<Processor> processors = new ArrayList<>();
processors.add(new ResponseMessageProcessorAdapter(new StringAppendTransformer("f")));
processors.add(new ResponseMessageProcessorAdapter(new StringAppendTransformer("e")));
processors.add(new ResponseMessageProcessorAdapter(new StringAppendTransformer("d")));
processors.add(new StringAppendTransformer("a"));
processors.add(new StringAppendTransformer("b"));
processors.add(new StringAppendTransformer("c"));
processors.add(event -> CoreEvent.builder(event).addVariable("thread", currentThread()).build());
processors.add(sensingMessageProcessor);
flow = (DefaultFlow) Flow.builder(FLOW_NAME, muleContext).source(directInboundMessageSource).processors(processors).build();
stoppedFlow = (DefaultFlow) Flow.builder(FLOW_NAME, muleContext).source(directInboundMessageSource).processors(processors).initialState(INITIAL_STATE_STOPPED).build();
}
Aggregations