CAMEL-10396: Corrected a bug where BeanInfo was missing a method overload
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ec7ffa11 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ec7ffa11 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ec7ffa11 Branch: refs/heads/master Commit: ec7ffa11a02c6e13cacd9c3fc48de34bc6c9dee4 Parents: 41ea7c7 Author: aldettinger <[email protected]> Authored: Sat Feb 18 16:27:31 2017 +0100 Committer: Claus Ibsen <[email protected]> Committed: Sun Feb 19 10:03:36 2017 +0100 ---------------------------------------------------------------------- .../BeanInfoOverloadedWithSubTypeParamTest.java | 51 ++++++++++++++++++++ .../BeanOverloadsWithAssignableParamTest.java | 41 ++++++++++++++++ 2 files changed, 92 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/ec7ffa11/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoOverloadedWithSubTypeParamTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoOverloadedWithSubTypeParamTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoOverloadedWithSubTypeParamTest.java new file mode 100644 index 0000000..d0714d6 --- /dev/null +++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoOverloadedWithSubTypeParamTest.java @@ -0,0 +1,51 @@ +/** + * 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.junit.Assert; + +/** + * @version + */ +public class BeanInfoOverloadedWithSubTypeParamTest extends ContextTestSupport { + + public void testBeanInfoOverloadedWithSubTypedParam() { + BeanInfo beanInfo = new BeanInfo(context, Bean.class); + Assert.assertEquals(3, beanInfo.getMethods().size()); + } + + class Bean { + public void doSomething(RequestA request) { + } + + public void doSomething(RequestB request) { + } + + public void doSomething(RequestC request) { + } + } + + class RequestA { + } + + class RequestB { + } + + class RequestC extends RequestB { + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/ec7ffa11/camel-core/src/test/java/org/apache/camel/component/bean/BeanOverloadsWithAssignableParamTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanOverloadsWithAssignableParamTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanOverloadsWithAssignableParamTest.java new file mode 100644 index 0000000..ad13a27 --- /dev/null +++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanOverloadsWithAssignableParamTest.java @@ -0,0 +1,41 @@ +/** + * 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; + +public class BeanOverloadsWithAssignableParamTest extends ContextTestSupport { + + public void testToStringWithStringParam() throws Exception { + MockEndpoint mock = getMockEndpoint("mock:stringParamResult"); + mock.expectedBodiesReceived("toString(String) was called"); + template.sendBody("direct:stringParam", ""); + assertMockEndpointsSatisfied(); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:stringParam").bean(new MyOtherFooBean(), "toString(String)").to("mock:stringParamResult"); + } + }; + } +}
