Author: davsclaus
Date: Sun Oct 18 09:17:36 2009
New Revision: 826380
URL: http://svn.apache.org/viewvc?rev=826380&view=rev
Log:
Added unit test
Added:
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanExplicitMethodTest.java
(with props)
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/MyOtherFooBean.java
(with props)
Added:
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanExplicitMethodTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanExplicitMethodTest.java?rev=826380&view=auto
==============================================================================
---
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanExplicitMethodTest.java
(added)
+++
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanExplicitMethodTest.java
Sun Oct 18 09:17:36 2009
@@ -0,0 +1,65 @@
+/**
+ * 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.component.bean;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.JndiRegistry;
+
+/**
+ * @version $Revision$
+ */
+public class BeanExplicitMethodTest extends ContextTestSupport {
+
+ @Override
+ protected JndiRegistry createRegistry() throws Exception {
+ JndiRegistry jndi = super.createRegistry();
+ jndi.bind("foo", new MyOtherFooBean());
+ return jndi;
+ }
+
+ public void testStringEcho() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedBodiesReceived("WorldWorld");
+
+ template.sendBody("direct:start", "World");
+
+ assertMockEndpointsSatisfied();
+ }
+
+ public void testIntegerEcho() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedBodiesReceived(25);
+
+ template.sendBody("direct:start", 5);
+
+ assertMockEndpointsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:start")
+ .beanRef("foo", "echo")
+ .to("mock:result");
+ }
+ };
+ }
+}
Propchange:
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanExplicitMethodTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanExplicitMethodTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/MyOtherFooBean.java
URL:
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/MyOtherFooBean.java?rev=826380&view=auto
==============================================================================
---
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/MyOtherFooBean.java
(added)
+++
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/MyOtherFooBean.java
Sun Oct 18 09:17:36 2009
@@ -0,0 +1,31 @@
+/**
+ * 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.component.bean;
+
+/**
+ * @version $Revision$
+ */
+public class MyOtherFooBean {
+
+ public String echo(String s) {
+ return s + s;
+ }
+
+ public Integer echo(Integer i) {
+ return i.intValue() * i.intValue();
+ }
+}
Propchange:
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/MyOtherFooBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/MyOtherFooBean.java
------------------------------------------------------------------------------
svn:keywords = Rev Date