Author: jstrachan
Date: Wed Dec 3 07:37:58 2008
New Revision: 722934
URL: http://svn.apache.org/viewvc?rev=722934&view=rev
Log:
added an OGNL filter test case from
http://www.nabble.com/Endpoint-decision-based-on-Header-Value-with-XML-configuration-tp20811772s22882p20813924.html
Added:
activemq/camel/trunk/components/camel-ognl/src/test/java/org/apache/camel/language/ognl/patterns/
activemq/camel/trunk/components/camel-ognl/src/test/java/org/apache/camel/language/ognl/patterns/FilterTest.java
(with props)
activemq/camel/trunk/components/camel-ognl/src/test/resources/jndi.properties
(with props)
Modified:
activemq/camel/trunk/components/camel-ognl/pom.xml
activemq/camel/trunk/pom.xml
Modified: activemq/camel/trunk/components/camel-ognl/pom.xml
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ognl/pom.xml?rev=722934&r1=722933&r2=722934&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ognl/pom.xml (original)
+++ activemq/camel/trunk/components/camel-ognl/pom.xml Wed Dec 3 07:37:58 2008
@@ -57,6 +57,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<scope>test</scope>
Added:
activemq/camel/trunk/components/camel-ognl/src/test/java/org/apache/camel/language/ognl/patterns/FilterTest.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ognl/src/test/java/org/apache/camel/language/ognl/patterns/FilterTest.java?rev=722934&view=auto
==============================================================================
---
activemq/camel/trunk/components/camel-ognl/src/test/java/org/apache/camel/language/ognl/patterns/FilterTest.java
(added)
+++
activemq/camel/trunk/components/camel-ognl/src/test/java/org/apache/camel/language/ognl/patterns/FilterTest.java
Wed Dec 3 07:37:58 2008
@@ -0,0 +1,66 @@
+/**
+ *
+ * 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.language.ognl.patterns;
+
+import org.apache.camel.test.CamelTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class FilterTest extends CamelTestSupport {
+
+ @EndpointInject(uri="mock:result")
+ protected MockEndpoint resultEndpoint;
+
+ @Produce(uri="direct:start")
+ protected ProducerTemplate template;
+
+ public void testSendMatchingMessage() throws Exception {
+ String expectedBody = "<matched/>";
+
+ resultEndpoint.expectedBodiesReceived(expectedBody);
+
+ template.sendBodyAndHeader(expectedBody, "foo", "bar");
+
+ resultEndpoint.assertIsSatisfied();
+ }
+
+ public void testSendNotMatchingMessage() throws Exception {
+ resultEndpoint.expectedMessageCount(0);
+
+ template.sendBodyAndHeader("<notMatched/>", "foo",
"notMatchedHeaderValue");
+
+ resultEndpoint.assertIsSatisfied();
+ }
+
+
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+ from("direct:start").
+ choice().when().ognl("request.headers.foo == 'bar'").
+ to("mock:result");
+ }
+ };
+ }
+}
\ No newline at end of file
Propchange:
activemq/camel/trunk/components/camel-ognl/src/test/java/org/apache/camel/language/ognl/patterns/FilterTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
activemq/camel/trunk/components/camel-ognl/src/test/resources/jndi.properties
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ognl/src/test/resources/jndi.properties?rev=722934&view=auto
==============================================================================
---
activemq/camel/trunk/components/camel-ognl/src/test/resources/jndi.properties
(added)
+++
activemq/camel/trunk/components/camel-ognl/src/test/resources/jndi.properties
Wed Dec 3 07:37:58 2008
@@ -0,0 +1,18 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+java.naming.factory.initial =
org.apache.camel.util.jndi.CamelInitialContextFactory
Propchange:
activemq/camel/trunk/components/camel-ognl/src/test/resources/jndi.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/camel/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/pom.xml?rev=722934&r1=722933&r2=722934&view=diff
==============================================================================
--- activemq/camel/trunk/pom.xml (original)
+++ activemq/camel/trunk/pom.xml Wed Dec 3 07:37:58 2008
@@ -410,6 +410,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-testng</artifactId>
<version>${project.version}</version>
</dependency>