You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/06/05 08:53:56 UTC
svn commit: r781928 - in /camel/branches/camel-1.x: ./
camel-core/src/test/java/org/apache/camel/issues/SplitWithCustomAggregationStrategyTest.java
Author: davsclaus
Date: Fri Jun 5 06:53:55 2009
New Revision: 781928
URL: http://svn.apache.org/viewvc?rev=781928&view=rev
Log:
Merged revisions 781923 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
........
r781923 | davsclaus | 2009-06-05 08:42:31 +0200 (Fri, 05 Jun 2009) | 1 line
Added unit test based on user forum trouble with splitter.
........
Added:
camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/issues/SplitWithCustomAggregationStrategyTest.java (with props)
Modified:
camel/branches/camel-1.x/ (props changed)
Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun 5 06:53:55 2009
@@ -1 +1 @@
-/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749936,749956,750017,750334,750396,750761,750796,752068,752117,752418,752751-752755,752764-752773,752956,753087,753101,753175,755136,755487,756313,756348,756870,756939,757636,757693,757743,757865,758539,758563,758600,758617,758692,758990,759362,759453,759887,759931,760003,760890,760909,760937,761194,761536,761583,761607,762047,762633,762650,762935,763095,763484,763551,765154,765686,765729,765743,765824,766016,766289,766584,766588,766590,766602,766673,767403,767824,768342,769239,769346,769368,769434,770172,770906,771303,773193,773446,773781,774192,774383,774658-774659,776198,776289,776504,776975,778102,778689-778701,779121,779143,779489,781775
+/camel/trunk:736980,739733,739904,740251,740295,740306,740596,740663,741848,742231,742705,742739,742854,742856,742898,742906,743613,743762,743773,743920,743959-743960,744123,745105,745367,745541,745751,745826,745978,746269,746872,746895,746962,747258,747678-747704,748392,748436,748821,749563-749564,749574,749628-749629,749936,749956,750017,750334,750396,750761,750796,752068,752117,752418,752751-752755,752764-752773,752956,753087,753101,753175,755136,755487,756313,756348,756870,756939,757636,757693,757743,757865,758539,758563,758600,758617,758692,758990,759362,759453,759887,759931,760003,760890,760909,760937,761194,761536,761583,761607,762047,762633,762650,762935,763095,763484,763551,765154,765686,765729,765743,765824,766016,766289,766584,766588,766590,766602,766673,767403,767824,768342,769239,769346,769368,769434,770172,770906,771303,773193,773446,773781,774192,774383,774658-774659,776198,776289,776504,776975,778102,778689-778701,779121,779143,779489,781775,781923
Propchange: camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Added: camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/issues/SplitWithCustomAggregationStrategyTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/issues/SplitWithCustomAggregationStrategyTest.java?rev=781928&view=auto
==============================================================================
--- camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/issues/SplitWithCustomAggregationStrategyTest.java (added)
+++ camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/issues/SplitWithCustomAggregationStrategyTest.java Fri Jun 5 06:53:55 2009
@@ -0,0 +1,83 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.issues;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.processor.aggregate.AggregationStrategy;
+import static org.apache.camel.builder.xml.XPathBuilder.xpath;
+
+/**
+ * @version $Revision$
+ */
+public class SplitWithCustomAggregationStrategyTest extends ContextTestSupport {
+
+ public void testSplitWithCustomAggregatorStrategy() throws Exception {
+ int files = 10;
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(files);
+ // no duplicates should be received
+ mock.expectsNoDuplicates(body());
+
+ for (int i = 0; i < files; i++) {
+ template.sendBody("direct:start", "");
+ }
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start").
+ setBody().simple("<search><key>foo-${id}</key><key>bar-${id}</key><key>baz-${id}</key></search>").
+ to("direct:splitInOut").
+ to("mock:result");
+
+ //
+ // Need an inOut splitter that aggregates all results together.
+ //
+ from("direct:splitInOut").
+ setHeader("com.example.id").simple("${id}").
+ splitter(xpath("/search/key"), new AggregationStrategy() {
+ public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
+ if (oldExchange == null) {
+ return newExchange;
+ }
+
+ String oldBody = oldExchange.getOut().getBody(String.class);
+ String newBody = newExchange.getOut().getBody(String.class);
+ oldExchange.getOut().setBody(oldBody + newBody);
+
+ return oldExchange;
+ }
+ }).parallelProcessing().streaming().
+ to("direct:processLine").
+ end().
+ transform().simple("<results>${in.body}</results>");
+
+ from("direct:processLine").
+ to("log:line").
+ transform().simple("<index>${in.header.org.apache.camel.splitCounter}</index>${in.body}");
+ }
+ };
+ }
+}
Propchange: camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/issues/SplitWithCustomAggregationStrategyTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/issues/SplitWithCustomAggregationStrategyTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date