Splitter extends DelegateProcessor { public Splitter aggregate(AggregationStrategy strategy) { aggregationStrategy = strategy != null ? strategy : DEFAULT_AGGREGATION_STRATEGY; return this; } Splitter(Expression splitRule, Processor processor); Splitter aggregate(AggregationStrategy strategy);  }
@Test public void testResetToDefaults() throws Exception { splitter.aggregate(null); Exchange origExchange = createTestExchange(); origExchange.getIn().setBody("bla,blu"); splitter.process(origExchange); List<Exchange> received = dest.getReceived(); assertEquals(2, received.size()); assertEquals("bla", getContent(received.get(0))); assertEquals("blu", getContent(received.get(1))); assertEquals("blu", origExchange.getOut().getBody()); }
@Test public void testSplitRuleWithArrayResult() throws Exception { Exchange origExchange = createTestExchange(); origExchange.getIn().setBody("bla,blu"); Splitter splitterWithArrayResult = new Splitter(new Expression() { @Override public <T> T evaluate(Exchange exchange, Class<T> type) { return type.cast(getContent(exchange).split(",")); }}, dest); splitterWithArrayResult.aggregate(new TestAggregationStrategy()); splitterWithArrayResult.process(origExchange); List<Exchange> received = dest.getReceived(); assertEquals(2, received.size()); assertEquals("bla", getContent(received.get(0))); assertEquals("blu", getContent(received.get(1))); assertEquals("bla:blu", origExchange.getOut().getBody()); }