So, I finished reproducing the situation:
My Test class looks like this:
public class CamelTest extends ContextTestSupport {
public void testSendMatchingMessage() throws Exception {
MockEndpoint resultEndpoint =
resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
resultEndpoint.expectedMessageCount(1);
template.sendBodyAndHeader("direct:start", "<matched/>", "foo",
"bar");
resultEndpoint.assertIsSatisfied();
}
public void testSendNotMatchingMessage() throws Exception {
MockEndpoint resultEndpoint =
resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
resultEndpoint.expectedMessageCount(0);
template.sendBodyAndHeader("direct:start", "<notMatched/>", "foo",
"notMatchedHeaderValue");
resultEndpoint.assertIsSatisfied();
}
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
from("direct:start").choice().when().ognl("request.header.foo =
'bar'").to("mock:result");
}
};
}
testSendNotMatchingMessage fails with trace:
java.lang.AssertionError: mock:result Received message count. Expected: <0>
but was: <1>
at
org.apache.camel.component.mock.MockEndpoint.fail(MockEndpoint.java:712)
at
org.apache.camel.component.mock.MockEndpoint.assertEquals(MockEndpoint.java:694)
at
org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:238)
at
org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:214)
at
ec.ep.epgreffe.il.epades.CamelTest.testSendNotMatchingMessage(CamelTest.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
I have added in my classpath ognl-2.6.9.jar as well.
packo wrote:
>
> Sorry for the late reply..I am trying to reproduce the issue with the test
> you gave me..
>
> I am using log4J, i am getting various warning for libraries missing, but
> ognl seems to be working properly. The following comes from the log files:
>
> .
> .
> DEBUG main org.apache.camel.management.DefaultInstrumentationAgent -
> Registered MBean with objectname:
> org.apache.camel:context=PRESBRUWSDW82/camel,type=processors,nodeid=choice2,name="Choice[[When[ognl{request.headers.foo
> = 'foo1} -> [To[bean:fooBean\?method=fooMethod1]]],
> When[ognl{request.headers.foo ='foo2'} ->
> [To[bean:fooBean\?method=fooMethod1]]]]]"
>
>
> And then later,
> .
> .
> DEBUG main
> org.springframework.beans.factory.support.DefaultListableBeanFactory -
> Creating instance of bean 'org.apache.camel.language.ognl.OgnlLanguage'
> DEBUG main
> org.springframework.beans.factory.support.DefaultListableBeanFactory -
> Finished creating instance of bean
> 'org.apache.camel.language.ognl.OgnlLanguage'
> .
> .
>
>
>
> James.Strachan wrote:
>>
>> 2008/12/3 packo <[EMAIL PROTECTED]>:
>>>
>>> I am using the full camel jar (apache-camel-1.5.0.jar), so i suppose
>>> that i
>>> would not need to add any more Jars.
>>
>> It includes all the camel code - but not the dependencies - for
>> example the ognl jar is not included.
>>
>>> Also, there is not exception thrown, the execution ends properly.
>>
>> I wonder if you get warnings? You using log4j?
>>
>> --
>> James
>> -------
>> http://macstrac.blogspot.com/
>>
>> Open Source Integration
>> http://fusesource.com/
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/Endpoint-decision-based-on-Header-Value-with-XML-configuration-tp20811772s22882p20813924.html
Sent from the Camel - Users mailing list archive at Nabble.com.