camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/3] camel git commit: Implemented 2 tests showing issues in BeanInfo
Date Wed, 05 Jul 2017 08:34:21 GMT
Implemented 2 tests showing issues in BeanInfo


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

Branch: refs/heads/master
Commit: 7376cc40a72da1b0574e149b8e6cd44e5805aa6e
Parents: 12f9de9
Author: aldettinger <aldettinger@gmail.com>
Authored: Thu Jun 29 18:26:48 2017 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Jul 5 09:41:43 2017 +0200

----------------------------------------------------------------------
 .../camel/component/bean/BeanInfoTest.java      | 55 +++++++++++++++++++-
 1 file changed, 54 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7376cc40/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java b/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java
index b541345..84d3fde 100644
--- a/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.bean;
 
 import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 import java.util.List;
 
 import junit.framework.TestCase;
@@ -26,11 +27,12 @@ import org.apache.camel.InOnly;
 import org.apache.camel.InOut;
 import org.apache.camel.Pattern;
 import org.apache.camel.impl.DefaultCamelContext;
+import org.junit.Assert;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * @version 
+ * @version
  */
 public class BeanInfoTest extends TestCase {
     private static final Logger LOG = LoggerFactory.getLogger(BeanInfoTest.class);
@@ -112,6 +114,30 @@ public class BeanInfoTest extends TestCase {
         assertMethodPattern(info, "inOutMethod", ExchangePattern.InOut);
     }
 
+    public void testImplementLevel2InterfaceMethodInPackagePrivateClass() {
+        BeanInfo info = createBeanInfo(PackagePrivateClassImplementingLevel2InterfaceMethod.class);
+        List<MethodInfo> mis = info.getMethods();
+        Assert.assertNotNull(mis);
+        Assert.assertEquals(1, mis.size());
+        MethodInfo mi = mis.get(0);
+        Assert.assertNotNull(mi);
+        Method m = mi.getMethod();
+        Assert.assertEquals("method", m.getName());
+        Assert.assertTrue(Modifier.isPublic(m.getDeclaringClass().getModifiers()));
+    }
+
+    public void testPublicClassImplementingInterfaceMethodBySuperPackagePrivateClass() {
+        BeanInfo info = createBeanInfo(PublicClassImplementingBySuperPackagePrivateClass.class);
+        List<MethodInfo> mis = info.getMethods();
+        Assert.assertNotNull(mis);
+        Assert.assertEquals(1, mis.size());
+        MethodInfo mi = mis.get(0);
+        Assert.assertNotNull(mi);
+        Method m = mi.getMethod();
+        Assert.assertEquals("method", m.getName());
+        Assert.assertTrue(Modifier.isPublic(m.getDeclaringClass().getModifiers()));
+    }
+
     protected BeanInfo createBeanInfo(Class<?> type) {
         BeanInfo info = new BeanInfo(camelContext, type);
         return info;
@@ -185,4 +211,31 @@ public class BeanInfoTest extends TestCase {
         }
     }
 
+    public interface ILevel2Interface {
+        String method();
+    }
+
+    public interface ILevel1Interface extends ILevel2Interface {
+    }
+
+    class PackagePrivateClassImplementingLevel2InterfaceMethod implements ILevel1Interface
{
+        @Override
+        public String method() {
+            return "PackagePrivateClassImplementingLevel2InterfaceMethod.method() has been
called";
+        }
+    }
+
+    public interface IMethodInterface {
+        String method();
+    }
+
+    class PackagePrivateClassDefiningMethod {
+        public String method() {
+            return "PackagePrivateClassDefiningMethod.method() has been called";
+        }
+    }
+
+    public class PublicClassImplementingBySuperPackagePrivateClass extends PackagePrivateClassDefiningMethod
implements IMethodInterface {
+    }
+
 }


Mime
View raw message