From 040be91d3a35d713d4c8f6348555601761450f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?y=C3=AC=20j=C3=AD?= Date: Wed, 18 Jul 2018 10:42:04 +0800 Subject: [PATCH] [Dubbo - unit test coverage] dubbo-common Unit test coverage (#2094) * add new unit tests * add ClassUtilsTest. * add ExtensionLoaderTest. * add bytecode unit tests. --- .../beanutil/JavaBeanSerializeUtil.java | 2 +- .../dubbo/common/bytecode/ClassGenerator.java | 18 +- .../common/compiler/support/ClassUtils.java | 14 +- .../common/extension/ExtensionLoader.java | 1 + .../common/beanutil/JavaBeanAccessorTest.java | 37 ++ .../beanutil/JavaBeanSerializeUtilTest.java | 324 +++++++++++------- .../common/bytecode/ClassGeneratorTest.java | 36 ++ .../dubbo/common/bytecode/MixinTest.java | 3 + .../dubbo/common/bytecode/ProxyTest.java | 2 + .../dubbo/common/bytecode/WrapperTest.java | 48 +++ .../support/AdaptiveCompilerTest.java | 33 ++ .../compiler/support/ClassUtilsTest.java | 180 ++++++++++ .../common/compiler/support/HelloService.java | 23 ++ .../compiler/support/HelloServiceImpl0.java | 24 ++ .../common/compiler/support/JavaCodeTest.java | 101 ++++++ .../support/JavassistCompilerTest.java | 74 ++++ .../compiler/support/JdkCompilerTest.java | 30 +- .../internal/HelloServiceInternalImpl.java | 20 ++ .../ExtensionLoaderTest.java | 79 +++-- .../ExtensionLoader_Adaptive_Test.java | 41 ++- ...onLoader_Adaptive_UseJdkCompiler_Test.java | 2 +- .../ExtensionLoader_Compatible_Test.java | 9 +- .../NoSpiExt.java | 3 +- .../activate/ActivateExt1.java | 2 +- .../activate/impl/ActivateExt1Impl1.java | 4 +- .../activate/impl/GroupActivateExtImpl.java | 4 +- .../activate/impl/OrderActivateExtImpl1.java | 4 +- .../activate/impl/OrderActivateExtImpl2.java | 4 +- .../activate/impl/ValueActivateExtImpl.java | 4 +- .../adaptive/HasAdaptiveExt.java | 2 +- .../adaptive/impl/HasAdaptiveExtImpl1.java | 4 +- .../impl/HasAdaptiveExt_ManualAdaptive.java | 4 +- .../compatible/CompatibleExt.java | 2 +- .../compatible/impl/CompatibleExtImpl1.java | 4 +- .../compatible/impl/CompatibleExtImpl2.java | 4 +- .../ext1/SimpleExt.java | 2 +- .../ext1/impl/SimpleExtImpl1.java | 4 +- .../ext1/impl/SimpleExtImpl2.java | 4 +- .../ext1/impl/SimpleExtImpl3.java | 4 +- .../ext2/Ext2.java | 64 ++-- .../ext2/UrlHolder.java | 2 +- .../ext2/impl/Ext2Impl1.java | 60 ++-- .../ext2/impl/Ext2Impl2.java | 62 ++-- .../ext2/impl/Ext2Impl3.java | 62 ++-- .../ext3/UseProtocolKeyExt.java | 2 +- .../ext3/impl/UseProtocolKeyExtImpl1.java | 4 +- .../ext3/impl/UseProtocolKeyExtImpl2.java | 4 +- .../ext3/impl/UseProtocolKeyExtImpl3.java | 4 +- .../ext4/NoUrlParamExt.java | 2 +- .../ext4/impl/Ext4Impl1.java | 52 +-- .../ext4/impl/Ext4Impl2.java | 54 +-- .../ext5/NoAdaptiveMethodExt.java | 2 +- .../ext5/impl/Ext5Impl1.java | 4 +- .../ext5/impl/Ext5Impl2.java | 4 +- .../ext6_inject/Dao.java | 2 +- .../ext6_inject/Ext6.java | 58 ++-- .../ext6_inject/impl/DaoImpl.java | 4 +- .../ext6_inject/impl/Ext6Impl1.java | 86 ++--- .../ext6_inject/impl/Ext6Impl2.java | 4 +- .../ext6_wrap/WrappedExt.java | 2 +- .../ext6_wrap/impl/Ext5Impl1.java | 4 +- .../ext6_wrap/impl/Ext5Impl2.java | 4 +- .../ext6_wrap/impl/Ext5Wrapper1.java | 4 +- .../ext6_wrap/impl/Ext5Wrapper2.java | 4 +- .../ext7/InitErrorExt.java | 2 +- .../ext7/impl/Ext7Impl.java | 4 +- .../ext7/impl/Ext7InitErrorImpl.java | 4 +- .../ext8_add/AddExt1.java | 2 +- .../ext8_add/AddExt2.java | 2 +- .../ext8_add/AddExt3.java | 2 +- .../ext8_add/AddExt4.java | 2 +- .../ext8_add/impl/AddExt1Impl1.java | 4 +- .../ext8_add/impl/AddExt1_ManualAdaptive.java | 4 +- .../ext8_add/impl/AddExt1_ManualAdd1.java | 4 +- .../ext8_add/impl/AddExt1_ManualAdd2.java | 4 +- .../ext8_add/impl/AddExt2Impl1.java | 4 +- .../ext8_add/impl/AddExt2_ManualAdaptive.java | 4 +- .../ext8_add/impl/AddExt3_ManualAdaptive.java | 4 +- .../ext8_add/impl/AddExt4_ManualAdaptive.java | 4 +- .../ext9_empty/Ext9Empty.java | 2 +- .../ext9_empty/impl/Ext9EmptyImpl.java | 4 +- .../support/ActivateComparatorTest.java | 48 +++ .../common/extension/support/Filter0.java | 23 ++ .../common/extension/support/Filter1.java | 23 ++ .../common/extension/support/Filter2.java | 23 ++ .../common/extension/support/Filter3.java | 23 ++ .../common/extension/support/Filter4.java | 23 ++ ...bbo.common.extension.activate.ActivateExt1 | 4 + ...o.common.extension.adaptive.HasAdaptiveExt | 2 + ....common.extension.compatible.CompatibleExt | 2 + ...ache.dubbo.common.extension.ext1.SimpleExt | 4 + ...rg.apache.dubbo.common.extension.ext2.Ext2 | 3 + ...bo.common.extension.ext3.UseProtocolKeyExt | 3 + ....dubbo.common.extension.ext4.NoUrlParamExt | 2 + ....common.extension.ext5.NoAdaptiveMethodExt | 2 + ...he.dubbo.common.extension.ext6_inject.Ext6 | 2 + ...ubbo.common.extension.ext6_wrap.WrappedExt | 4 + ...e.dubbo.common.extension.ext7.InitErrorExt | 2 + ...he.dubbo.common.extension.ext8_add.AddExt1 | 1 + ...bbo.common.extension.ext9_empty.Ext9Empty} | 0 ...che.dubbo.common.extension.support.Filter0 | 4 + ...mmon.extensionloader.activate.ActivateExt1 | 4 - ...on.extensionloader.adaptive.HasAdaptiveExt | 2 - ...n.extensionloader.compatible.CompatibleExt | 2 - ...ubbo.common.extensionloader.ext1.SimpleExt | 4 - ...che.dubbo.common.extensionloader.ext2.Ext2 | 3 - ...mon.extensionloader.ext3.UseProtocolKeyExt | 3 - ....common.extensionloader.ext4.NoUrlParamExt | 2 - ...n.extensionloader.ext5.NoAdaptiveMethodExt | 2 - ...bo.common.extensionloader.ext6_inject.Ext6 | 2 - ...ommon.extensionloader.ext6_wrap.WrappedExt | 4 - ...o.common.extensionloader.ext7.InitErrorExt | 2 - ...bo.common.extensionloader.ext8_add.AddExt1 | 1 - ...bbo.common.extension.activate.ActivateExt1 | 1 + ...mmon.extensionloader.activate.ActivateExt1 | 1 - 115 files changed, 1438 insertions(+), 563 deletions(-) create mode 100644 dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanAccessorTest.java create mode 100644 dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/AdaptiveCompilerTest.java create mode 100644 dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/ClassUtilsTest.java create mode 100644 dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/HelloService.java create mode 100644 dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/HelloServiceImpl0.java create mode 100644 dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavaCodeTest.java create mode 100644 dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavassistCompilerTest.java create mode 100644 dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/internal/HelloServiceInternalImpl.java rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ExtensionLoaderTest.java (85%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ExtensionLoader_Adaptive_Test.java (86%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ExtensionLoader_Adaptive_UseJdkCompiler_Test.java (96%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ExtensionLoader_Compatible_Test.java (78%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/NoSpiExt.java (90%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/activate/ActivateExt1.java (94%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/activate/impl/ActivateExt1Impl1.java (88%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/activate/impl/GroupActivateExtImpl.java (88%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/activate/impl/OrderActivateExtImpl1.java (88%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/activate/impl/OrderActivateExtImpl2.java (88%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/activate/impl/ValueActivateExtImpl.java (88%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/adaptive/HasAdaptiveExt.java (94%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/adaptive/impl/HasAdaptiveExtImpl1.java (88%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/adaptive/impl/HasAdaptiveExt_ManualAdaptive.java (90%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/compatible/CompatibleExt.java (94%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/compatible/impl/CompatibleExtImpl1.java (89%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/compatible/impl/CompatibleExtImpl2.java (89%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext1/SimpleExt.java (95%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext1/impl/SimpleExtImpl1.java (90%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext1/impl/SimpleExtImpl2.java (90%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext1/impl/SimpleExtImpl3.java (90%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext2/Ext2.java (93%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext2/UrlHolder.java (96%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext2/impl/Ext2Impl1.java (83%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext2/impl/Ext2Impl2.java (83%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext2/impl/Ext2Impl3.java (83%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext3/UseProtocolKeyExt.java (95%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext3/impl/UseProtocolKeyExtImpl1.java (89%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext3/impl/UseProtocolKeyExtImpl2.java (89%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext3/impl/UseProtocolKeyExtImpl3.java (89%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext4/NoUrlParamExt.java (95%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext4/impl/Ext4Impl1.java (86%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext4/impl/Ext4Impl2.java (86%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext5/NoAdaptiveMethodExt.java (94%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext5/impl/Ext5Impl1.java (88%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext5/impl/Ext5Impl2.java (88%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext6_inject/Dao.java (93%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext6_inject/Ext6.java (92%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext6_inject/impl/DaoImpl.java (87%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext6_inject/impl/Ext6Impl1.java (80%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext6_inject/impl/Ext6Impl2.java (89%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext6_wrap/WrappedExt.java (94%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext6_wrap/impl/Ext5Impl1.java (87%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext6_wrap/impl/Ext5Impl2.java (87%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext6_wrap/impl/Ext5Wrapper1.java (90%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext6_wrap/impl/Ext5Wrapper2.java (90%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext7/InitErrorExt.java (95%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext7/impl/Ext7Impl.java (88%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext7/impl/Ext7InitErrorImpl.java (89%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext8_add/AddExt1.java (94%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext8_add/AddExt2.java (95%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext8_add/AddExt3.java (95%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext8_add/AddExt4.java (95%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext8_add/impl/AddExt1Impl1.java (88%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext8_add/impl/AddExt1_ManualAdaptive.java (90%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext8_add/impl/AddExt1_ManualAdd1.java (88%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext8_add/impl/AddExt1_ManualAdd2.java (88%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext8_add/impl/AddExt2Impl1.java (88%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext8_add/impl/AddExt2_ManualAdaptive.java (90%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext8_add/impl/AddExt3_ManualAdaptive.java (90%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext8_add/impl/AddExt4_ManualAdaptive.java (90%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext9_empty/Ext9Empty.java (93%) rename dubbo-common/src/test/java/org/apache/dubbo/common/{extensionloader => extension}/ext9_empty/impl/Ext9EmptyImpl.java (87%) create mode 100644 dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/ActivateComparatorTest.java create mode 100644 dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter0.java create mode 100644 dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter1.java create mode 100644 dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter2.java create mode 100644 dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter3.java create mode 100644 dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter4.java create mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.activate.ActivateExt1 create mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.adaptive.HasAdaptiveExt create mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.compatible.CompatibleExt create mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext1.SimpleExt create mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext2.Ext2 create mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext3.UseProtocolKeyExt create mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext4.NoUrlParamExt create mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext5.NoAdaptiveMethodExt create mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext6_inject.Ext6 create mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext6_wrap.WrappedExt create mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext7.InitErrorExt create mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext8_add.AddExt1 rename dubbo-common/src/test/resources/META-INF/dubbo/internal/{org.apache.dubbo.common.extensionloader.ext9_empty.Ext9Empty => org.apache.dubbo.common.extension.ext9_empty.Ext9Empty} (100%) create mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.support.Filter0 delete mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.activate.ActivateExt1 delete mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.adaptive.HasAdaptiveExt delete mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.compatible.CompatibleExt delete mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext1.SimpleExt delete mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext2.Ext2 delete mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext3.UseProtocolKeyExt delete mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext4.NoUrlParamExt delete mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext5.NoAdaptiveMethodExt delete mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext6_inject.Ext6 delete mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext6_wrap.WrappedExt delete mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext7.InitErrorExt delete mode 100644 dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext8_add.AddExt1 create mode 100644 dubbo-common/src/test/resources/META-INF/services/org.apache.dubbo.common.extension.activate.ActivateExt1 delete mode 100644 dubbo-common/src/test/resources/META-INF/services/org.apache.dubbo.common.extensionloader.activate.ActivateExt1 diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtil.java b/dubbo-common/src/main/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtil.java index 4f7d30e6a16..ea9f582648a 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtil.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtil.java @@ -344,7 +344,7 @@ private static Object instantiate(Class cl) throws Exception { return cl.newInstance(); } - private static Object getConstructorArg(Class cl) { + public static Object getConstructorArg(Class cl) { if (boolean.class.equals(cl) || Boolean.class.equals(cl)) { return Boolean.FALSE; } else if (byte.class.equals(cl) || Byte.class.equals(cl)) { diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/ClassGenerator.java b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/ClassGenerator.java index 52a60fc50aa..685ad177cbd 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/ClassGenerator.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/ClassGenerator.java @@ -16,9 +16,6 @@ */ package org.apache.dubbo.common.bytecode; -import org.apache.dubbo.common.utils.ClassHelper; -import org.apache.dubbo.common.utils.ReflectUtils; - import javassist.CannotCompileException; import javassist.ClassPool; import javassist.CtClass; @@ -29,6 +26,8 @@ import javassist.CtNewMethod; import javassist.LoaderClassPath; import javassist.NotFoundException; +import org.apache.dubbo.common.utils.ClassHelper; +import org.apache.dubbo.common.utils.ReflectUtils; import java.lang.reflect.Constructor; import java.lang.reflect.Method; @@ -92,10 +91,15 @@ public static ClassPool getClassPool(ClassLoader loader) { } private static String modifier(int mod) { - if (Modifier.isPublic(mod)) return "public"; - if (Modifier.isProtected(mod)) return "protected"; - if (Modifier.isPrivate(mod)) return "private"; - return ""; + StringBuilder modifier = new StringBuilder(); + if (Modifier.isPublic(mod)) modifier.append("public"); + if (Modifier.isProtected(mod)) modifier.append("protected"); + if (Modifier.isPrivate(mod)) modifier.append("private"); + + if (Modifier.isStatic(mod)) modifier.append(" static"); + if (Modifier.isVolatile(mod)) modifier.append(" volatile"); + + return modifier.toString(); } public String getClassName() { diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java index 93a428977f8..3d5235d63ad 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/compiler/support/ClassUtils.java @@ -23,6 +23,8 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.lang.reflect.TypeVariable; import java.net.URI; import java.net.URISyntaxException; import java.util.Collection; @@ -262,11 +264,21 @@ public static Class getGenericClass(Class cls, int i) { if (genericClass instanceof ParameterizedType) { return (Class) ((ParameterizedType) genericClass).getRawType(); } else if (genericClass instanceof GenericArrayType) { - return (Class) ((GenericArrayType) genericClass).getGenericComponentType(); + Type type = ((GenericArrayType) genericClass).getGenericComponentType(); + if (type instanceof TypeVariable) { + return type.getClass(); + } + return (((GenericArrayType) genericClass).getGenericComponentType() instanceof Class) + ? (Class) ((GenericArrayType) genericClass).getGenericComponentType() + : ((GenericArrayType) genericClass).getGenericComponentType().getClass(); } else if (genericClass != null) { + if (genericClass instanceof TypeVariable) { + return genericClass.getClass(); + } return (Class) genericClass; } } catch (Throwable e) { + } if (cls.getSuperclass() != null) { return getGenericClass(cls.getSuperclass(), i); diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java b/dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java index 315c9e107b3..b8e7bbf974c 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java @@ -131,6 +131,7 @@ public String getExtensionName(T extensionInstance) { } public String getExtensionName(Class extensionClass) { + getExtensionClasses();// load class return cachedNames.get(extensionClass); } diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanAccessorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanAccessorTest.java new file mode 100644 index 00000000000..4c4e1523501 --- /dev/null +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanAccessorTest.java @@ -0,0 +1,37 @@ +/* + * 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.dubbo.common.beanutil; + +import org.junit.Assert; +import org.junit.Test; + +public class JavaBeanAccessorTest { + + @Test + public void testIsAccessByMethod(){ + Assert.assertTrue(JavaBeanAccessor.isAccessByMethod(JavaBeanAccessor.METHOD)); + Assert.assertTrue(JavaBeanAccessor.isAccessByMethod(JavaBeanAccessor.ALL)); + Assert.assertFalse(JavaBeanAccessor.isAccessByMethod(JavaBeanAccessor.FIELD)); + } + + @Test + public void testIsAccessByField(){ + Assert.assertTrue(JavaBeanAccessor.isAccessByField(JavaBeanAccessor.FIELD)); + Assert.assertTrue(JavaBeanAccessor.isAccessByField(JavaBeanAccessor.ALL)); + Assert.assertFalse(JavaBeanAccessor.isAccessByField(JavaBeanAccessor.METHOD)); + } +} diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtilTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtilTest.java index 372825ec25d..3cf314cd949 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtilTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtilTest.java @@ -22,7 +22,6 @@ import org.apache.dubbo.common.model.person.PersonStatus; import org.apache.dubbo.common.model.person.Phone; import org.apache.dubbo.common.utils.PojoUtilsTest; - import org.junit.Assert; import org.junit.Test; @@ -37,123 +36,6 @@ public class JavaBeanSerializeUtilTest { - static void assertEqualsEnum(Enum expected, Object obj) { - JavaBeanDescriptor descriptor = (JavaBeanDescriptor) obj; - Assert.assertTrue(descriptor.isEnumType()); - Assert.assertEquals(expected.getClass().getName(), descriptor.getClassName()); - Assert.assertEquals(expected.name(), descriptor.getEnumPropertyName()); - } - - static void assertEqualsPrimitive(Object expected, Object obj) { - if (expected == null) { - return; - } - JavaBeanDescriptor descriptor = (JavaBeanDescriptor) obj; - Assert.assertTrue(descriptor.isPrimitiveType()); - Assert.assertEquals(expected, descriptor.getPrimitiveProperty()); - } - - static void assertEqualsBigPerson(BigPerson person, Object obj) { - JavaBeanDescriptor descriptor = (JavaBeanDescriptor) obj; - Assert.assertTrue(descriptor.isBeanType()); - assertEqualsPrimitive(person.getPersonId(), descriptor.getProperty("personId")); - assertEqualsPrimitive(person.getLoginName(), descriptor.getProperty("loginName")); - assertEqualsEnum(person.getStatus(), descriptor.getProperty("status")); - assertEqualsPrimitive(person.getEmail(), descriptor.getProperty("email")); - assertEqualsPrimitive(person.getPenName(), descriptor.getProperty("penName")); - - JavaBeanDescriptor infoProfile = (JavaBeanDescriptor) descriptor.getProperty("infoProfile"); - Assert.assertTrue(infoProfile.isBeanType()); - JavaBeanDescriptor phones = (JavaBeanDescriptor) infoProfile.getProperty("phones"); - Assert.assertTrue(phones.isCollectionType()); - assertEqualsPhone(person.getInfoProfile().getPhones().get(0), phones.getProperty(0)); - assertEqualsPhone(person.getInfoProfile().getPhones().get(1), phones.getProperty(1)); - assertEqualsPhone(person.getInfoProfile().getFax(), infoProfile.getProperty("fax")); - assertEqualsFullAddress(person.getInfoProfile().getFullAddress(), infoProfile.getProperty("fullAddress")); - assertEqualsPrimitive(person.getInfoProfile().getMobileNo(), infoProfile.getProperty("mobileNo")); - assertEqualsPrimitive(person.getInfoProfile().getName(), infoProfile.getProperty("name")); - assertEqualsPrimitive(person.getInfoProfile().getDepartment(), infoProfile.getProperty("department")); - assertEqualsPrimitive(person.getInfoProfile().getJobTitle(), infoProfile.getProperty("jobTitle")); - assertEqualsPrimitive(person.getInfoProfile().getHomepageUrl(), infoProfile.getProperty("homepageUrl")); - assertEqualsPrimitive(person.getInfoProfile().isFemale(), infoProfile.getProperty("female")); - assertEqualsPrimitive(person.getInfoProfile().isMale(), infoProfile.getProperty("male")); - } - - static void assertEqualsPhone(Phone excpected, Object obj) { - JavaBeanDescriptor descriptor = (JavaBeanDescriptor) obj; - Assert.assertTrue(descriptor.isBeanType()); - if (excpected.getArea() != null) { - assertEqualsPrimitive(excpected.getArea(), descriptor.getProperty("area")); - } - if (excpected.getCountry() != null) { - assertEqualsPrimitive(excpected.getCountry(), descriptor.getProperty("country")); - } - if (excpected.getExtensionNumber() != null) { - assertEqualsPrimitive(excpected.getExtensionNumber(), descriptor.getProperty("extensionNumber")); - } - if (excpected.getNumber() != null) { - assertEqualsPrimitive(excpected.getNumber(), descriptor.getProperty("number")); - } - } - - static void assertEqualsFullAddress(FullAddress expected, Object obj) { - JavaBeanDescriptor descriptor = (JavaBeanDescriptor) obj; - Assert.assertTrue(descriptor.isBeanType()); - if (expected.getCityId() != null) { - assertEqualsPrimitive(expected.getCityId(), descriptor.getProperty("cityId")); - } - if (expected.getCityName() != null) { - assertEqualsPrimitive(expected.getCityName(), descriptor.getProperty("cityName")); - } - if (expected.getCountryId() != null) { - assertEqualsPrimitive(expected.getCountryId(), descriptor.getProperty("countryId")); - } - if (expected.getCountryName() != null) { - assertEqualsPrimitive(expected.getCountryName(), descriptor.getProperty("countryName")); - } - if (expected.getProvinceName() != null) { - assertEqualsPrimitive(expected.getProvinceName(), descriptor.getProperty("provinceName")); - } - if (expected.getStreetAddress() != null) { - assertEqualsPrimitive(expected.getStreetAddress(), descriptor.getProperty("streetAddress")); - } - if (expected.getZipCode() != null) { - assertEqualsPrimitive(expected.getZipCode(), descriptor.getProperty("zipCode")); - } - } - - static BigPerson createBigPerson() { - BigPerson bigPerson; - bigPerson = new BigPerson(); - bigPerson.setPersonId("superman111"); - bigPerson.setLoginName("superman"); - bigPerson.setStatus(PersonStatus.ENABLED); - bigPerson.setEmail("sm@1.com"); - bigPerson.setPenName("pname"); - - ArrayList phones = new ArrayList(); - Phone phone1 = new Phone("86", "0571", "87654321", "001"); - Phone phone2 = new Phone("86", "0571", "87654322", "002"); - phones.add(phone1); - phones.add(phone2); - - PersonInfo pi = new PersonInfo(); - pi.setPhones(phones); - Phone fax = new Phone("86", "0571", "87654321", null); - pi.setFax(fax); - FullAddress addr = new FullAddress("CN", "zj", "3480", "wensanlu", "315000"); - pi.setFullAddress(addr); - pi.setMobileNo("13584652131"); - pi.setMale(true); - pi.setDepartment("b2b"); - pi.setHomepageUrl("www.capcom.com"); - pi.setJobTitle("qa"); - pi.setName("superman"); - - bigPerson.setInfoProfile(pi); - return bigPerson; - } - @Test public void testSerialize_Primitive() throws Exception { JavaBeanDescriptor descriptor; @@ -167,6 +49,13 @@ public void testSerialize_Primitive() throws Exception { Assert.assertEquals(now, descriptor.getPrimitiveProperty()); } + @Test + public void testSerialize_Primitive_NUll() throws Exception { + JavaBeanDescriptor descriptor; + descriptor = JavaBeanSerializeUtil.serialize(null); + Assert.assertTrue(descriptor == null); + } + @Test public void testDeserialize_Primitive() throws Exception { JavaBeanDescriptor descriptor = new JavaBeanDescriptor(long.class.getName(), JavaBeanDescriptor.TYPE_PRIMITIVE); @@ -182,6 +71,67 @@ public void testDeserialize_Primitive() throws Exception { Assert.assertEquals(string, JavaBeanSerializeUtil.deserialize(descriptor)); } + @Test(expected = IllegalArgumentException.class) + public void testDeserialize_Primitive0() throws Exception { + JavaBeanDescriptor descriptor = new JavaBeanDescriptor(long.class.getName(), JavaBeanDescriptor.TYPE_BEAN + 1); + } + + @Test(expected = IllegalArgumentException.class) + public void testDeserialize_Null() throws Exception { + JavaBeanDescriptor descriptor = new JavaBeanDescriptor(null, JavaBeanDescriptor.TYPE_BEAN); + } + + @Test(expected = IllegalArgumentException.class) + public void testDeserialize_containsProperty() throws Exception { + JavaBeanDescriptor descriptor = new JavaBeanDescriptor(long.class.getName(), JavaBeanDescriptor.TYPE_PRIMITIVE); + descriptor.containsProperty(null); + } + + @Test(expected = IllegalStateException.class) + public void testSetEnumNameProperty() throws Exception { + JavaBeanDescriptor descriptor = new JavaBeanDescriptor(long.class.getName(), JavaBeanDescriptor.TYPE_PRIMITIVE); + descriptor.setEnumNameProperty(JavaBeanDescriptor.class.getName()); + } + + @Test(expected = IllegalStateException.class) + public void testGetEnumNameProperty() throws Exception { + JavaBeanDescriptor descriptor = new JavaBeanDescriptor(long.class.getName(), JavaBeanDescriptor.TYPE_PRIMITIVE); + descriptor.getEnumPropertyName(); + } + + @Test(expected = IllegalStateException.class) + public void testSetClassNameProperty() throws Exception { + JavaBeanDescriptor descriptor = new JavaBeanDescriptor(long.class.getName(), JavaBeanDescriptor.TYPE_PRIMITIVE); + descriptor.setClassNameProperty(JavaBeanDescriptor.class.getName()); + } + + @Test(expected = IllegalStateException.class) + public void testGetClassNameProperty() throws Exception { + JavaBeanDescriptor descriptor = new JavaBeanDescriptor(long.class.getName(), JavaBeanDescriptor.TYPE_PRIMITIVE); + descriptor.getClassNameProperty(); + } + + @Test(expected = IllegalStateException.class) + public void testSetPrimitiveProperty() throws Exception { + JavaBeanDescriptor descriptor = new JavaBeanDescriptor(JavaBeanDescriptor.class.getName(), JavaBeanDescriptor.TYPE_BEAN); + descriptor.setPrimitiveProperty(JavaBeanDescriptor.class.getName()); + } + + @Test(expected = IllegalStateException.class) + public void testGetPrimitiveProperty() throws Exception { + JavaBeanDescriptor descriptor = new JavaBeanDescriptor(JavaBeanDescriptor.class.getName(), JavaBeanDescriptor.TYPE_BEAN); + descriptor.getPrimitiveProperty(); + } + + @Test + public void testDeserialize_get_and_set() throws Exception { + JavaBeanDescriptor descriptor = new JavaBeanDescriptor(long.class.getName(), JavaBeanDescriptor.TYPE_BEAN); + descriptor.setType(JavaBeanDescriptor.TYPE_PRIMITIVE); + Assert.assertTrue(descriptor.getType() == JavaBeanDescriptor.TYPE_PRIMITIVE); + descriptor.setClassName(JavaBeanDescriptor.class.getName()); + Assert.assertEquals(JavaBeanDescriptor.class.getName(), descriptor.getClassName()); + } + @Test public void testSerialize_Array() throws Exception { int[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9}; @@ -228,6 +178,27 @@ public void testSerialize_Array() throws Exception { } } + @Test + public void testConstructorArg() { + Assert.assertFalse((boolean) JavaBeanSerializeUtil.getConstructorArg(boolean.class)); + Assert.assertFalse((boolean) JavaBeanSerializeUtil.getConstructorArg(Boolean.class)); + Assert.assertEquals((byte)0, JavaBeanSerializeUtil.getConstructorArg(byte.class)); + Assert.assertEquals((byte)0, JavaBeanSerializeUtil.getConstructorArg(Byte.class)); + Assert.assertEquals((short)0, JavaBeanSerializeUtil.getConstructorArg(short.class)); + Assert.assertEquals((short)0, JavaBeanSerializeUtil.getConstructorArg(Short.class)); + Assert.assertEquals(0, JavaBeanSerializeUtil.getConstructorArg(int.class)); + Assert.assertEquals(0, JavaBeanSerializeUtil.getConstructorArg(Integer.class)); + Assert.assertEquals((long)0, JavaBeanSerializeUtil.getConstructorArg(long.class)); + Assert.assertEquals((long)0, JavaBeanSerializeUtil.getConstructorArg(Long.class)); + Assert.assertEquals((float) 0, JavaBeanSerializeUtil.getConstructorArg(float.class)); + Assert.assertEquals((float) 0, JavaBeanSerializeUtil.getConstructorArg(Float.class)); + Assert.assertEquals((double) 0, JavaBeanSerializeUtil.getConstructorArg(double.class)); + Assert.assertEquals((double) 0, JavaBeanSerializeUtil.getConstructorArg(Double.class)); + Assert.assertEquals((char)0, JavaBeanSerializeUtil.getConstructorArg(char.class)); + Assert.assertEquals(new Character((char)0), JavaBeanSerializeUtil.getConstructorArg(Character.class)); + Assert.assertEquals(null, JavaBeanSerializeUtil.getConstructorArg(JavaBeanSerializeUtil.class)); + } + @Test public void testDeserialize_Array() throws Exception { final int len = 10; @@ -408,4 +379,121 @@ public void testSerializeJavaBeanDescriptor() throws Exception { JavaBeanDescriptor actual = (JavaBeanDescriptor) object; Assert.assertEquals(map.get("first"), actual); } + + static void assertEqualsEnum(Enum expected, Object obj) { + JavaBeanDescriptor descriptor = (JavaBeanDescriptor) obj; + Assert.assertTrue(descriptor.isEnumType()); + Assert.assertEquals(expected.getClass().getName(), descriptor.getClassName()); + Assert.assertEquals(expected.name(), descriptor.getEnumPropertyName()); + } + + static void assertEqualsPrimitive(Object expected, Object obj) { + if (expected == null) { + return; + } + JavaBeanDescriptor descriptor = (JavaBeanDescriptor) obj; + Assert.assertTrue(descriptor.isPrimitiveType()); + Assert.assertEquals(expected, descriptor.getPrimitiveProperty()); + } + + static void assertEqualsBigPerson(BigPerson person, Object obj) { + JavaBeanDescriptor descriptor = (JavaBeanDescriptor) obj; + Assert.assertTrue(descriptor.isBeanType()); + assertEqualsPrimitive(person.getPersonId(), descriptor.getProperty("personId")); + assertEqualsPrimitive(person.getLoginName(), descriptor.getProperty("loginName")); + assertEqualsEnum(person.getStatus(), descriptor.getProperty("status")); + assertEqualsPrimitive(person.getEmail(), descriptor.getProperty("email")); + assertEqualsPrimitive(person.getPenName(), descriptor.getProperty("penName")); + + JavaBeanDescriptor infoProfile = (JavaBeanDescriptor) descriptor.getProperty("infoProfile"); + Assert.assertTrue(infoProfile.isBeanType()); + JavaBeanDescriptor phones = (JavaBeanDescriptor) infoProfile.getProperty("phones"); + Assert.assertTrue(phones.isCollectionType()); + assertEqualsPhone(person.getInfoProfile().getPhones().get(0), phones.getProperty(0)); + assertEqualsPhone(person.getInfoProfile().getPhones().get(1), phones.getProperty(1)); + assertEqualsPhone(person.getInfoProfile().getFax(), infoProfile.getProperty("fax")); + assertEqualsFullAddress(person.getInfoProfile().getFullAddress(), infoProfile.getProperty("fullAddress")); + assertEqualsPrimitive(person.getInfoProfile().getMobileNo(), infoProfile.getProperty("mobileNo")); + assertEqualsPrimitive(person.getInfoProfile().getName(), infoProfile.getProperty("name")); + assertEqualsPrimitive(person.getInfoProfile().getDepartment(), infoProfile.getProperty("department")); + assertEqualsPrimitive(person.getInfoProfile().getJobTitle(), infoProfile.getProperty("jobTitle")); + assertEqualsPrimitive(person.getInfoProfile().getHomepageUrl(), infoProfile.getProperty("homepageUrl")); + assertEqualsPrimitive(person.getInfoProfile().isFemale(), infoProfile.getProperty("female")); + assertEqualsPrimitive(person.getInfoProfile().isMale(), infoProfile.getProperty("male")); + } + + static void assertEqualsPhone(Phone excpected, Object obj) { + JavaBeanDescriptor descriptor = (JavaBeanDescriptor) obj; + Assert.assertTrue(descriptor.isBeanType()); + if (excpected.getArea() != null) { + assertEqualsPrimitive(excpected.getArea(), descriptor.getProperty("area")); + } + if (excpected.getCountry() != null) { + assertEqualsPrimitive(excpected.getCountry(), descriptor.getProperty("country")); + } + if (excpected.getExtensionNumber() != null) { + assertEqualsPrimitive(excpected.getExtensionNumber(), descriptor.getProperty("extensionNumber")); + } + if (excpected.getNumber() != null) { + assertEqualsPrimitive(excpected.getNumber(), descriptor.getProperty("number")); + } + } + + static void assertEqualsFullAddress(FullAddress expected, Object obj) { + JavaBeanDescriptor descriptor = (JavaBeanDescriptor) obj; + Assert.assertTrue(descriptor.isBeanType()); + if (expected.getCityId() != null) { + assertEqualsPrimitive(expected.getCityId(), descriptor.getProperty("cityId")); + } + if (expected.getCityName() != null) { + assertEqualsPrimitive(expected.getCityName(), descriptor.getProperty("cityName")); + } + if (expected.getCountryId() != null) { + assertEqualsPrimitive(expected.getCountryId(), descriptor.getProperty("countryId")); + } + if (expected.getCountryName() != null) { + assertEqualsPrimitive(expected.getCountryName(), descriptor.getProperty("countryName")); + } + if (expected.getProvinceName() != null) { + assertEqualsPrimitive(expected.getProvinceName(), descriptor.getProperty("provinceName")); + } + if (expected.getStreetAddress() != null) { + assertEqualsPrimitive(expected.getStreetAddress(), descriptor.getProperty("streetAddress")); + } + if (expected.getZipCode() != null) { + assertEqualsPrimitive(expected.getZipCode(), descriptor.getProperty("zipCode")); + } + } + + static BigPerson createBigPerson() { + BigPerson bigPerson; + bigPerson = new BigPerson(); + bigPerson.setPersonId("superman111"); + bigPerson.setLoginName("superman"); + bigPerson.setStatus(PersonStatus.ENABLED); + bigPerson.setEmail("sm@1.com"); + bigPerson.setPenName("pname"); + + ArrayList phones = new ArrayList(); + Phone phone1 = new Phone("86", "0571", "87654321", "001"); + Phone phone2 = new Phone("86", "0571", "87654322", "002"); + phones.add(phone1); + phones.add(phone2); + + PersonInfo pi = new PersonInfo(); + pi.setPhones(phones); + Phone fax = new Phone("86", "0571", "87654321", null); + pi.setFax(fax); + FullAddress addr = new FullAddress("CN", "zj", "3480", "wensanlu", "315000"); + pi.setFullAddress(addr); + pi.setMobileNo("13584652131"); + pi.setMale(true); + pi.setDepartment("b2b"); + pi.setHomepageUrl("www.capcom.com"); + pi.setJobTitle("qa"); + pi.setName("superman"); + + bigPerson.setInfoProfile(pi); + return bigPerson; + } } diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ClassGeneratorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ClassGeneratorTest.java index 4fa775daf42..9ae67f3b8c9 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ClassGeneratorTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ClassGeneratorTest.java @@ -17,8 +17,10 @@ package org.apache.dubbo.common.bytecode; import junit.framework.TestCase; +import org.junit.Test; import java.lang.reflect.Field; +import java.lang.reflect.Modifier; interface Builder { T getName(Bean bean); @@ -27,7 +29,9 @@ interface Builder { } public class ClassGeneratorTest extends TestCase { + @SuppressWarnings("unchecked") + @Test public void testMain() throws Exception { Bean b = new Bean(); Field fname = null, fs[] = Bean.class.getDeclaredFields(); @@ -56,6 +60,36 @@ public void testMain() throws Exception { builder.setName(b, "ok"); System.out.println(b.getName()); } + + @Test + public void testMain0() throws Exception { + Bean b = new Bean(); + Field fname = null, fs[] = Bean.class.getDeclaredFields(); + for (Field f : fs) { + f.setAccessible(true); + if (f.getName().equals("name")) + fname = f; + } + + ClassGenerator cg = ClassGenerator.newInstance(); + cg.setClassName(Bean.class.getName() + "$Builder2"); + cg.addInterface(Builder.class); + + cg.addField("FNAME", Modifier.PUBLIC | Modifier.STATIC, java.lang.reflect.Field.class); + + cg.addMethod("public Object getName(" + Bean.class.getName() + " o){ boolean[][][] bs = new boolean[0][][]; return (String)FNAME.get($1); }"); + cg.addMethod("public void setName(" + Bean.class.getName() + " o, Object name){ FNAME.set($1, $2); }"); + + cg.addDefaultConstructor(); + Class cl = cg.toClass(); + cl.getField("FNAME").set(null, fname); + + System.out.println(cl.getName()); + Builder builder = (Builder) cl.newInstance(); + System.out.println(b.getName()); + builder.setName(b, "ok"); + System.out.println(b.getName()); + } } class Bean { @@ -70,4 +104,6 @@ public int getAge() { public String getName() { return name; } + + public static volatile String abc = "df"; } \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/MixinTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/MixinTest.java index 7488791e3c5..556b7759c0f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/MixinTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/MixinTest.java @@ -17,8 +17,11 @@ package org.apache.dubbo.common.bytecode; import junit.framework.TestCase; +import org.junit.Test; public class MixinTest extends TestCase { + + @Test public void testMain() throws Exception { Mixin mixin = Mixin.mixin(new Class[]{I1.class, I2.class, I3.class}, new Class[]{C1.class, C2.class}); Object o = mixin.newInstance(new Object[]{new C1(), new C2()}); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ProxyTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ProxyTest.java index cac558c8a63..1f4abca57a7 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ProxyTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/ProxyTest.java @@ -27,6 +27,8 @@ import java.lang.reflect.Method; public class ProxyTest extends TestCase { + + @Test public void testMain() throws Exception { Proxy proxy = Proxy.getProxy(ITest.class, ITest.class); ITest instance = (ITest) proxy.newInstance(new InvocationHandler() { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/WrapperTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/WrapperTest.java index b1a79be5c94..fe4b5df10f5 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/WrapperTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/bytecode/WrapperTest.java @@ -16,6 +16,7 @@ */ package org.apache.dubbo.common.bytecode; +import org.junit.Assert; import org.junit.Test; import static org.junit.Assert.assertArrayEquals; @@ -59,6 +60,53 @@ public void test_makeEmptyClass() throws Exception { Wrapper.getWrapper(EmptyServiceImpl.class); } + @Test + public void testHasMethod() throws Exception { + Wrapper w = Wrapper.getWrapper(I1.class); + Assert.assertTrue(w.hasMethod("setName")); + Assert.assertTrue(w.hasMethod("hello")); + Assert.assertTrue(w.hasMethod("showInt")); + Assert.assertTrue(w.hasMethod("getFloat")); + Assert.assertTrue(w.hasMethod("setFloat")); + Assert.assertFalse(w.hasMethod("setFloatXXX")); + } + + @Test + public void testWrapperObject() throws Exception { + Wrapper w = Wrapper.getWrapper(Object.class); + Assert.assertTrue(w.getMethodNames().length == 4); + Assert.assertTrue(w.getPropertyNames().length == 0); + Assert.assertEquals(null, w.getPropertyType(null)); + } + + @Test(expected = NoSuchPropertyException.class) + public void testGetPropertyValue() throws Exception { + Wrapper w = Wrapper.getWrapper(Object.class); + w.getPropertyValue(null, null); + } + + @Test(expected = NoSuchPropertyException.class) + public void testSetPropertyValue() throws Exception { + Wrapper w = Wrapper.getWrapper(Object.class); + w.setPropertyValue(null, null, null); + } + + @Test + public void testInvokeWrapperObject() throws Exception { + Wrapper w = Wrapper.getWrapper(Object.class); + Object instance = new Object(); + Assert.assertEquals(instance.getClass(), (Class) w.invokeMethod(instance, "getClass", null, null)); + Assert.assertEquals(instance.hashCode(), (int) w.invokeMethod(instance, "hashCode", null, null)); + Assert.assertEquals(instance.toString(), (String) w.invokeMethod(instance, "toString", null, null)); + Assert.assertEquals(true, (boolean) w.invokeMethod(instance, "equals", null, new Object[]{instance})); + } + + @Test(expected = NoSuchMethodException.class) + public void testNoSuchMethod() throws Exception { + Wrapper w = Wrapper.getWrapper(Object.class); + w.invokeMethod(new Object(), "__XX__", null, null); + } + /** * see http://code.alibabatech.com/jira/browse/DUBBO-571 */ diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/AdaptiveCompilerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/AdaptiveCompilerTest.java new file mode 100644 index 00000000000..136d43400a6 --- /dev/null +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/AdaptiveCompilerTest.java @@ -0,0 +1,33 @@ +/* + * 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.dubbo.common.compiler.support; + +import org.junit.Assert; +import org.junit.Test; + +public class AdaptiveCompilerTest extends JavaCodeTest { + + @Test + public void testAvailableCompiler() throws Exception { + AdaptiveCompiler.setDefaultCompiler("jdk"); + AdaptiveCompiler compiler = new AdaptiveCompiler(); + Class clazz = compiler.compile(getSimpleCode(), AdaptiveCompiler.class.getClassLoader()); + HelloService helloService = (HelloService) clazz.newInstance(); + Assert.assertEquals("Hello world!", helloService.sayHello()); + } + +} diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/ClassUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/ClassUtilsTest.java new file mode 100644 index 00000000000..4f93cc4e95e --- /dev/null +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/ClassUtilsTest.java @@ -0,0 +1,180 @@ +/* + * 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.dubbo.common.compiler.support; + +import org.junit.Assert; +import org.junit.Test; + +import java.lang.reflect.GenericArrayType; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.TypeVariable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ClassUtilsTest { + + @Test + public void testNewInstance() { + HelloServiceImpl0 instance = (HelloServiceImpl0) ClassUtils.newInstance(HelloServiceImpl0.class.getName()); + Assert.assertEquals("Hello world!", instance.sayHello()); + } + + @Test(expected = IllegalStateException.class) + public void testNewInstance0() { + ClassUtils.newInstance(PrivateHelloServiceImpl.class.getName()); + } + + @Test(expected = IllegalStateException.class) + public void testNewInstance1() { + ClassUtils.newInstance("org.apache.dubbo.common.compiler.support.internal.HelloServiceInternalImpl"); + } + + @Test(expected = IllegalStateException.class) + public void testNewInstance2() { + ClassUtils.newInstance("org.apache.dubbo.common.compiler.support.internal.NotExistsImpl"); + } + + @Test + public void testForName() { + ClassUtils.forName(new String[]{"org.apache.dubbo.common.compiler.support"}, "HelloServiceImpl0"); + } + + @Test(expected = IllegalStateException.class) + public void testForName1() { + ClassUtils.forName(new String[]{"org.apache.dubbo.common.compiler.support"}, "HelloServiceImplXX"); + } + + @Test + public void testForName2() { + ClassUtils.forName("boolean"); + ClassUtils.forName("byte"); + ClassUtils.forName("char"); + ClassUtils.forName("short"); + ClassUtils.forName("int"); + ClassUtils.forName("long"); + ClassUtils.forName("float"); + ClassUtils.forName("double"); + ClassUtils.forName("boolean[]"); + ClassUtils.forName("byte[]"); + ClassUtils.forName("char[]"); + ClassUtils.forName("short[]"); + ClassUtils.forName("int[]"); + ClassUtils.forName("long[]"); + ClassUtils.forName("float[]"); + ClassUtils.forName("double[]"); + } + + @Test + public void testGetBoxedClass() { + Assert.assertEquals(Boolean.class, ClassUtils.getBoxedClass(boolean.class)); + Assert.assertEquals(Character.class, ClassUtils.getBoxedClass(char.class)); + Assert.assertEquals(Byte.class, ClassUtils.getBoxedClass(byte.class)); + Assert.assertEquals(Short.class, ClassUtils.getBoxedClass(short.class)); + Assert.assertEquals(Integer.class, ClassUtils.getBoxedClass(int.class)); + Assert.assertEquals(Long.class, ClassUtils.getBoxedClass(long.class)); + Assert.assertEquals(Float.class, ClassUtils.getBoxedClass(float.class)); + Assert.assertEquals(Double.class, ClassUtils.getBoxedClass(double.class)); + Assert.assertEquals(ClassUtilsTest.class, ClassUtils.getBoxedClass(ClassUtilsTest.class)); + } + + @Test + public void testBoxedAndUnboxed() { + Assert.assertEquals(Boolean.valueOf(true), ClassUtils.boxed(true)); + Assert.assertEquals(Character.valueOf('0'), ClassUtils.boxed('0')); + Assert.assertEquals(Byte.valueOf((byte) 0), ClassUtils.boxed((byte) 0)); + Assert.assertEquals(Short.valueOf((short) 0), ClassUtils.boxed((short) 0)); + Assert.assertEquals(Integer.valueOf((int) 0), ClassUtils.boxed((int) 0)); + Assert.assertEquals(Long.valueOf((long) 0), ClassUtils.boxed((long) 0)); + Assert.assertEquals(Float.valueOf((float) 0), ClassUtils.boxed((float) 0)); + Assert.assertEquals(Double.valueOf((double) 0), ClassUtils.boxed((double) 0)); + + Assert.assertEquals(true, ClassUtils.unboxed(Boolean.valueOf(true))); + Assert.assertEquals('0', ClassUtils.unboxed(Character.valueOf('0'))); + Assert.assertEquals((byte) 0, ClassUtils.unboxed(Byte.valueOf((byte) 0))); + Assert.assertEquals((short) 0, ClassUtils.unboxed(Short.valueOf((short) 0))); + Assert.assertEquals(0, ClassUtils.unboxed(Integer.valueOf((int) 0))); + Assert.assertEquals((long) 0, ClassUtils.unboxed(Long.valueOf((long) 0))); + Assert.assertEquals((float) 0, ClassUtils.unboxed(Float.valueOf((float) 0)), ((float)0)); + Assert.assertEquals((double) 0, ClassUtils.unboxed(Double.valueOf((double) 0)), ((double)0)); + } + + @Test + public void testGetSize(){ + Assert.assertEquals(0, ClassUtils.getSize(null)); + List list = new ArrayList<>();list.add(1); + Assert.assertEquals(1, ClassUtils.getSize(list)); + Map map = new HashMap(); map.put(1, 1); + Assert.assertEquals(1, ClassUtils.getSize(map)); + int[] array = new int[1]; + Assert.assertEquals(1, ClassUtils.getSize(array)); + Assert.assertEquals(-1, ClassUtils.getSize(new Object())); + } + + @Test(expected = RuntimeException.class) + public void testToUri(){ + ClassUtils.toURI("#xx_abc#hello"); + } + + @Test + public void testGetGenericClass(){ + Assert.assertTrue(TypeVariable.class.isAssignableFrom(ClassUtils.getGenericClass(GenericClass.class))); + Assert.assertTrue(String.class.isAssignableFrom(ClassUtils.getGenericClass(GenericClass0.class))); + Assert.assertTrue(Collection.class.isAssignableFrom(ClassUtils.getGenericClass(GenericClass1.class))); + Assert.assertTrue(TypeVariable.class.isAssignableFrom(ClassUtils.getGenericClass(GenericClass2.class))); + Assert.assertTrue(GenericArrayType.class.isAssignableFrom(ClassUtils.getGenericClass(GenericClass3.class))); + } + + @Test + public void testGetSizeMethod(){ + Assert.assertEquals("getLength()", ClassUtils.getSizeMethod(GenericClass3.class)); + } + + private interface GenericInterface{ + } + + private class GenericClass implements GenericInterface{ + } + + private class GenericClass0 implements GenericInterface{ + } + + private class GenericClass1 implements GenericInterface>{ + } + + private class GenericClass2 implements GenericInterface{ + } + + private class GenericClass3 implements GenericInterface{ + public int getLength(){ + return -1; + } + } + + private class PrivateHelloServiceImpl implements HelloService { + private PrivateHelloServiceImpl() { + } + + @Override + public String sayHello() { + return "Hello world!"; + } + } + +} diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/HelloService.java b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/HelloService.java new file mode 100644 index 00000000000..ae9c23bd81b --- /dev/null +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/HelloService.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.dubbo.common.compiler.support; + +public interface HelloService { + + String sayHello(); + +} diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/HelloServiceImpl0.java b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/HelloServiceImpl0.java new file mode 100644 index 00000000000..94bc7a51a61 --- /dev/null +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/HelloServiceImpl0.java @@ -0,0 +1,24 @@ +/* + * 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.dubbo.common.compiler.support; + +public class HelloServiceImpl0 implements HelloService { + @Override + public String sayHello() { + return "Hello world!"; + } +} diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavaCodeTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavaCodeTest.java new file mode 100644 index 00000000000..851141b63a6 --- /dev/null +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavaCodeTest.java @@ -0,0 +1,101 @@ +/* + * 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.dubbo.common.compiler.support; + +import java.util.concurrent.atomic.AtomicInteger; + +public class JavaCodeTest { + + public final static AtomicInteger SUBFIX = new AtomicInteger(8); + + String getSimpleCode() { + StringBuilder code = new StringBuilder(); + code.append("package org.apache.dubbo.common.compiler.support;"); + + code.append("public class HelloServiceImpl" + SUBFIX.getAndIncrement() + " implements HelloService {"); + code.append(" public String sayHello() { "); + code.append(" return \"Hello world!\"; "); + code.append(" }"); + code.append("}"); + return code.toString(); + } + + String getSimleCodeWithoutPackage(){ + StringBuilder code = new StringBuilder(); + code.append("public class HelloServiceImpl" + SUBFIX.getAndIncrement() + "implements org.apache.dubbo.common.compiler.support.HelloService.HelloService {"); + code.append(" public String sayHello() { "); + code.append(" return \"Hello world!\"; "); + code.append(" }"); + code.append("}"); + return code.toString(); + } + + String getSimleCodeWithSyntax(){ + StringBuilder code = new StringBuilder(); + code.append("package org.apache.dubbo.common.compiler.support;"); + + code.append("public class HelloServiceImpl" + SUBFIX.getAndIncrement() + " implements HelloService {"); + code.append(" public String sayHello() { "); + code.append(" return \"Hello world!\"; "); + // code.append(" }"); + // } + return code.toString(); + } + + // only used for javassist + String getSimleCodeWithSyntax0(){ + StringBuilder code = new StringBuilder(); + code.append("package org.apache.dubbo.common.compiler.support;"); + + code.append("public class HelloServiceImpl_0 implements HelloService {"); + code.append(" public String sayHello() { "); + code.append(" return \"Hello world!\"; "); + // code.append(" }"); + // } + return code.toString(); + } + + String getSimpleCodeWithImports() { + StringBuilder code = new StringBuilder(); + code.append("package org.apache.dubbo.common.compiler.support;"); + + code.append("import java.lang.*;\n"); + code.append("import org.apache.dubbo.common.compiler.support;\n"); + + code.append("public class HelloServiceImpl2" + SUBFIX.getAndIncrement() + " implements HelloService {"); + code.append(" public String sayHello() { "); + code.append(" return \"Hello world!\"; "); + code.append(" }"); + code.append("}"); + return code.toString(); + } + + String getSimpleCodeWithWithExtends() { + StringBuilder code = new StringBuilder(); + code.append("package org.apache.dubbo.common.compiler.support;"); + + code.append("import java.lang.*;\n"); + code.append("import org.apache.dubbo.common.compiler.support;\n"); + + code.append("public class HelloServiceImpl" + SUBFIX.getAndIncrement() + " extends org.apache.dubbo.common.compiler.support.HelloServiceImpl0 {\n"); + code.append(" public String sayHello() { "); + code.append(" return \"Hello world3!\"; "); + code.append(" }"); + code.append("}"); + return code.toString(); + } +} diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavassistCompilerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavassistCompilerTest.java new file mode 100644 index 00000000000..c4c166c0920 --- /dev/null +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JavassistCompilerTest.java @@ -0,0 +1,74 @@ +/* + * 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.dubbo.common.compiler.support; + +import org.junit.Assert; +import org.junit.Test; + +import java.lang.reflect.Method; + +public class JavassistCompilerTest extends JavaCodeTest { + @Test + public void testCompileJavaClass() throws Exception { + JavassistCompiler compiler = new JavassistCompiler(); + Class clazz = compiler.compile(getSimpleCode(), JavassistCompiler.class.getClassLoader()); + + // Because javassist compiles using the caller class loader, we should't use HelloService directly + Object instance = clazz.newInstance(); + Method sayHello = instance.getClass().getMethod("sayHello"); + Assert.assertEquals("Hello world!", sayHello.invoke(instance)); + } + + /** + * javassist compile will find HelloService in classpath + */ + @Test + public void testCompileJavaClass0() throws Exception { + JavassistCompiler compiler = new JavassistCompiler(); + Class clazz = compiler.compile(getSimleCodeWithoutPackage(), JavassistCompiler.class.getClassLoader()); + Object instance = clazz.newInstance(); + Method sayHello = instance.getClass().getMethod("sayHello"); + Assert.assertEquals("Hello world!", sayHello.invoke(instance)); + } + + @Test(expected = IllegalStateException.class) + public void testCompileJavaClass1() throws Exception { + JavassistCompiler compiler = new JavassistCompiler(); + Class clazz = compiler.compile(getSimleCodeWithSyntax0(), JavassistCompiler.class.getClassLoader()); + Object instance = clazz.newInstance(); + Method sayHello = instance.getClass().getMethod("sayHello"); + Assert.assertEquals("Hello world!", sayHello.invoke(instance)); + } + + @Test + public void testCompileJavaClassWithImport() throws Exception { + JavassistCompiler compiler = new JavassistCompiler(); + Class clazz = compiler.compile(getSimpleCodeWithImports(), JavassistCompiler.class.getClassLoader()); + Object instance = clazz.newInstance(); + Method sayHello = instance.getClass().getMethod("sayHello"); + Assert.assertEquals("Hello world!", sayHello.invoke(instance)); + } + + @Test + public void testCompileJavaClassWithExtends() throws Exception { + JavassistCompiler compiler = new JavassistCompiler(); + Class clazz = compiler.compile(getSimpleCodeWithWithExtends(), JavassistCompiler.class.getClassLoader()); + Object instance = clazz.newInstance(); + Method sayHello = instance.getClass().getMethod("sayHello"); + Assert.assertEquals("Hello world3!", sayHello.invoke(instance)); + } +} diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JdkCompilerTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JdkCompilerTest.java index 47b8420cab9..1d5af2b21de 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JdkCompilerTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/JdkCompilerTest.java @@ -16,11 +16,37 @@ */ package org.apache.dubbo.common.compiler.support; +import org.junit.Assert; import org.junit.Test; -public class JdkCompilerTest { +import java.lang.reflect.Method; + +public class JdkCompilerTest extends JavaCodeTest{ + @Test - public void test_compileProtocol() throws Exception { + public void test_compileJavaClass() throws Exception { + JdkCompiler compiler = new JdkCompiler(); + Class clazz = compiler.compile(getSimpleCode(), JdkCompiler.class.getClassLoader()); + Object instance = clazz.newInstance(); + Method sayHello = instance.getClass().getMethod("sayHello"); + Assert.assertEquals("Hello world!", sayHello.invoke(instance)); + } + + @Test(expected = IllegalStateException.class) + public void test_compileJavaClass0() throws Exception { + JdkCompiler compiler = new JdkCompiler(); + Class clazz = compiler.compile(getSimleCodeWithoutPackage(), JdkCompiler.class.getClassLoader()); + Object instance = clazz.newInstance(); + Method sayHello = instance.getClass().getMethod("sayHello"); + Assert.assertEquals("Hello world!", sayHello.invoke(instance)); + } + @Test(expected = IllegalStateException.class) + public void test_compileJavaClass1() throws Exception { + JdkCompiler compiler = new JdkCompiler(); + Class clazz = compiler.compile(getSimleCodeWithSyntax(), JdkCompiler.class.getClassLoader()); + Object instance = clazz.newInstance(); + Method sayHello = instance.getClass().getMethod("sayHello"); + Assert.assertEquals("Hello world!", sayHello.invoke(instance)); } } diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/internal/HelloServiceInternalImpl.java b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/internal/HelloServiceInternalImpl.java new file mode 100644 index 00000000000..4e37b0bad55 --- /dev/null +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/compiler/support/internal/HelloServiceInternalImpl.java @@ -0,0 +1,20 @@ +/* + * 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.dubbo.common.compiler.support.internal; + +final class HelloServiceInternalImpl { +} diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ExtensionLoaderTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoaderTest.java similarity index 85% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ExtensionLoaderTest.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoaderTest.java index 367e8480622..211ef38e5a7 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ExtensionLoaderTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoaderTest.java @@ -14,38 +14,37 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader; +package org.apache.dubbo.common.extension; import org.apache.dubbo.common.Constants; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extension.ExtensionLoader; -import org.apache.dubbo.common.extensionloader.activate.ActivateExt1; -import org.apache.dubbo.common.extensionloader.activate.impl.ActivateExt1Impl1; -import org.apache.dubbo.common.extensionloader.activate.impl.GroupActivateExtImpl; -import org.apache.dubbo.common.extensionloader.activate.impl.OrderActivateExtImpl1; -import org.apache.dubbo.common.extensionloader.activate.impl.OrderActivateExtImpl2; -import org.apache.dubbo.common.extensionloader.activate.impl.ValueActivateExtImpl; -import org.apache.dubbo.common.extensionloader.ext1.SimpleExt; -import org.apache.dubbo.common.extensionloader.ext1.impl.SimpleExtImpl1; -import org.apache.dubbo.common.extensionloader.ext1.impl.SimpleExtImpl2; -import org.apache.dubbo.common.extensionloader.ext2.Ext2; -import org.apache.dubbo.common.extensionloader.ext6_wrap.WrappedExt; -import org.apache.dubbo.common.extensionloader.ext6_wrap.impl.Ext5Wrapper1; -import org.apache.dubbo.common.extensionloader.ext6_wrap.impl.Ext5Wrapper2; -import org.apache.dubbo.common.extensionloader.ext7.InitErrorExt; -import org.apache.dubbo.common.extensionloader.ext8_add.AddExt1; -import org.apache.dubbo.common.extensionloader.ext8_add.AddExt2; -import org.apache.dubbo.common.extensionloader.ext8_add.AddExt3; -import org.apache.dubbo.common.extensionloader.ext8_add.AddExt4; -import org.apache.dubbo.common.extensionloader.ext8_add.impl.AddExt1Impl1; -import org.apache.dubbo.common.extensionloader.ext8_add.impl.AddExt1_ManualAdaptive; -import org.apache.dubbo.common.extensionloader.ext8_add.impl.AddExt1_ManualAdd1; -import org.apache.dubbo.common.extensionloader.ext8_add.impl.AddExt1_ManualAdd2; -import org.apache.dubbo.common.extensionloader.ext8_add.impl.AddExt2_ManualAdaptive; -import org.apache.dubbo.common.extensionloader.ext8_add.impl.AddExt3_ManualAdaptive; -import org.apache.dubbo.common.extensionloader.ext8_add.impl.AddExt4_ManualAdaptive; -import org.apache.dubbo.common.extensionloader.ext9_empty.Ext9Empty; -import org.apache.dubbo.common.extensionloader.ext9_empty.impl.Ext9EmptyImpl; +import org.apache.dubbo.common.extension.activate.ActivateExt1; +import org.apache.dubbo.common.extension.activate.impl.ActivateExt1Impl1; +import org.apache.dubbo.common.extension.activate.impl.GroupActivateExtImpl; +import org.apache.dubbo.common.extension.activate.impl.OrderActivateExtImpl1; +import org.apache.dubbo.common.extension.activate.impl.OrderActivateExtImpl2; +import org.apache.dubbo.common.extension.activate.impl.ValueActivateExtImpl; +import org.apache.dubbo.common.extension.ext1.SimpleExt; +import org.apache.dubbo.common.extension.ext1.impl.SimpleExtImpl1; +import org.apache.dubbo.common.extension.ext1.impl.SimpleExtImpl2; +import org.apache.dubbo.common.extension.ext2.Ext2; +import org.apache.dubbo.common.extension.ext6_wrap.WrappedExt; +import org.apache.dubbo.common.extension.ext6_wrap.impl.Ext5Wrapper1; +import org.apache.dubbo.common.extension.ext6_wrap.impl.Ext5Wrapper2; +import org.apache.dubbo.common.extension.ext7.InitErrorExt; +import org.apache.dubbo.common.extension.ext8_add.AddExt1; +import org.apache.dubbo.common.extension.ext8_add.AddExt2; +import org.apache.dubbo.common.extension.ext8_add.AddExt3; +import org.apache.dubbo.common.extension.ext8_add.AddExt4; +import org.apache.dubbo.common.extension.ext8_add.impl.AddExt1Impl1; +import org.apache.dubbo.common.extension.ext8_add.impl.AddExt1_ManualAdaptive; +import org.apache.dubbo.common.extension.ext8_add.impl.AddExt1_ManualAdd1; +import org.apache.dubbo.common.extension.ext8_add.impl.AddExt1_ManualAdd2; +import org.apache.dubbo.common.extension.ext8_add.impl.AddExt2_ManualAdaptive; +import org.apache.dubbo.common.extension.ext8_add.impl.AddExt3_ManualAdaptive; +import org.apache.dubbo.common.extension.ext8_add.impl.AddExt4_ManualAdaptive; +import org.apache.dubbo.common.extension.ext9_empty.Ext9Empty; +import org.apache.dubbo.common.extension.ext9_empty.impl.Ext9EmptyImpl; import org.junit.Assert; import org.junit.Test; @@ -84,7 +83,7 @@ public void test_getExtensionLoader_NotInterface() throws Exception { fail(); } catch (IllegalArgumentException expected) { assertThat(expected.getMessage(), - containsString("Extension type(class org.apache.dubbo.common.extensionloader.ExtensionLoaderTest) is not interface")); + containsString("Extension type(class org.apache.dubbo.common.extension.ExtensionLoaderTest) is not interface")); } } @@ -95,7 +94,7 @@ public void test_getExtensionLoader_NotSpiAnnotation() throws Exception { fail(); } catch (IllegalArgumentException expected) { assertThat(expected.getMessage(), - allOf(containsString("org.apache.dubbo.common.extensionloader.NoSpiExt"), + allOf(containsString("org.apache.dubbo.common.extension.NoSpiExt"), containsString("is not extension"), containsString("WITHOUT @SPI Annotation"))); } @@ -149,7 +148,7 @@ public void test_getExtension_ExceptionNoExtension() throws Exception { ExtensionLoader.getExtensionLoader(SimpleExt.class).getExtension("XXX"); fail(); } catch (IllegalStateException expected) { - assertThat(expected.getMessage(), containsString("No such extension org.apache.dubbo.common.extensionloader.ext1.SimpleExt by name XXX")); + assertThat(expected.getMessage(), containsString("No such extension org.apache.dubbo.common.extension.ext1.SimpleExt by name XXX")); } } @@ -159,7 +158,7 @@ public void test_getExtension_ExceptionNoExtension_WrapperNotAffactName() throws ExtensionLoader.getExtensionLoader(WrappedExt.class).getExtension("XXX"); fail(); } catch (IllegalStateException expected) { - assertThat(expected.getMessage(), containsString("No such extension org.apache.dubbo.common.extensionloader.ext6_wrap.WrappedExt by name XXX")); + assertThat(expected.getMessage(), containsString("No such extension org.apache.dubbo.common.extension.ext6_wrap.WrappedExt by name XXX")); } } @@ -232,7 +231,7 @@ public void test_AddExtension() throws Exception { ExtensionLoader.getExtensionLoader(AddExt1.class).getExtension("Manual1"); fail(); } catch (IllegalStateException expected) { - assertThat(expected.getMessage(), containsString("No such extension org.apache.dubbo.common.extensionloader.ext8_add.AddExt1 by name Manual")); + assertThat(expected.getMessage(), containsString("No such extension org.apache.dubbo.common.extension.ext8_add.AddExt1 by name Manual")); } ExtensionLoader.getExtensionLoader(AddExt1.class).addExtension("Manual1", AddExt1_ManualAdd1.class); @@ -260,7 +259,7 @@ public void test_AddExtension_ExceptionWhenExistedExtension() throws Exception { ExtensionLoader.getExtensionLoader(AddExt1.class).addExtension("impl1", AddExt1_ManualAdd1.class); fail(); } catch (IllegalStateException expected) { - assertThat(expected.getMessage(), containsString("Extension name impl1 already existed(Extension interface org.apache.dubbo.common.extensionloader.ext8_add.AddExt1)!")); + assertThat(expected.getMessage(), containsString("Extension name impl1 already existed(Extension interface org.apache.dubbo.common.extension.ext8_add.AddExt1)!")); } } @@ -283,7 +282,7 @@ public void test_AddExtension_Adaptive_ExceptionWhenExistedAdaptive() throws Exc loader.addExtension(null, AddExt1_ManualAdaptive.class); fail(); } catch (IllegalStateException expected) { - assertThat(expected.getMessage(), containsString("Adaptive Extension already existed(Extension interface org.apache.dubbo.common.extensionloader.ext8_add.AddExt1)!")); + assertThat(expected.getMessage(), containsString("Adaptive Extension already existed(Extension interface org.apache.dubbo.common.extension.ext8_add.AddExt1)!")); } } @@ -293,7 +292,7 @@ public void test_replaceExtension() throws Exception { ExtensionLoader.getExtensionLoader(AddExt1.class).getExtension("Manual2"); fail(); } catch (IllegalStateException expected) { - assertThat(expected.getMessage(), containsString("No such extension org.apache.dubbo.common.extensionloader.ext8_add.AddExt1 by name Manual")); + assertThat(expected.getMessage(), containsString("No such extension org.apache.dubbo.common.extension.ext8_add.AddExt1 by name Manual")); } { @@ -332,7 +331,7 @@ public void test_replaceExtension_ExceptionWhenNotExistedExtension() throws Exce ExtensionLoader.getExtensionLoader(AddExt1.class).replaceExtension("NotExistedExtension", AddExt1_ManualAdd1.class); fail(); } catch (IllegalStateException expected) { - assertThat(expected.getMessage(), containsString("Extension name NotExistedExtension not existed(Extension interface org.apache.dubbo.common.extensionloader.ext8_add.AddExt1)")); + assertThat(expected.getMessage(), containsString("Extension name NotExistedExtension not existed(Extension interface org.apache.dubbo.common.extension.ext8_add.AddExt1)")); } } @@ -344,7 +343,7 @@ public void test_replaceExtension_Adaptive_ExceptionWhenNotExistedExtension() th loader.replaceExtension(null, AddExt4_ManualAdaptive.class); fail(); } catch (IllegalStateException expected) { - assertThat(expected.getMessage(), containsString("Adaptive Extension not existed(Extension interface org.apache.dubbo.common.extensionloader.ext8_add.AddExt4)")); + assertThat(expected.getMessage(), containsString("Adaptive Extension not existed(Extension interface org.apache.dubbo.common.extension.ext8_add.AddExt4)")); } } @@ -358,7 +357,7 @@ public void test_InitError() throws Exception { loader.getExtension("error"); fail(); } catch (IllegalStateException expected) { - assertThat(expected.getMessage(), containsString("Failed to load extension class(interface: interface org.apache.dubbo.common.extensionloader.ext7.InitErrorExt")); + assertThat(expected.getMessage(), containsString("Failed to load extension class(interface: interface org.apache.dubbo.common.extension.ext7.InitErrorExt")); assertThat(expected.getCause(), instanceOf(ExceptionInInitializerError.class)); } } diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ExtensionLoader_Adaptive_Test.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Adaptive_Test.java similarity index 86% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ExtensionLoader_Adaptive_Test.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Adaptive_Test.java index 0fd8e41e71c..47942030a12 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ExtensionLoader_Adaptive_Test.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Adaptive_Test.java @@ -14,20 +14,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader; +package org.apache.dubbo.common.extension; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extension.ExtensionLoader; -import org.apache.dubbo.common.extensionloader.adaptive.HasAdaptiveExt; -import org.apache.dubbo.common.extensionloader.adaptive.impl.HasAdaptiveExt_ManualAdaptive; -import org.apache.dubbo.common.extensionloader.ext1.SimpleExt; -import org.apache.dubbo.common.extensionloader.ext2.Ext2; -import org.apache.dubbo.common.extensionloader.ext2.UrlHolder; -import org.apache.dubbo.common.extensionloader.ext3.UseProtocolKeyExt; -import org.apache.dubbo.common.extensionloader.ext4.NoUrlParamExt; -import org.apache.dubbo.common.extensionloader.ext5.NoAdaptiveMethodExt; -import org.apache.dubbo.common.extensionloader.ext6_inject.Ext6; -import org.apache.dubbo.common.extensionloader.ext6_inject.impl.Ext6Impl2; +import org.apache.dubbo.common.extension.adaptive.HasAdaptiveExt; +import org.apache.dubbo.common.extension.adaptive.impl.HasAdaptiveExt_ManualAdaptive; +import org.apache.dubbo.common.extension.ext1.SimpleExt; +import org.apache.dubbo.common.extension.ext2.Ext2; +import org.apache.dubbo.common.extension.ext2.UrlHolder; +import org.apache.dubbo.common.extension.ext3.UseProtocolKeyExt; +import org.apache.dubbo.common.extension.ext4.NoUrlParamExt; +import org.apache.dubbo.common.extension.ext5.NoAdaptiveMethodExt; +import org.apache.dubbo.common.extension.ext6_inject.Ext6; +import org.apache.dubbo.common.extension.ext6_inject.impl.Ext6Impl2; import org.apache.dubbo.common.utils.LogUtil; import org.junit.Assert; @@ -148,8 +147,8 @@ public void test_getAdaptiveExtension_ExceptionWhenNoAdaptiveMethodOnInterface() fail(); } catch (IllegalStateException expected) { assertThat(expected.getMessage(), - allOf(containsString("Can not create adaptive extension interface org.apache.dubbo.common.extensionloader.ext5.NoAdaptiveMethodExt"), - containsString("No adaptive method on extension org.apache.dubbo.common.extensionloader.ext5.NoAdaptiveMethodExt, refuse to create the adaptive class"))); + allOf(containsString("Can not create adaptive extension interface org.apache.dubbo.common.extension.ext5.NoAdaptiveMethodExt"), + containsString("No adaptive method on extension org.apache.dubbo.common.extension.ext5.NoAdaptiveMethodExt, refuse to create the adaptive class"))); } // report same error when get is invoked for multiple times try { @@ -157,8 +156,8 @@ public void test_getAdaptiveExtension_ExceptionWhenNoAdaptiveMethodOnInterface() fail(); } catch (IllegalStateException expected) { assertThat(expected.getMessage(), - allOf(containsString("Can not create adaptive extension interface org.apache.dubbo.common.extensionloader.ext5.NoAdaptiveMethodExt"), - containsString("No adaptive method on extension org.apache.dubbo.common.extensionloader.ext5.NoAdaptiveMethodExt, refuse to create the adaptive class"))); + allOf(containsString("Can not create adaptive extension interface org.apache.dubbo.common.extension.ext5.NoAdaptiveMethodExt"), + containsString("No adaptive method on extension org.apache.dubbo.common.extension.ext5.NoAdaptiveMethodExt, refuse to create the adaptive class"))); } } @@ -176,7 +175,7 @@ public void test_getAdaptiveExtension_ExceptionWhenNotAdaptiveMethod() throws Ex assertThat(expected.getMessage(), containsString("method ")); assertThat( expected.getMessage(), - containsString("of interface org.apache.dubbo.common.extensionloader.ext1.SimpleExt is not adaptive method!")); + containsString("of interface org.apache.dubbo.common.extension.ext1.SimpleExt is not adaptive method!")); } } @@ -240,14 +239,14 @@ public void test_urlHolder_getAdaptiveExtension_UrlNpe() throws Exception { ext.echo(null, "haha"); fail(); } catch (IllegalArgumentException e) { - assertEquals("org.apache.dubbo.common.extensionloader.ext2.UrlHolder argument == null", e.getMessage()); + assertEquals("org.apache.dubbo.common.extension.ext2.UrlHolder argument == null", e.getMessage()); } try { ext.echo(new UrlHolder(), "haha"); fail(); } catch (IllegalArgumentException e) { - assertEquals("org.apache.dubbo.common.extensionloader.ext2.UrlHolder argument getUrl() == null", e.getMessage()); + assertEquals("org.apache.dubbo.common.extension.ext2.UrlHolder argument getUrl() == null", e.getMessage()); } } @@ -265,7 +264,7 @@ public void test_urlHolder_getAdaptiveExtension_ExceptionWhenNotAdativeMethod() assertThat(expected.getMessage(), containsString("method ")); assertThat( expected.getMessage(), - containsString("of interface org.apache.dubbo.common.extensionloader.ext2.Ext2 is not adaptive method!")); + containsString("of interface org.apache.dubbo.common.extension.ext2.Ext2 is not adaptive method!")); } } @@ -291,7 +290,7 @@ public void test_urlHolder_getAdaptiveExtension_ExceptionWhenNameNotProvided() t ext.echo(holder, "haha"); fail(); } catch (IllegalStateException expected) { - assertThat(expected.getMessage(), containsString("Fail to get extension(org.apache.dubbo.common.extensionloader.ext2.Ext2) name from url")); + assertThat(expected.getMessage(), containsString("Fail to get extension(org.apache.dubbo.common.extension.ext2.Ext2) name from url")); } } diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ExtensionLoader_Adaptive_UseJdkCompiler_Test.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Adaptive_UseJdkCompiler_Test.java similarity index 96% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ExtensionLoader_Adaptive_UseJdkCompiler_Test.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Adaptive_UseJdkCompiler_Test.java index 46d08358b97..51ac8f765d9 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ExtensionLoader_Adaptive_UseJdkCompiler_Test.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Adaptive_UseJdkCompiler_Test.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader; +package org.apache.dubbo.common.extension; import org.apache.dubbo.common.compiler.support.AdaptiveCompiler; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ExtensionLoader_Compatible_Test.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Compatible_Test.java similarity index 78% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ExtensionLoader_Compatible_Test.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Compatible_Test.java index 137ae302c94..f11aff73b6f 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ExtensionLoader_Compatible_Test.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ExtensionLoader_Compatible_Test.java @@ -14,12 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader; +package org.apache.dubbo.common.extension; -import org.apache.dubbo.common.extension.ExtensionLoader; -import org.apache.dubbo.common.extensionloader.compatible.CompatibleExt; -import org.apache.dubbo.common.extensionloader.compatible.impl.CompatibleExtImpl1; -import org.apache.dubbo.common.extensionloader.compatible.impl.CompatibleExtImpl2; +import org.apache.dubbo.common.extension.compatible.CompatibleExt; +import org.apache.dubbo.common.extension.compatible.impl.CompatibleExtImpl1; +import org.apache.dubbo.common.extension.compatible.impl.CompatibleExtImpl2; import org.junit.Test; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/NoSpiExt.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/NoSpiExt.java similarity index 90% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/NoSpiExt.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/NoSpiExt.java index 6ec06b3e7d9..44d77608d01 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/NoSpiExt.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/NoSpiExt.java @@ -14,10 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader; +package org.apache.dubbo.common.extension; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extension.Adaptive; /** * Has no SPI annotation diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/ActivateExt1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/ActivateExt1.java similarity index 94% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/ActivateExt1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/ActivateExt1.java index cd53052a31f..c00a988577d 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/ActivateExt1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/ActivateExt1.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.activate; +package org.apache.dubbo.common.extension.activate; import org.apache.dubbo.common.extension.SPI; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/impl/ActivateExt1Impl1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/impl/ActivateExt1Impl1.java similarity index 88% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/impl/ActivateExt1Impl1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/impl/ActivateExt1Impl1.java index 41bd2cf2da3..c0121ff5974 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/impl/ActivateExt1Impl1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/impl/ActivateExt1Impl1.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.activate.impl; +package org.apache.dubbo.common.extension.activate.impl; import org.apache.dubbo.common.extension.Activate; -import org.apache.dubbo.common.extensionloader.activate.ActivateExt1; +import org.apache.dubbo.common.extension.activate.ActivateExt1; @Activate(group = {"default_group"}) public class ActivateExt1Impl1 implements ActivateExt1 { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/impl/GroupActivateExtImpl.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/impl/GroupActivateExtImpl.java similarity index 88% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/impl/GroupActivateExtImpl.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/impl/GroupActivateExtImpl.java index a63072e7074..89ca54caa07 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/impl/GroupActivateExtImpl.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/impl/GroupActivateExtImpl.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.activate.impl; +package org.apache.dubbo.common.extension.activate.impl; import org.apache.dubbo.common.extension.Activate; -import org.apache.dubbo.common.extensionloader.activate.ActivateExt1; +import org.apache.dubbo.common.extension.activate.ActivateExt1; @Activate(group = {"group1", "group2"}) public class GroupActivateExtImpl implements ActivateExt1 { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/impl/OrderActivateExtImpl1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/impl/OrderActivateExtImpl1.java similarity index 88% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/impl/OrderActivateExtImpl1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/impl/OrderActivateExtImpl1.java index df3accb7923..b84ff21cc7e 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/impl/OrderActivateExtImpl1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/impl/OrderActivateExtImpl1.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.activate.impl; +package org.apache.dubbo.common.extension.activate.impl; import org.apache.dubbo.common.extension.Activate; -import org.apache.dubbo.common.extensionloader.activate.ActivateExt1; +import org.apache.dubbo.common.extension.activate.ActivateExt1; @Activate(order = 1, group = {"order"}) public class OrderActivateExtImpl1 implements ActivateExt1 { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/impl/OrderActivateExtImpl2.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/impl/OrderActivateExtImpl2.java similarity index 88% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/impl/OrderActivateExtImpl2.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/impl/OrderActivateExtImpl2.java index e8445145542..6a63dfca4ed 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/impl/OrderActivateExtImpl2.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/impl/OrderActivateExtImpl2.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.activate.impl; +package org.apache.dubbo.common.extension.activate.impl; import org.apache.dubbo.common.extension.Activate; -import org.apache.dubbo.common.extensionloader.activate.ActivateExt1; +import org.apache.dubbo.common.extension.activate.ActivateExt1; @Activate(order = 2, group = {"order"}) public class OrderActivateExtImpl2 implements ActivateExt1 { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/impl/ValueActivateExtImpl.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/impl/ValueActivateExtImpl.java similarity index 88% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/impl/ValueActivateExtImpl.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/impl/ValueActivateExtImpl.java index 29394db3e6c..85d2e5be592 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/activate/impl/ValueActivateExtImpl.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/activate/impl/ValueActivateExtImpl.java @@ -15,10 +15,10 @@ * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.activate.impl; +package org.apache.dubbo.common.extension.activate.impl; import org.apache.dubbo.common.extension.Activate; -import org.apache.dubbo.common.extensionloader.activate.ActivateExt1; +import org.apache.dubbo.common.extension.activate.ActivateExt1; @Activate(value = {"value"}, group = {"value"}) public class ValueActivateExtImpl implements ActivateExt1 { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/adaptive/HasAdaptiveExt.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/adaptive/HasAdaptiveExt.java similarity index 94% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/adaptive/HasAdaptiveExt.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/adaptive/HasAdaptiveExt.java index 062118448e6..534edd8690a 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/adaptive/HasAdaptiveExt.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/adaptive/HasAdaptiveExt.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.adaptive; +package org.apache.dubbo.common.extension.adaptive; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.Adaptive; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/adaptive/impl/HasAdaptiveExtImpl1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/adaptive/impl/HasAdaptiveExtImpl1.java similarity index 88% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/adaptive/impl/HasAdaptiveExtImpl1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/adaptive/impl/HasAdaptiveExtImpl1.java index 52f5747f3ce..bf9afc35174 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/adaptive/impl/HasAdaptiveExtImpl1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/adaptive/impl/HasAdaptiveExtImpl1.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.adaptive.impl; +package org.apache.dubbo.common.extension.adaptive.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.adaptive.HasAdaptiveExt; +import org.apache.dubbo.common.extension.adaptive.HasAdaptiveExt; public class HasAdaptiveExtImpl1 implements HasAdaptiveExt { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/adaptive/impl/HasAdaptiveExt_ManualAdaptive.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/adaptive/impl/HasAdaptiveExt_ManualAdaptive.java similarity index 90% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/adaptive/impl/HasAdaptiveExt_ManualAdaptive.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/adaptive/impl/HasAdaptiveExt_ManualAdaptive.java index 96b88cdd84e..e08608ac41a 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/adaptive/impl/HasAdaptiveExt_ManualAdaptive.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/adaptive/impl/HasAdaptiveExt_ManualAdaptive.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.adaptive.impl; +package org.apache.dubbo.common.extension.adaptive.impl; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.Adaptive; import org.apache.dubbo.common.extension.ExtensionLoader; -import org.apache.dubbo.common.extensionloader.adaptive.HasAdaptiveExt; +import org.apache.dubbo.common.extension.adaptive.HasAdaptiveExt; @Adaptive public class HasAdaptiveExt_ManualAdaptive implements HasAdaptiveExt { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/compatible/CompatibleExt.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/compatible/CompatibleExt.java similarity index 94% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/compatible/CompatibleExt.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/compatible/CompatibleExt.java index 20fc98c5881..a29cba996c9 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/compatible/CompatibleExt.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/compatible/CompatibleExt.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.compatible; +package org.apache.dubbo.common.extension.compatible; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.Adaptive; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/compatible/impl/CompatibleExtImpl1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/compatible/impl/CompatibleExtImpl1.java similarity index 89% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/compatible/impl/CompatibleExtImpl1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/compatible/impl/CompatibleExtImpl1.java index b30a6fe08d1..9148fa18dc2 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/compatible/impl/CompatibleExtImpl1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/compatible/impl/CompatibleExtImpl1.java @@ -14,11 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.compatible.impl; +package org.apache.dubbo.common.extension.compatible.impl; import org.apache.dubbo.common.Extension; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.compatible.CompatibleExt; +import org.apache.dubbo.common.extension.compatible.CompatibleExt; @Extension("impl1") public class CompatibleExtImpl1 implements CompatibleExt { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/compatible/impl/CompatibleExtImpl2.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/compatible/impl/CompatibleExtImpl2.java similarity index 89% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/compatible/impl/CompatibleExtImpl2.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/compatible/impl/CompatibleExtImpl2.java index ccbf04e54b4..316f4fdc41e 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/compatible/impl/CompatibleExtImpl2.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/compatible/impl/CompatibleExtImpl2.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.compatible.impl; +package org.apache.dubbo.common.extension.compatible.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.compatible.CompatibleExt; +import org.apache.dubbo.common.extension.compatible.CompatibleExt; public class CompatibleExtImpl2 implements CompatibleExt { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext1/SimpleExt.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext1/SimpleExt.java similarity index 95% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext1/SimpleExt.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext1/SimpleExt.java index 34267d96b79..5e6d32fd3a5 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext1/SimpleExt.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext1/SimpleExt.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext1; +package org.apache.dubbo.common.extension.ext1; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.Adaptive; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext1/impl/SimpleExtImpl1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext1/impl/SimpleExtImpl1.java similarity index 90% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext1/impl/SimpleExtImpl1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext1/impl/SimpleExtImpl1.java index 182dbd0ce48..e1c840d69dc 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext1/impl/SimpleExtImpl1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext1/impl/SimpleExtImpl1.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext1.impl; +package org.apache.dubbo.common.extension.ext1.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext1.SimpleExt; +import org.apache.dubbo.common.extension.ext1.SimpleExt; public class SimpleExtImpl1 implements SimpleExt { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext1/impl/SimpleExtImpl2.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext1/impl/SimpleExtImpl2.java similarity index 90% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext1/impl/SimpleExtImpl2.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext1/impl/SimpleExtImpl2.java index 9882c39ee25..133fffdc3fa 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext1/impl/SimpleExtImpl2.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext1/impl/SimpleExtImpl2.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext1.impl; +package org.apache.dubbo.common.extension.ext1.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext1.SimpleExt; +import org.apache.dubbo.common.extension.ext1.SimpleExt; public class SimpleExtImpl2 implements SimpleExt { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext1/impl/SimpleExtImpl3.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext1/impl/SimpleExtImpl3.java similarity index 90% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext1/impl/SimpleExtImpl3.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext1/impl/SimpleExtImpl3.java index 4d987fe6a4c..78d177e6bfe 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext1/impl/SimpleExtImpl3.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext1/impl/SimpleExtImpl3.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext1.impl; +package org.apache.dubbo.common.extension.ext1.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext1.SimpleExt; +import org.apache.dubbo.common.extension.ext1.SimpleExt; public class SimpleExtImpl3 implements SimpleExt { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext2/Ext2.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext2/Ext2.java similarity index 93% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext2/Ext2.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext2/Ext2.java index c9948c62fbc..a7c89506578 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext2/Ext2.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext2/Ext2.java @@ -1,33 +1,33 @@ -/* - * 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.dubbo.common.extensionloader.ext2; - -import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extension.Adaptive; -import org.apache.dubbo.common.extension.SPI; - -/** - * Has no default - */ -@SPI -public interface Ext2 { - // one of the properties of an argument is an instance of URL. - @Adaptive - String echo(UrlHolder holder, String s); - - String bang(URL url, int i); +/* + * 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.dubbo.common.extension.ext2; + +import org.apache.dubbo.common.URL; +import org.apache.dubbo.common.extension.Adaptive; +import org.apache.dubbo.common.extension.SPI; + +/** + * Has no default + */ +@SPI +public interface Ext2 { + // one of the properties of an argument is an instance of URL. + @Adaptive + String echo(UrlHolder holder, String s); + + String bang(URL url, int i); } \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext2/UrlHolder.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext2/UrlHolder.java similarity index 96% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext2/UrlHolder.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext2/UrlHolder.java index 56b832f5f02..47146763e98 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext2/UrlHolder.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext2/UrlHolder.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext2; +package org.apache.dubbo.common.extension.ext2; import org.apache.dubbo.common.URL; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext2/impl/Ext2Impl1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext2/impl/Ext2Impl1.java similarity index 83% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext2/impl/Ext2Impl1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext2/impl/Ext2Impl1.java index 6fa34a858b7..e5d25607110 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext2/impl/Ext2Impl1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext2/impl/Ext2Impl1.java @@ -1,31 +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.dubbo.common.extensionloader.ext2.impl; - -import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext2.Ext2; -import org.apache.dubbo.common.extensionloader.ext2.UrlHolder; - -public class Ext2Impl1 implements Ext2 { - public String echo(UrlHolder holder, String s) { - return "Ext2Impl1-echo"; - } - - public String bang(URL url, int i) { - return "bang1"; - } +/* + * 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.dubbo.common.extension.ext2.impl; + +import org.apache.dubbo.common.URL; +import org.apache.dubbo.common.extension.ext2.Ext2; +import org.apache.dubbo.common.extension.ext2.UrlHolder; + +public class Ext2Impl1 implements Ext2 { + public String echo(UrlHolder holder, String s) { + return "Ext2Impl1-echo"; + } + + public String bang(URL url, int i) { + return "bang1"; + } } \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext2/impl/Ext2Impl2.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext2/impl/Ext2Impl2.java similarity index 83% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext2/impl/Ext2Impl2.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext2/impl/Ext2Impl2.java index bfad56eb8c6..d9d67939f06 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext2/impl/Ext2Impl2.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext2/impl/Ext2Impl2.java @@ -1,32 +1,32 @@ -/* - * 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.dubbo.common.extensionloader.ext2.impl; - -import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext2.Ext2; -import org.apache.dubbo.common.extensionloader.ext2.UrlHolder; - -public class Ext2Impl2 implements Ext2 { - public String echo(UrlHolder holder, String s) { - return "Ext2Impl2-echo"; - } - - public String bang(URL url, int i) { - return "bang2"; - } - +/* + * 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.dubbo.common.extension.ext2.impl; + +import org.apache.dubbo.common.URL; +import org.apache.dubbo.common.extension.ext2.Ext2; +import org.apache.dubbo.common.extension.ext2.UrlHolder; + +public class Ext2Impl2 implements Ext2 { + public String echo(UrlHolder holder, String s) { + return "Ext2Impl2-echo"; + } + + public String bang(URL url, int i) { + return "bang2"; + } + } \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext2/impl/Ext2Impl3.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext2/impl/Ext2Impl3.java similarity index 83% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext2/impl/Ext2Impl3.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext2/impl/Ext2Impl3.java index 952ec8c87a3..b7adde1a695 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext2/impl/Ext2Impl3.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext2/impl/Ext2Impl3.java @@ -1,32 +1,32 @@ -/* - * 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.dubbo.common.extensionloader.ext2.impl; - -import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext2.Ext2; -import org.apache.dubbo.common.extensionloader.ext2.UrlHolder; - -public class Ext2Impl3 implements Ext2 { - public String echo(UrlHolder holder, String s) { - return "Ext2Impl3-echo"; - } - - public String bang(URL url, int i) { - return "bang3"; - } - +/* + * 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.dubbo.common.extension.ext2.impl; + +import org.apache.dubbo.common.URL; +import org.apache.dubbo.common.extension.ext2.Ext2; +import org.apache.dubbo.common.extension.ext2.UrlHolder; + +public class Ext2Impl3 implements Ext2 { + public String echo(UrlHolder holder, String s) { + return "Ext2Impl3-echo"; + } + + public String bang(URL url, int i) { + return "bang3"; + } + } \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext3/UseProtocolKeyExt.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext3/UseProtocolKeyExt.java similarity index 95% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext3/UseProtocolKeyExt.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext3/UseProtocolKeyExt.java index efebec8a116..1b42e9aa220 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext3/UseProtocolKeyExt.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext3/UseProtocolKeyExt.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext3; +package org.apache.dubbo.common.extension.ext3; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.Adaptive; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext3/impl/UseProtocolKeyExtImpl1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext3/impl/UseProtocolKeyExtImpl1.java similarity index 89% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext3/impl/UseProtocolKeyExtImpl1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext3/impl/UseProtocolKeyExtImpl1.java index 08516122f54..d78297987e9 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext3/impl/UseProtocolKeyExtImpl1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext3/impl/UseProtocolKeyExtImpl1.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext3.impl; +package org.apache.dubbo.common.extension.ext3.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext3.UseProtocolKeyExt; +import org.apache.dubbo.common.extension.ext3.UseProtocolKeyExt; public class UseProtocolKeyExtImpl1 implements UseProtocolKeyExt { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext3/impl/UseProtocolKeyExtImpl2.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext3/impl/UseProtocolKeyExtImpl2.java similarity index 89% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext3/impl/UseProtocolKeyExtImpl2.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext3/impl/UseProtocolKeyExtImpl2.java index cbb8885b64a..958513d5a36 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext3/impl/UseProtocolKeyExtImpl2.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext3/impl/UseProtocolKeyExtImpl2.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext3.impl; +package org.apache.dubbo.common.extension.ext3.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext3.UseProtocolKeyExt; +import org.apache.dubbo.common.extension.ext3.UseProtocolKeyExt; public class UseProtocolKeyExtImpl2 implements UseProtocolKeyExt { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext3/impl/UseProtocolKeyExtImpl3.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext3/impl/UseProtocolKeyExtImpl3.java similarity index 89% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext3/impl/UseProtocolKeyExtImpl3.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext3/impl/UseProtocolKeyExtImpl3.java index b5474ab2f50..7293725f4e8 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext3/impl/UseProtocolKeyExtImpl3.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext3/impl/UseProtocolKeyExtImpl3.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext3.impl; +package org.apache.dubbo.common.extension.ext3.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext3.UseProtocolKeyExt; +import org.apache.dubbo.common.extension.ext3.UseProtocolKeyExt; public class UseProtocolKeyExtImpl3 implements UseProtocolKeyExt { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext4/NoUrlParamExt.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext4/NoUrlParamExt.java similarity index 95% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext4/NoUrlParamExt.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext4/NoUrlParamExt.java index 89cdeff91ff..2c9613bbbb3 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext4/NoUrlParamExt.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext4/NoUrlParamExt.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext4; +package org.apache.dubbo.common.extension.ext4; import org.apache.dubbo.common.extension.Adaptive; import org.apache.dubbo.common.extension.SPI; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext4/impl/Ext4Impl1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext4/impl/Ext4Impl1.java similarity index 86% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext4/impl/Ext4Impl1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext4/impl/Ext4Impl1.java index c9aa0d8eae2..fe02b773f9e 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext4/impl/Ext4Impl1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext4/impl/Ext4Impl1.java @@ -1,27 +1,27 @@ -/* - * 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.dubbo.common.extensionloader.ext4.impl; - -import org.apache.dubbo.common.extensionloader.ext4.NoUrlParamExt; - -import java.util.List; - -public class Ext4Impl1 implements NoUrlParamExt { - public String bark(String name, List list) { - return null; - } +/* + * 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.dubbo.common.extension.ext4.impl; + +import org.apache.dubbo.common.extension.ext4.NoUrlParamExt; + +import java.util.List; + +public class Ext4Impl1 implements NoUrlParamExt { + public String bark(String name, List list) { + return null; + } } \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext4/impl/Ext4Impl2.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext4/impl/Ext4Impl2.java similarity index 86% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext4/impl/Ext4Impl2.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext4/impl/Ext4Impl2.java index 79adef0aa94..2f25a5f901d 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext4/impl/Ext4Impl2.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext4/impl/Ext4Impl2.java @@ -1,28 +1,28 @@ -/* - * 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.dubbo.common.extensionloader.ext4.impl; - -import org.apache.dubbo.common.extensionloader.ext4.NoUrlParamExt; - -import java.util.List; - -public class Ext4Impl2 implements NoUrlParamExt { - public String bark(String name, List list) { - return null; - } - +/* + * 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.dubbo.common.extension.ext4.impl; + +import org.apache.dubbo.common.extension.ext4.NoUrlParamExt; + +import java.util.List; + +public class Ext4Impl2 implements NoUrlParamExt { + public String bark(String name, List list) { + return null; + } + } \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext5/NoAdaptiveMethodExt.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext5/NoAdaptiveMethodExt.java similarity index 94% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext5/NoAdaptiveMethodExt.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext5/NoAdaptiveMethodExt.java index c6374c658c1..e4d157253b4 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext5/NoAdaptiveMethodExt.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext5/NoAdaptiveMethodExt.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext5; +package org.apache.dubbo.common.extension.ext5; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.SPI; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext5/impl/Ext5Impl1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext5/impl/Ext5Impl1.java similarity index 88% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext5/impl/Ext5Impl1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext5/impl/Ext5Impl1.java index bdf7ab5c577..e7c6519efba 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext5/impl/Ext5Impl1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext5/impl/Ext5Impl1.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext5.impl; +package org.apache.dubbo.common.extension.ext5.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext5.NoAdaptiveMethodExt; +import org.apache.dubbo.common.extension.ext5.NoAdaptiveMethodExt; public class Ext5Impl1 implements NoAdaptiveMethodExt { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext5/impl/Ext5Impl2.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext5/impl/Ext5Impl2.java similarity index 88% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext5/impl/Ext5Impl2.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext5/impl/Ext5Impl2.java index 6f3dbd0ea51..d10602c6885 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext5/impl/Ext5Impl2.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext5/impl/Ext5Impl2.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext5.impl; +package org.apache.dubbo.common.extension.ext5.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext5.NoAdaptiveMethodExt; +import org.apache.dubbo.common.extension.ext5.NoAdaptiveMethodExt; public class Ext5Impl2 implements NoAdaptiveMethodExt { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_inject/Dao.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/Dao.java similarity index 93% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_inject/Dao.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/Dao.java index d47f6b1ef47..0052d81ca32 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_inject/Dao.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/Dao.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext6_inject; +package org.apache.dubbo.common.extension.ext6_inject; public interface Dao { public void update(); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_inject/Ext6.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/Ext6.java similarity index 92% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_inject/Ext6.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/Ext6.java index 1ac0a8fc821..baa4bf254d9 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_inject/Ext6.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/Ext6.java @@ -1,30 +1,30 @@ -/* - * 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.dubbo.common.extensionloader.ext6_inject; - -import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extension.Adaptive; -import org.apache.dubbo.common.extension.SPI; - -/** - * No default - */ -@SPI -public interface Ext6 { - @Adaptive - String echo(URL url, String s); +/* + * 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.dubbo.common.extension.ext6_inject; + +import org.apache.dubbo.common.URL; +import org.apache.dubbo.common.extension.Adaptive; +import org.apache.dubbo.common.extension.SPI; + +/** + * No default + */ +@SPI +public interface Ext6 { + @Adaptive + String echo(URL url, String s); } \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_inject/impl/DaoImpl.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/impl/DaoImpl.java similarity index 87% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_inject/impl/DaoImpl.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/impl/DaoImpl.java index 9a5287c6fea..525bba89281 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_inject/impl/DaoImpl.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/impl/DaoImpl.java @@ -15,9 +15,9 @@ * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext6_inject.impl; +package org.apache.dubbo.common.extension.ext6_inject.impl; -import org.apache.dubbo.common.extensionloader.ext6_inject.Dao; +import org.apache.dubbo.common.extension.ext6_inject.Dao; public class DaoImpl implements Dao { public void update() { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_inject/impl/Ext6Impl1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/impl/Ext6Impl1.java similarity index 80% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_inject/impl/Ext6Impl1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/impl/Ext6Impl1.java index 88e9e6ee299..90d2c141ab0 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_inject/impl/Ext6Impl1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/impl/Ext6Impl1.java @@ -1,44 +1,44 @@ -/* - * 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.dubbo.common.extensionloader.ext6_inject.impl; - -import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext1.SimpleExt; -import org.apache.dubbo.common.extensionloader.ext6_inject.Dao; -import org.apache.dubbo.common.extensionloader.ext6_inject.Ext6; - -import org.junit.Assert; - -public class Ext6Impl1 implements Ext6 { - public Dao obj; - SimpleExt ext1; - - public void setDao(Dao obj) { - Assert.assertNotNull("inject extension instance can not be null", obj); - Assert.fail(); - } - - public void setExt1(SimpleExt ext1) { - this.ext1 = ext1; - } - - public String echo(URL url, String s) { - return "Ext6Impl1-echo-" + ext1.echo(url, s); - } - - +/* + * 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.dubbo.common.extension.ext6_inject.impl; + +import org.apache.dubbo.common.URL; +import org.apache.dubbo.common.extension.ext1.SimpleExt; +import org.apache.dubbo.common.extension.ext6_inject.Dao; +import org.apache.dubbo.common.extension.ext6_inject.Ext6; + +import org.junit.Assert; + +public class Ext6Impl1 implements Ext6 { + public Dao obj; + SimpleExt ext1; + + public void setDao(Dao obj) { + Assert.assertNotNull("inject extension instance can not be null", obj); + Assert.fail(); + } + + public void setExt1(SimpleExt ext1) { + this.ext1 = ext1; + } + + public String echo(URL url, String s) { + return "Ext6Impl1-echo-" + ext1.echo(url, s); + } + + } \ No newline at end of file diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_inject/impl/Ext6Impl2.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/impl/Ext6Impl2.java similarity index 89% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_inject/impl/Ext6Impl2.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/impl/Ext6Impl2.java index 5fd1844e126..75ced605719 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_inject/impl/Ext6Impl2.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_inject/impl/Ext6Impl2.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext6_inject.impl; +package org.apache.dubbo.common.extension.ext6_inject.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext6_inject.Ext6; +import org.apache.dubbo.common.extension.ext6_inject.Ext6; import java.util.List; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_wrap/WrappedExt.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_wrap/WrappedExt.java similarity index 94% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_wrap/WrappedExt.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_wrap/WrappedExt.java index cf007369667..164e0edd060 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_wrap/WrappedExt.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_wrap/WrappedExt.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext6_wrap; +package org.apache.dubbo.common.extension.ext6_wrap; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.SPI; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_wrap/impl/Ext5Impl1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_wrap/impl/Ext5Impl1.java similarity index 87% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_wrap/impl/Ext5Impl1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_wrap/impl/Ext5Impl1.java index a0cf4120202..52064a1b0f8 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_wrap/impl/Ext5Impl1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_wrap/impl/Ext5Impl1.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext6_wrap.impl; +package org.apache.dubbo.common.extension.ext6_wrap.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext6_wrap.WrappedExt; +import org.apache.dubbo.common.extension.ext6_wrap.WrappedExt; public class Ext5Impl1 implements WrappedExt { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_wrap/impl/Ext5Impl2.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_wrap/impl/Ext5Impl2.java similarity index 87% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_wrap/impl/Ext5Impl2.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_wrap/impl/Ext5Impl2.java index 75a7a7b2d99..82a8547603e 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_wrap/impl/Ext5Impl2.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_wrap/impl/Ext5Impl2.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext6_wrap.impl; +package org.apache.dubbo.common.extension.ext6_wrap.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext6_wrap.WrappedExt; +import org.apache.dubbo.common.extension.ext6_wrap.WrappedExt; public class Ext5Impl2 implements WrappedExt { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_wrap/impl/Ext5Wrapper1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_wrap/impl/Ext5Wrapper1.java similarity index 90% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_wrap/impl/Ext5Wrapper1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_wrap/impl/Ext5Wrapper1.java index 929b9fd92d2..54239b195f6 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_wrap/impl/Ext5Wrapper1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_wrap/impl/Ext5Wrapper1.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext6_wrap.impl; +package org.apache.dubbo.common.extension.ext6_wrap.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext6_wrap.WrappedExt; +import org.apache.dubbo.common.extension.ext6_wrap.WrappedExt; import java.util.concurrent.atomic.AtomicInteger; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_wrap/impl/Ext5Wrapper2.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_wrap/impl/Ext5Wrapper2.java similarity index 90% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_wrap/impl/Ext5Wrapper2.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_wrap/impl/Ext5Wrapper2.java index ea960942335..ec0acb9e1bc 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext6_wrap/impl/Ext5Wrapper2.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext6_wrap/impl/Ext5Wrapper2.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext6_wrap.impl; +package org.apache.dubbo.common.extension.ext6_wrap.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext6_wrap.WrappedExt; +import org.apache.dubbo.common.extension.ext6_wrap.WrappedExt; import java.util.concurrent.atomic.AtomicInteger; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext7/InitErrorExt.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext7/InitErrorExt.java similarity index 95% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext7/InitErrorExt.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext7/InitErrorExt.java index 5983803d4ae..9329917a1aa 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext7/InitErrorExt.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext7/InitErrorExt.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext7; +package org.apache.dubbo.common.extension.ext7; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.Adaptive; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext7/impl/Ext7Impl.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext7/impl/Ext7Impl.java similarity index 88% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext7/impl/Ext7Impl.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext7/impl/Ext7Impl.java index a3a1c4d6f17..0dbe3c33640 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext7/impl/Ext7Impl.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext7/impl/Ext7Impl.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext7.impl; +package org.apache.dubbo.common.extension.ext7.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext7.InitErrorExt; +import org.apache.dubbo.common.extension.ext7.InitErrorExt; public class Ext7Impl implements InitErrorExt { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext7/impl/Ext7InitErrorImpl.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext7/impl/Ext7InitErrorImpl.java similarity index 89% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext7/impl/Ext7InitErrorImpl.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext7/impl/Ext7InitErrorImpl.java index f55a5a34ef8..2aa04a89a06 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext7/impl/Ext7InitErrorImpl.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext7/impl/Ext7InitErrorImpl.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext7.impl; +package org.apache.dubbo.common.extension.ext7.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext7.InitErrorExt; +import org.apache.dubbo.common.extension.ext7.InitErrorExt; public class Ext7InitErrorImpl implements InitErrorExt { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/AddExt1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/AddExt1.java similarity index 94% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/AddExt1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/AddExt1.java index 9a501a223e2..89da8e61d23 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/AddExt1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/AddExt1.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext8_add; +package org.apache.dubbo.common.extension.ext8_add; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.Adaptive; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/AddExt2.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/AddExt2.java similarity index 95% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/AddExt2.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/AddExt2.java index 54a99815e2b..ea06e809c61 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/AddExt2.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/AddExt2.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext8_add; +package org.apache.dubbo.common.extension.ext8_add; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.Adaptive; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/AddExt3.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/AddExt3.java similarity index 95% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/AddExt3.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/AddExt3.java index 943c0fb82be..5872469a8b7 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/AddExt3.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/AddExt3.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext8_add; +package org.apache.dubbo.common.extension.ext8_add; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.Adaptive; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/AddExt4.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/AddExt4.java similarity index 95% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/AddExt4.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/AddExt4.java index 3e35d3cbcd9..e1839e4b4bd 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/AddExt4.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/AddExt4.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext8_add; +package org.apache.dubbo.common.extension.ext8_add; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.Adaptive; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt1Impl1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt1Impl1.java similarity index 88% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt1Impl1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt1Impl1.java index 56e9b4fb9ac..68fb586cd79 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt1Impl1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt1Impl1.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext8_add.impl; +package org.apache.dubbo.common.extension.ext8_add.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext8_add.AddExt1; +import org.apache.dubbo.common.extension.ext8_add.AddExt1; public class AddExt1Impl1 implements AddExt1 { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt1_ManualAdaptive.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt1_ManualAdaptive.java similarity index 90% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt1_ManualAdaptive.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt1_ManualAdaptive.java index e68ce8446a2..e0361d22a0c 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt1_ManualAdaptive.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt1_ManualAdaptive.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext8_add.impl; +package org.apache.dubbo.common.extension.ext8_add.impl; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.Adaptive; import org.apache.dubbo.common.extension.ExtensionLoader; -import org.apache.dubbo.common.extensionloader.ext8_add.AddExt1; +import org.apache.dubbo.common.extension.ext8_add.AddExt1; @Adaptive public class AddExt1_ManualAdaptive implements AddExt1 { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt1_ManualAdd1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt1_ManualAdd1.java similarity index 88% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt1_ManualAdd1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt1_ManualAdd1.java index a145456d818..623d50596d4 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt1_ManualAdd1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt1_ManualAdd1.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext8_add.impl; +package org.apache.dubbo.common.extension.ext8_add.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext8_add.AddExt1; +import org.apache.dubbo.common.extension.ext8_add.AddExt1; public class AddExt1_ManualAdd1 implements AddExt1 { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt1_ManualAdd2.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt1_ManualAdd2.java similarity index 88% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt1_ManualAdd2.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt1_ManualAdd2.java index 6b0e5762e13..adbd88f1825 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt1_ManualAdd2.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt1_ManualAdd2.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext8_add.impl; +package org.apache.dubbo.common.extension.ext8_add.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext8_add.AddExt1; +import org.apache.dubbo.common.extension.ext8_add.AddExt1; public class AddExt1_ManualAdd2 implements AddExt1 { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt2Impl1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt2Impl1.java similarity index 88% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt2Impl1.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt2Impl1.java index 0fabfcf307b..383f6588abb 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt2Impl1.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt2Impl1.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext8_add.impl; +package org.apache.dubbo.common.extension.ext8_add.impl; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.extensionloader.ext8_add.AddExt2; +import org.apache.dubbo.common.extension.ext8_add.AddExt2; public class AddExt2Impl1 implements AddExt2 { public String echo(URL url, String s) { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt2_ManualAdaptive.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt2_ManualAdaptive.java similarity index 90% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt2_ManualAdaptive.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt2_ManualAdaptive.java index 5c0508f9e8a..7673c770e7c 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt2_ManualAdaptive.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt2_ManualAdaptive.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext8_add.impl; +package org.apache.dubbo.common.extension.ext8_add.impl; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.Adaptive; import org.apache.dubbo.common.extension.ExtensionLoader; -import org.apache.dubbo.common.extensionloader.ext8_add.AddExt2; +import org.apache.dubbo.common.extension.ext8_add.AddExt2; @Adaptive public class AddExt2_ManualAdaptive implements AddExt2 { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt3_ManualAdaptive.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt3_ManualAdaptive.java similarity index 90% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt3_ManualAdaptive.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt3_ManualAdaptive.java index c946a9419fe..4d8936582a4 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt3_ManualAdaptive.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt3_ManualAdaptive.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext8_add.impl; +package org.apache.dubbo.common.extension.ext8_add.impl; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.Adaptive; import org.apache.dubbo.common.extension.ExtensionLoader; -import org.apache.dubbo.common.extensionloader.ext8_add.AddExt3; +import org.apache.dubbo.common.extension.ext8_add.AddExt3; @Adaptive public class AddExt3_ManualAdaptive implements AddExt3 { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt4_ManualAdaptive.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt4_ManualAdaptive.java similarity index 90% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt4_ManualAdaptive.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt4_ManualAdaptive.java index acb7f484910..cfc69aa2e70 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext8_add/impl/AddExt4_ManualAdaptive.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext8_add/impl/AddExt4_ManualAdaptive.java @@ -14,12 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext8_add.impl; +package org.apache.dubbo.common.extension.ext8_add.impl; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.Adaptive; import org.apache.dubbo.common.extension.ExtensionLoader; -import org.apache.dubbo.common.extensionloader.ext8_add.AddExt4; +import org.apache.dubbo.common.extension.ext8_add.AddExt4; @Adaptive public class AddExt4_ManualAdaptive implements AddExt4 { diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext9_empty/Ext9Empty.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext9_empty/Ext9Empty.java similarity index 93% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext9_empty/Ext9Empty.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext9_empty/Ext9Empty.java index d5121ef0f2b..7c56cb3f524 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext9_empty/Ext9Empty.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext9_empty/Ext9Empty.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext9_empty; +package org.apache.dubbo.common.extension.ext9_empty; import org.apache.dubbo.common.extension.SPI; diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext9_empty/impl/Ext9EmptyImpl.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext9_empty/impl/Ext9EmptyImpl.java similarity index 87% rename from dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext9_empty/impl/Ext9EmptyImpl.java rename to dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext9_empty/impl/Ext9EmptyImpl.java index 70eb8fb59cf..bea7fa82167 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/extensionloader/ext9_empty/impl/Ext9EmptyImpl.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/ext9_empty/impl/Ext9EmptyImpl.java @@ -14,9 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.common.extensionloader.ext9_empty.impl; +package org.apache.dubbo.common.extension.ext9_empty.impl; -import org.apache.dubbo.common.extensionloader.ext9_empty.Ext9Empty; +import org.apache.dubbo.common.extension.ext9_empty.Ext9Empty; public class Ext9EmptyImpl implements Ext9Empty { @Override diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/ActivateComparatorTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/ActivateComparatorTest.java new file mode 100644 index 00000000000..836c3eb9959 --- /dev/null +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/ActivateComparatorTest.java @@ -0,0 +1,48 @@ +/* + * 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.dubbo.common.extension.support; + +import org.apache.dubbo.common.extension.Activate; +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class ActivateComparatorTest { + + @Test + public void testActivateComparator(){ + Filter1 f1 = new Filter1(); + Filter2 f2 = new Filter2(); + Filter3 f3 = new Filter3(); + Filter4 f4 = new Filter4(); + List filters = new ArrayList<>(); + filters.add(f1); + filters.add(f2); + filters.add(f3); + filters.add(f4); + + Collections.sort(filters, ActivateComparator.COMPARATOR); + + Assert.assertEquals(f4, filters.get(0)); + Assert.assertEquals(f3, filters.get(1)); + Assert.assertEquals(f2, filters.get(2)); + Assert.assertEquals(f1, filters.get(3)); + } +} diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter0.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter0.java new file mode 100644 index 00000000000..612440894d4 --- /dev/null +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter0.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.dubbo.common.extension.support; + +import org.apache.dubbo.common.extension.SPI; + +@SPI +public interface Filter0 { +} diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter1.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter1.java new file mode 100644 index 00000000000..5f30dd650e0 --- /dev/null +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter1.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.dubbo.common.extension.support; + +import org.apache.dubbo.common.extension.Activate; + +@Activate +public class Filter1 implements Filter0{ +} diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter2.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter2.java new file mode 100644 index 00000000000..df93fa6eaf8 --- /dev/null +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter2.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.dubbo.common.extension.support; + +import org.apache.dubbo.common.extension.Activate; + +@Activate(before = "_1") +public class Filter2 implements Filter0{ +} diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter3.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter3.java new file mode 100644 index 00000000000..c02aaa13c26 --- /dev/null +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter3.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.dubbo.common.extension.support; + +import org.apache.dubbo.common.extension.Activate; + +@Activate(after = "_4") +public class Filter3 implements Filter0{ +} diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter4.java b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter4.java new file mode 100644 index 00000000000..353874bc9a7 --- /dev/null +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/extension/support/Filter4.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.dubbo.common.extension.support; + +import org.apache.dubbo.common.extension.Activate; + +@Activate(before = "_2") +public class Filter4 implements Filter0{ +} diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.activate.ActivateExt1 b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.activate.ActivateExt1 new file mode 100644 index 00000000000..4faf00ceef0 --- /dev/null +++ b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.activate.ActivateExt1 @@ -0,0 +1,4 @@ +group=org.apache.dubbo.common.extension.activate.impl.GroupActivateExtImpl +value=org.apache.dubbo.common.extension.activate.impl.ValueActivateExtImpl +order1=org.apache.dubbo.common.extension.activate.impl.OrderActivateExtImpl1 +order2=org.apache.dubbo.common.extension.activate.impl.OrderActivateExtImpl2 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.adaptive.HasAdaptiveExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.adaptive.HasAdaptiveExt new file mode 100644 index 00000000000..26aec5332ab --- /dev/null +++ b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.adaptive.HasAdaptiveExt @@ -0,0 +1,2 @@ +adaptive=org.apache.dubbo.common.extension.adaptive.impl.HasAdaptiveExt_ManualAdaptive +impl1=org.apache.dubbo.common.extension.adaptive.impl.HasAdaptiveExtImpl1 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.compatible.CompatibleExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.compatible.CompatibleExt new file mode 100644 index 00000000000..2489f407b7d --- /dev/null +++ b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.compatible.CompatibleExt @@ -0,0 +1,2 @@ +org.apache.dubbo.common.extension.compatible.impl.CompatibleExtImpl1 +impl2=org.apache.dubbo.common.extension.compatible.impl.CompatibleExtImpl2 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext1.SimpleExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext1.SimpleExt new file mode 100644 index 00000000000..67a6e98d1a5 --- /dev/null +++ b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext1.SimpleExt @@ -0,0 +1,4 @@ +# Comment 1 +impl1=org.apache.dubbo.common.extension.ext1.impl.SimpleExtImpl1#Hello World +impl2=org.apache.dubbo.common.extension.ext1.impl.SimpleExtImpl2 # Comment 2 + impl3=org.apache.dubbo.common.extension.ext1.impl.SimpleExtImpl3 # with head space \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext2.Ext2 b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext2.Ext2 new file mode 100644 index 00000000000..4a3f0da392c --- /dev/null +++ b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext2.Ext2 @@ -0,0 +1,3 @@ +impl1=org.apache.dubbo.common.extension.ext2.impl.Ext2Impl1 +impl2=org.apache.dubbo.common.extension.ext2.impl.Ext2Impl2 +impl3=org.apache.dubbo.common.extension.ext2.impl.Ext2Impl3 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext3.UseProtocolKeyExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext3.UseProtocolKeyExt new file mode 100644 index 00000000000..ae17019149c --- /dev/null +++ b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext3.UseProtocolKeyExt @@ -0,0 +1,3 @@ +impl1=org.apache.dubbo.common.extension.ext3.impl.UseProtocolKeyExtImpl1 +impl2=org.apache.dubbo.common.extension.ext3.impl.UseProtocolKeyExtImpl2 +impl3=org.apache.dubbo.common.extension.ext3.impl.UseProtocolKeyExtImpl3 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext4.NoUrlParamExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext4.NoUrlParamExt new file mode 100644 index 00000000000..f05aa7439c1 --- /dev/null +++ b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext4.NoUrlParamExt @@ -0,0 +1,2 @@ +impl1=org.apache.dubbo.common.extension.ext4.impl.Ext4Impl1 +impl2=org.apache.dubbo.common.extension.ext4.impl.Ext4Impl2 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext5.NoAdaptiveMethodExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext5.NoAdaptiveMethodExt new file mode 100644 index 00000000000..f2492e0482a --- /dev/null +++ b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext5.NoAdaptiveMethodExt @@ -0,0 +1,2 @@ +impl1=org.apache.dubbo.common.extension.ext5.impl.Ext5Impl1 +impl2=org.apache.dubbo.common.extension.ext5.impl.Ext5Impl2 diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext6_inject.Ext6 b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext6_inject.Ext6 new file mode 100644 index 00000000000..2cde96f4ab6 --- /dev/null +++ b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext6_inject.Ext6 @@ -0,0 +1,2 @@ +impl1=org.apache.dubbo.common.extension.ext6_inject.impl.Ext6Impl1 +impl2=org.apache.dubbo.common.extension.ext6_inject.impl.Ext6Impl2 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext6_wrap.WrappedExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext6_wrap.WrappedExt new file mode 100644 index 00000000000..8a1335d2a44 --- /dev/null +++ b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext6_wrap.WrappedExt @@ -0,0 +1,4 @@ +impl1=org.apache.dubbo.common.extension.ext6_wrap.impl.Ext5Impl1 +impl2=org.apache.dubbo.common.extension.ext6_wrap.impl.Ext5Impl2 +wrapper1=org.apache.dubbo.common.extension.ext6_wrap.impl.Ext5Wrapper1 +wrapper2=org.apache.dubbo.common.extension.ext6_wrap.impl.Ext5Wrapper2 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext7.InitErrorExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext7.InitErrorExt new file mode 100644 index 00000000000..573842340d8 --- /dev/null +++ b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext7.InitErrorExt @@ -0,0 +1,2 @@ +error=org.apache.dubbo.common.extension.ext7.impl.Ext7InitErrorImpl +ok=org.apache.dubbo.common.extension.ext7.impl.Ext7Impl diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext8_add.AddExt1 b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext8_add.AddExt1 new file mode 100644 index 00000000000..15bb8b7febf --- /dev/null +++ b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext8_add.AddExt1 @@ -0,0 +1 @@ +impl1=org.apache.dubbo.common.extension.ext8_add.impl.AddExt1Impl1 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext9_empty.Ext9Empty b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext9_empty.Ext9Empty similarity index 100% rename from dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext9_empty.Ext9Empty rename to dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.ext9_empty.Ext9Empty diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.support.Filter0 b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.support.Filter0 new file mode 100644 index 00000000000..5d215cd82d6 --- /dev/null +++ b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extension.support.Filter0 @@ -0,0 +1,4 @@ +_1=org.apache.dubbo.common.extension.support.Filter1 +_2=org.apache.dubbo.common.extension.support.Filter2 +_3=org.apache.dubbo.common.extension.support.Filter3 +_4=org.apache.dubbo.common.extension.support.Filter4 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.activate.ActivateExt1 b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.activate.ActivateExt1 deleted file mode 100644 index 855cecd4510..00000000000 --- a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.activate.ActivateExt1 +++ /dev/null @@ -1,4 +0,0 @@ -group=org.apache.dubbo.common.extensionloader.activate.impl.GroupActivateExtImpl -value=org.apache.dubbo.common.extensionloader.activate.impl.ValueActivateExtImpl -order1=org.apache.dubbo.common.extensionloader.activate.impl.OrderActivateExtImpl1 -order2=org.apache.dubbo.common.extensionloader.activate.impl.OrderActivateExtImpl2 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.adaptive.HasAdaptiveExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.adaptive.HasAdaptiveExt deleted file mode 100644 index ab02a908ae1..00000000000 --- a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.adaptive.HasAdaptiveExt +++ /dev/null @@ -1,2 +0,0 @@ -adaptive=org.apache.dubbo.common.extensionloader.adaptive.impl.HasAdaptiveExt_ManualAdaptive -impl1=org.apache.dubbo.common.extensionloader.adaptive.impl.HasAdaptiveExtImpl1 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.compatible.CompatibleExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.compatible.CompatibleExt deleted file mode 100644 index 8d7687ec608..00000000000 --- a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.compatible.CompatibleExt +++ /dev/null @@ -1,2 +0,0 @@ -org.apache.dubbo.common.extensionloader.compatible.impl.CompatibleExtImpl1 -impl2=org.apache.dubbo.common.extensionloader.compatible.impl.CompatibleExtImpl2 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext1.SimpleExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext1.SimpleExt deleted file mode 100644 index 4814121119e..00000000000 --- a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext1.SimpleExt +++ /dev/null @@ -1,4 +0,0 @@ -# Comment 1 -impl1=org.apache.dubbo.common.extensionloader.ext1.impl.SimpleExtImpl1#Hello World -impl2=org.apache.dubbo.common.extensionloader.ext1.impl.SimpleExtImpl2 # Comment 2 - impl3=org.apache.dubbo.common.extensionloader.ext1.impl.SimpleExtImpl3 # with head space \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext2.Ext2 b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext2.Ext2 deleted file mode 100644 index 510089fe946..00000000000 --- a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext2.Ext2 +++ /dev/null @@ -1,3 +0,0 @@ -impl1=org.apache.dubbo.common.extensionloader.ext2.impl.Ext2Impl1 -impl2=org.apache.dubbo.common.extensionloader.ext2.impl.Ext2Impl2 -impl3=org.apache.dubbo.common.extensionloader.ext2.impl.Ext2Impl3 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext3.UseProtocolKeyExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext3.UseProtocolKeyExt deleted file mode 100644 index b4a28495245..00000000000 --- a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext3.UseProtocolKeyExt +++ /dev/null @@ -1,3 +0,0 @@ -impl1=org.apache.dubbo.common.extensionloader.ext3.impl.UseProtocolKeyExtImpl1 -impl2=org.apache.dubbo.common.extensionloader.ext3.impl.UseProtocolKeyExtImpl2 -impl3=org.apache.dubbo.common.extensionloader.ext3.impl.UseProtocolKeyExtImpl3 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext4.NoUrlParamExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext4.NoUrlParamExt deleted file mode 100644 index ccd55fecaa9..00000000000 --- a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext4.NoUrlParamExt +++ /dev/null @@ -1,2 +0,0 @@ -impl1=org.apache.dubbo.common.extensionloader.ext4.impl.Ext4Impl1 -impl2=org.apache.dubbo.common.extensionloader.ext4.impl.Ext4Impl2 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext5.NoAdaptiveMethodExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext5.NoAdaptiveMethodExt deleted file mode 100644 index f03dd45e791..00000000000 --- a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext5.NoAdaptiveMethodExt +++ /dev/null @@ -1,2 +0,0 @@ -impl1=org.apache.dubbo.common.extensionloader.ext5.impl.Ext5Impl1 -impl2=org.apache.dubbo.common.extensionloader.ext5.impl.Ext5Impl2 diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext6_inject.Ext6 b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext6_inject.Ext6 deleted file mode 100644 index 6c077ce3cd3..00000000000 --- a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext6_inject.Ext6 +++ /dev/null @@ -1,2 +0,0 @@ -impl1=org.apache.dubbo.common.extensionloader.ext6_inject.impl.Ext6Impl1 -impl2=org.apache.dubbo.common.extensionloader.ext6_inject.impl.Ext6Impl2 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext6_wrap.WrappedExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext6_wrap.WrappedExt deleted file mode 100644 index 8a859a17e95..00000000000 --- a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext6_wrap.WrappedExt +++ /dev/null @@ -1,4 +0,0 @@ -impl1=org.apache.dubbo.common.extensionloader.ext6_wrap.impl.Ext5Impl1 -impl2=org.apache.dubbo.common.extensionloader.ext6_wrap.impl.Ext5Impl2 -wrapper1=org.apache.dubbo.common.extensionloader.ext6_wrap.impl.Ext5Wrapper1 -wrapper2=org.apache.dubbo.common.extensionloader.ext6_wrap.impl.Ext5Wrapper2 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext7.InitErrorExt b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext7.InitErrorExt deleted file mode 100644 index 99af6afa5d2..00000000000 --- a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext7.InitErrorExt +++ /dev/null @@ -1,2 +0,0 @@ -error=org.apache.dubbo.common.extensionloader.ext7.impl.Ext7InitErrorImpl -ok=org.apache.dubbo.common.extensionloader.ext7.impl.Ext7Impl diff --git a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext8_add.AddExt1 b/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext8_add.AddExt1 deleted file mode 100644 index 6187d33a3c8..00000000000 --- a/dubbo-common/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.common.extensionloader.ext8_add.AddExt1 +++ /dev/null @@ -1 +0,0 @@ -impl1=org.apache.dubbo.common.extensionloader.ext8_add.impl.AddExt1Impl1 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/services/org.apache.dubbo.common.extension.activate.ActivateExt1 b/dubbo-common/src/test/resources/META-INF/services/org.apache.dubbo.common.extension.activate.ActivateExt1 new file mode 100644 index 00000000000..b293e07192d --- /dev/null +++ b/dubbo-common/src/test/resources/META-INF/services/org.apache.dubbo.common.extension.activate.ActivateExt1 @@ -0,0 +1 @@ +org.apache.dubbo.common.extension.activate.impl.ActivateExt1Impl1 \ No newline at end of file diff --git a/dubbo-common/src/test/resources/META-INF/services/org.apache.dubbo.common.extensionloader.activate.ActivateExt1 b/dubbo-common/src/test/resources/META-INF/services/org.apache.dubbo.common.extensionloader.activate.ActivateExt1 deleted file mode 100644 index 86130515419..00000000000 --- a/dubbo-common/src/test/resources/META-INF/services/org.apache.dubbo.common.extensionloader.activate.ActivateExt1 +++ /dev/null @@ -1 +0,0 @@ -org.apache.dubbo.common.extensionloader.activate.impl.ActivateExt1Impl1 \ No newline at end of file