Author: davsclaus
Date: Sun Jul 13 09:32:17 2008
New Revision: 676352
URL: http://svn.apache.org/viewvc?rev=676352&view=rev
Log:
CAMEL-719: Ah wrong SimulatorTest failing on Bamboo - this is a copy from
camel-core that is in camel-juel also - Well gotta get some stronger glasses ;)
Or give up on the beers ..... no never!
Modified:
activemq/camel/trunk/components/camel-juel/src/test/java/org/apache/camel/processor/juel/SimulatorTest.java
Modified:
activemq/camel/trunk/components/camel-juel/src/test/java/org/apache/camel/processor/juel/SimulatorTest.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-juel/src/test/java/org/apache/camel/processor/juel/SimulatorTest.java?rev=676352&r1=676351&r2=676352&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-juel/src/test/java/org/apache/camel/processor/juel/SimulatorTest.java
(original)
+++
activemq/camel/trunk/components/camel-juel/src/test/java/org/apache/camel/processor/juel/SimulatorTest.java
Sun Jul 13 09:32:17 2008
@@ -16,6 +16,7 @@
*/
package org.apache.camel.processor.juel;
+import javax.naming.Context;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
@@ -23,21 +24,28 @@
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.util.ExchangeHelper;
-
import static org.apache.camel.language.juel.JuelExpression.el;
+import org.apache.camel.util.ExchangeHelper;
+import org.apache.camel.util.jndi.JndiContext;
/**
* @version $Revision$
*/
public class SimulatorTest extends ContextTestSupport {
+ protected Context createJndiContext() throws Exception {
+ JndiContext answer = new JndiContext();
+ answer.bind("foo", new MyBean("foo"));
+ answer.bind("bar", new MyBean("bar"));
+ return answer;
+ }
+
public void testReceivesFooResponse() throws Exception {
- assertRespondsWith("foo", "fooResponse");
+ assertRespondsWith("foo", "Bye said foo");
}
public void testReceivesBarResponse() throws Exception {
- assertRespondsWith("bar", "barResponse");
+ assertRespondsWith("bar", "Bye said bar");
}
protected void assertRespondsWith(final String value, String
containedText) throws InvalidPayloadException {
@@ -52,7 +60,6 @@
assertNotNull("Should receive a response!", response);
String text = ExchangeHelper.getMandatoryOutBody(response,
String.class);
- log.info("Received: " + text);
assertStringContains(text, containedText);
}
@@ -61,9 +68,22 @@
public void configure() {
// START SNIPPET: example
from("direct:a").
-
recipientList(el("file:src/test/data/${in.headers.cheese}.xml"));
+ recipientList(el("bean:${in.headers.cheese}"));
// END SNIPPET: example
}
};
}
+
+ public static class MyBean {
+ private String value;
+
+ public MyBean(String value) {
+ this.value = value;
+ }
+
+ public String doSomething(String in) {
+ return "Bye said " + value;
+ }
+ }
+
}
\ No newline at end of file