Search in sources :

Example 1 with RouterStatistics

use of org.mule.runtime.core.api.management.stats.RouterStatistics in project mule by mulesoft.

the class ChoiceRouterTestCase method testMatchingRouteWithStatistics.

@Test
public void testMatchingRouteWithStatistics() throws Exception {
    choiceRouter.addRoute(payloadZapExpression(), newChain(empty(), new TestMessageProcessor("bar")));
    choiceRouter.setRouterStatistics(new RouterStatistics(TYPE_OUTBOUND));
    choiceRouter.setMuleContext(muleContext);
    choiceRouter.initialise();
    assertThat(process(choiceRouter, zapEvent()).getMessage().getPayload().getValue(), is("zap:bar"));
}
Also used : RouterStatistics(org.mule.runtime.core.api.management.stats.RouterStatistics) TestMessageProcessor(org.mule.tck.testmodels.mule.TestMessageProcessor) Test(org.junit.Test)

Example 2 with RouterStatistics

use of org.mule.runtime.core.api.management.stats.RouterStatistics in project mule by mulesoft.

the class ChoiceRouterTestCase method testAddAndDeleteRoute.

@Test
public void testAddAndDeleteRoute() throws Exception {
    MessageProcessorChain mp = newChain(empty(), new TestMessageProcessor("bar"));
    choiceRouter.addRoute(payloadZapExpression(), mp);
    choiceRouter.removeRoute(mp);
    choiceRouter.setRouterStatistics(new RouterStatistics(TYPE_OUTBOUND));
    choiceRouter.setMuleContext(muleContext);
    choiceRouter.initialise();
    CoreEvent inputEvent = zapEvent();
    assertThat(process(choiceRouter, inputEvent), is(inputEvent));
}
Also used : MessageProcessorChain(org.mule.runtime.core.privileged.processor.chain.MessageProcessorChain) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) RouterStatistics(org.mule.runtime.core.api.management.stats.RouterStatistics) TestMessageProcessor(org.mule.tck.testmodels.mule.TestMessageProcessor) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 RouterStatistics (org.mule.runtime.core.api.management.stats.RouterStatistics)2 TestMessageProcessor (org.mule.tck.testmodels.mule.TestMessageProcessor)2 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)1 MessageProcessorChain (org.mule.runtime.core.privileged.processor.chain.MessageProcessorChain)1