Search in sources :

Example 6 with EvenOddCondition

use of com.adaptris.core.services.aggregator.MessageAggregatorTest.EvenOddCondition in project interlok by adaptris.

the class AppendinglMessageAggregatorTest method testAggregate_WithFilter.

@Test
public void testAggregate_WithFilter() throws Exception {
    AppendingMessageAggregator aggr = createAggregatorForTests();
    aggr.setFilterCondition(new EvenOddCondition());
    AdaptrisMessage original = AdaptrisMessageFactory.getDefaultInstance().newMessage("Goodbye");
    AdaptrisMessage splitMsg1 = AdaptrisMessageFactory.getDefaultInstance().newMessage(" Cruel ");
    AdaptrisMessage splitMsg2 = AdaptrisMessageFactory.getDefaultInstance().newMessage("World");
    aggr.joinMessage(original, Arrays.asList(new AdaptrisMessage[] { splitMsg1, splitMsg2 }));
    // First message was skipped, 2nd was merged.
    assertEquals("GoodbyeWorld", original.getContent());
}
Also used : EvenOddCondition(com.adaptris.core.services.aggregator.MessageAggregatorTest.EvenOddCondition) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Aggregations

EvenOddCondition (com.adaptris.core.services.aggregator.MessageAggregatorTest.EvenOddCondition)6 Test (org.junit.Test)6 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)5 AdaptrisMessageFactory (com.adaptris.core.AdaptrisMessageFactory)2 PooledSplitJoinService (com.adaptris.core.services.splitter.PooledSplitJoinService)2 TimeInterval (com.adaptris.util.TimeInterval)2 InsertNode (com.adaptris.util.text.xml.InsertNode)2 XPath (com.adaptris.util.text.xml.XPath)2 NullService (com.adaptris.core.NullService)1 LineCountSplitter (com.adaptris.core.services.splitter.LineCountSplitter)1 XpathMessageSplitter (com.adaptris.core.services.splitter.XpathMessageSplitter)1 BodyPartIterator (com.adaptris.util.text.mime.BodyPartIterator)1 Document (org.w3c.dom.Document)1