camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/3] camel git commit: CAMEL-9032: Bean component - Should filter out abstract methods
Date Wed, 29 Jul 2015 09:07:00 GMT
Repository: camel
Updated Branches:
  refs/heads/master b671ac5d7 -> 108d94f72


CAMEL-9032: Bean component - Should filter out abstract methods


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f1879996
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f1879996
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f1879996

Branch: refs/heads/master
Commit: f18799963ec1c96c270e6f5f79365cfebe7f1735
Parents: b671ac5
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Jul 29 10:11:08 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Jul 29 10:11:08 2015 +0200

----------------------------------------------------------------------
 .../apache/camel/component/bean/BeanInfo.java   |  5 +++
 .../bean/issues/BaseFoundationClass.java        | 23 +++++++++++
 .../component/bean/issues/BaseSomething.java    | 22 ++++++++++
 .../issues/BeanAbstractMethodIssueTest.java     | 43 ++++++++++++++++++++
 .../component/bean/issues/RealSomething.java    | 25 ++++++++++++
 5 files changed, 118 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f1879996/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java b/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
index 67a0893..1b34622 100644
--- a/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
+++ b/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
@@ -831,6 +831,11 @@ public class BeanInfo {
             return false;
         }
 
+        // must not be abstract
+        if (Modifier.isAbstract(method.getModifiers())) {
+            return false;
+        }
+
         // return type must not be an Exchange and it should not be a bridge method
         if ((method.getReturnType() != null && Exchange.class.isAssignableFrom(method.getReturnType()))
|| method.isBridge()) {
             return false;

http://git-wip-us.apache.org/repos/asf/camel/blob/f1879996/camel-core/src/test/java/org/apache/camel/component/bean/issues/BaseFoundationClass.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/issues/BaseFoundationClass.java
b/camel-core/src/test/java/org/apache/camel/component/bean/issues/BaseFoundationClass.java
new file mode 100644
index 0000000..a143e54
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/issues/BaseFoundationClass.java
@@ -0,0 +1,23 @@
+/**
+ * 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.issues;
+
+public abstract class BaseFoundationClass {
+
+    public abstract Object doSomething(String name);
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/f1879996/camel-core/src/test/java/org/apache/camel/component/bean/issues/BaseSomething.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/issues/BaseSomething.java
b/camel-core/src/test/java/org/apache/camel/component/bean/issues/BaseSomething.java
new file mode 100644
index 0000000..545679c
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/issues/BaseSomething.java
@@ -0,0 +1,22 @@
+/**
+ * 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.issues;
+
+public abstract class BaseSomething extends BaseFoundationClass {
+
+    public abstract Long doSomething(String name);
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/f1879996/camel-core/src/test/java/org/apache/camel/component/bean/issues/BeanAbstractMethodIssueTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/issues/BeanAbstractMethodIssueTest.java
b/camel-core/src/test/java/org/apache/camel/component/bean/issues/BeanAbstractMethodIssueTest.java
new file mode 100644
index 0000000..7c0430c
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/issues/BeanAbstractMethodIssueTest.java
@@ -0,0 +1,43 @@
+/**
+ * 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.issues;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+
+public class BeanAbstractMethodIssueTest extends ContextTestSupport {
+
+    public void testAbstractMethod() throws Exception {
+        getMockEndpoint("mock:123").expectedMessageCount(1);
+
+        template.sendBody("direct:start", new RealSomething());
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                        .filter().simple("${body.doSomething} == 123").to("mock:123");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/f1879996/camel-core/src/test/java/org/apache/camel/component/bean/issues/RealSomething.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/issues/RealSomething.java
b/camel-core/src/test/java/org/apache/camel/component/bean/issues/RealSomething.java
new file mode 100644
index 0000000..c89b4f7
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/issues/RealSomething.java
@@ -0,0 +1,25 @@
+/**
+ * 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.issues;
+
+public class RealSomething extends BaseSomething {
+
+    @Override
+    public Long doSomething(String name) {
+        return 123L;
+    }
+}


Mime
View raw message