Author: ningjiang
Date: Thu Feb 12 14:59:47 2009
New Revision: 743773
URL: http://svn.apache.org/viewvc?rev=743773&view=rev
Log:
Updated the choice unit test
Modified:
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ChoiceTest.java
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/choice.xml
Modified:
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ChoiceTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ChoiceTest.java?rev=743773&r1=743772&r2=743773&view=diff
==============================================================================
---
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ChoiceTest.java
(original)
+++
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ChoiceTest.java
Thu Feb 12 14:59:47 2009
@@ -28,10 +28,12 @@
protected MockEndpoint x;
protected MockEndpoint y;
protected MockEndpoint z;
+ protected MockEndpoint end;
public void testSendToFirstWhen() throws Exception {
String body = "<one/>";
x.expectedBodiesReceived(body);
+ end.expectedBodiesReceived(body);
// The SpringChoiceTest.java can't setup the header by Spring
configure file
// x.expectedHeaderReceived("name", "a");
expectsMessageCount(0, y, z);
@@ -44,6 +46,7 @@
public void testSendToSecondWhen() throws Exception {
String body = "<two/>";
y.expectedBodiesReceived(body);
+ end.expectedBodiesReceived(body);
expectsMessageCount(0, x, z);
sendMessage("cheese", body);
@@ -54,6 +57,7 @@
public void testSendToOtherwiseClause() throws Exception {
String body = "<three/>";
z.expectedBodiesReceived(body);
+ end.expectedBodiesReceived(body);
expectsMessageCount(0, x, y);
sendMessage("somethingUndefined", body);
@@ -72,6 +76,7 @@
x = getMockEndpoint("mock:x");
y = getMockEndpoint("mock:y");
z = getMockEndpoint("mock:z");
+ end = getMockEndpoint("mock:end");
}
protected RouteBuilder createRouteBuilder() {
@@ -80,7 +85,7 @@
from("direct:start").choice()
.when().xpath("$foo = 'bar'").to("mock:x")
.when().xpath("$foo = 'cheese'").to("mock:y")
- .otherwise().to("mock:z");
+ .otherwise().to("mock:z").end().to("mock:end");
}
};
}
Modified:
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/choice.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/choice.xml?rev=743773&r1=743772&r2=743773&view=diff
==============================================================================
---
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/choice.xml
(original)
+++
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/choice.xml
Thu Feb 12 14:59:47 2009
@@ -39,6 +39,7 @@
<to uri="mock:z"/>
</otherwise>
</choice>
+ <to uri="mock:end"/>
</route>
</camelContext>
<!-- END SNIPPET: example -->