Search in sources :

Example 16 with Banana

use of org.mule.tck.testmodels.fruit.Banana in project mule by mulesoft.

the class AbstractSplitterTestCase method allFilteredSplitter.

@Test
public void allFilteredSplitter() throws Exception {
    TestSplitter splitter = new TestSplitter(true);
    splitter.setListener(event -> {
        throw new MessagingException(createStaticMessage("Expected"), event, splitter);
    });
    splitter.setMuleContext(muleContext);
    Apple apple = new Apple();
    Banana banana = new Banana();
    Orange orange = new Orange();
    FruitBowl fruitBowl = new FruitBowl();
    fruitBowl.addFruit(apple);
    fruitBowl.addFruit(banana);
    fruitBowl.addFruit(orange);
    final CoreEvent inEvent = eventBuilder(muleContext).message(of(fruitBowl)).build();
    CoreEvent resultEvent = splitter.process(inEvent);
    assertThat(resultEvent.getMessage().getPayload().getValue(), nullValue());
}
Also used : Apple(org.mule.tck.testmodels.fruit.Apple) FruitBowl(org.mule.tck.testmodels.fruit.FruitBowl) MessagingException(org.mule.runtime.core.internal.exception.MessagingException) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Orange(org.mule.tck.testmodels.fruit.Orange) Banana(org.mule.tck.testmodels.fruit.Banana) Test(org.junit.Test)

Example 17 with Banana

use of org.mule.tck.testmodels.fruit.Banana in project mule by mulesoft.

the class AbstractSplitterTestCase method failingNotFilteredSplitter.

@Test
public void failingNotFilteredSplitter() throws Exception {
    TestSplitter splitter = new TestSplitter(false);
    splitter.setListener(event -> {
        throw new MessagingException(createStaticMessage("Expected"), event, splitter);
    });
    splitter.setMuleContext(muleContext);
    Apple apple = new Apple();
    Banana banana = new Banana();
    Orange orange = new Orange();
    FruitBowl fruitBowl = new FruitBowl();
    fruitBowl.addFruit(apple);
    fruitBowl.addFruit(banana);
    fruitBowl.addFruit(orange);
    final CoreEvent inEvent = eventBuilder(muleContext).message(of(fruitBowl)).build();
    expected.expect(MessagingException.class);
    expected.expectMessage("Expected");
    splitter.process(inEvent);
}
Also used : Apple(org.mule.tck.testmodels.fruit.Apple) FruitBowl(org.mule.tck.testmodels.fruit.FruitBowl) MessagingException(org.mule.runtime.core.internal.exception.MessagingException) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) Orange(org.mule.tck.testmodels.fruit.Orange) Banana(org.mule.tck.testmodels.fruit.Banana) Test(org.junit.Test)

Aggregations

Banana (org.mule.tck.testmodels.fruit.Banana)17 Test (org.junit.Test)13 Apple (org.mule.tck.testmodels.fruit.Apple)7 SmallTest (org.mule.tck.size.SmallTest)6 Orange (org.mule.tck.testmodels.fruit.Orange)5 FruitBowl (org.mule.tck.testmodels.fruit.FruitBowl)4 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)3 MessagingException (org.mule.runtime.core.internal.exception.MessagingException)2 Fruit (org.mule.tck.testmodels.fruit.Fruit)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Before (org.junit.Before)1 ConnectionProvider (org.mule.runtime.api.connection.ConnectionProvider)1 Message (org.mule.runtime.api.message.Message)1 Latch (org.mule.runtime.api.util.concurrent.Latch)1 SimpleConfigurationBuilder (org.mule.runtime.core.api.config.builders.SimpleConfigurationBuilder)1 Transformer (org.mule.runtime.core.api.transformer.Transformer)1 TransformerException (org.mule.runtime.core.api.transformer.TransformerException)1 MuleContextWithRegistries (org.mule.runtime.core.internal.context.MuleContextWithRegistries)1