This is an automated email from the ASF dual-hosted git repository. jerrick pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
The following commit(s) were added to refs/heads/master by this push: new 5de6c76 add compatible class for config #2169 (#2170) 5de6c76 is described below commit 5de6c76f063195dabd037601c158c533d0356582 Author: Jerrick Zhu <diecui1...@gmail.com> AuthorDate: Mon Aug 6 10:41:51 2018 +0800 add compatible class for config #2169 (#2170) --- dubbo-compatible/pom.xml | 6 + .../alibaba/dubbo/config/ApplicationConfig.java} | 51 +++--- .../com/alibaba/dubbo/config/ArgumentConfig.java} | 43 ++--- .../com/alibaba/dubbo/config/ConsumerConfig.java} | 43 ++--- .../com/alibaba/dubbo/config/MethodConfig.java} | 44 ++--- .../com/alibaba/dubbo/config/ModuleConfig.java} | 50 +++--- .../com/alibaba/dubbo/config/MonitorConfig.java} | 49 +++--- .../com/alibaba/dubbo/config/ProtocolConfig.java} | 18 +- .../com/alibaba/dubbo/config/ReferenceConfig.java} | 16 +- .../com/alibaba/dubbo/config/RegistryConfig.java} | 19 ++- .../com/alibaba/dubbo/config/ServiceConfig.java} | 16 +- .../dubbo/{compatible => }/cache/CacheTest.java | 2 +- .../dubbo/{compatible => }/cache/MyCache.java | 2 +- .../{compatible => }/cache/MyCacheFactory.java | 2 +- .../common/extension/ExtensionTest.java | 4 +- .../common/extension/MyExtensionFactory.java | 2 +- .../apache/dubbo/config/ApplicationConfigTest.java | 180 ++++++++++++++++++++ .../apache/dubbo/config/ArgumentConfigTest.java | 65 +++++++ .../java/org/apache/dubbo/config/ConfigTest.java | 56 ++++++ .../apache/dubbo/config/ConsumerConfigTest.java | 55 ++++++ .../org/apache/dubbo/config/MethodConfigTest.java | 184 ++++++++++++++++++++ .../org/apache/dubbo/config/ModuleConfigTest.java | 113 +++++++++++++ .../apache/dubbo/config/ProtocolConfigTest.java | 157 +++++++++++++++++ .../apache/dubbo/config/ProviderConfigTest.java | 187 +++++++++++++++++++++ .../apache/dubbo/config/ReferenceConfigTest.java | 65 +++++++ .../apache/dubbo/config/RegistryConfigTest.java | 175 +++++++++++++++++++ .../{compatible => }/echo/EchoServiceTest.java | 7 +- .../dubbo/{compatible => }/filter/FilterTest.java | 5 +- .../dubbo/{compatible => }/filter/MyFilter.java | 2 +- .../dubbo/{compatible => }/filter/MyInvoker.java | 4 +- .../generic/GenericServiceTest.java | 7 +- .../serialization/MyObjectInput.java | 2 +- .../serialization/MyObjectOutput.java | 2 +- .../serialization/MySerialization.java | 2 +- .../serialization/SerializationTest.java | 2 +- .../{compatible => }/service/CustomArgument.java | 2 +- .../{compatible => }/service/DemoService.java | 2 +- .../{compatible => }/service/DemoServiceImpl.java | 2 +- .../{compatible => }/service/MockInvocation.java | 2 +- .../dubbo/{compatible => }/service/Person.java | 2 +- .../dubbo/{compatible => }/service/Type.java | 2 +- ...alibaba.dubbo.common.extension.ExtensionFactory | 2 +- 42 files changed, 1470 insertions(+), 181 deletions(-) diff --git a/dubbo-compatible/pom.xml b/dubbo-compatible/pom.xml index b99da06..1da947f 100644 --- a/dubbo-compatible/pom.xml +++ b/dubbo-compatible/pom.xml @@ -73,5 +73,11 @@ <version>${project.parent.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo-registry-multicast</artifactId> + <version>${project.parent.version}</version> + <scope>test</scope> + </dependency> </dependencies> </project> \ No newline at end of file diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ApplicationConfig.java similarity index 75% copy from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java copy to dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ApplicationConfig.java index e6bcf4c..f17e7ed 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ApplicationConfig.java @@ -1,21 +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.compatible.service; - -public enum Type { - High, Normal, Lower -} \ No newline at end of file +/* + * 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 com.alibaba.dubbo.config; + +@Deprecated +public class ApplicationConfig extends org.apache.dubbo.config.ApplicationConfig { + + public ApplicationConfig() { + super(); + } + + public ApplicationConfig(String name) { + super(name); + } +} diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ArgumentConfig.java similarity index 86% copy from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java copy to dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ArgumentConfig.java index e6bcf4c..2ba33bb 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ArgumentConfig.java @@ -1,21 +1,22 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.dubbo.compatible.service; - -public enum Type { - High, Normal, Lower -} \ No newline at end of file +/* + * 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 com.alibaba.dubbo.config; + +@Deprecated +public class ArgumentConfig extends org.apache.dubbo.config.ArgumentConfig { +} diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ConsumerConfig.java similarity index 86% copy from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java copy to dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ConsumerConfig.java index e6bcf4c..320ec47 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ConsumerConfig.java @@ -1,21 +1,22 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.dubbo.compatible.service; - -public enum Type { - High, Normal, Lower -} \ No newline at end of file +/* + * 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 com.alibaba.dubbo.config; + +@Deprecated +public class ConsumerConfig extends org.apache.dubbo.config.ConsumerConfig { +} diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/MethodConfig.java similarity index 86% copy from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java copy to dubbo-compatible/src/main/java/com/alibaba/dubbo/config/MethodConfig.java index e6bcf4c..c3d13e9 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/MethodConfig.java @@ -1,21 +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.compatible.service; - -public enum Type { - High, Normal, Lower -} \ No newline at end of file +/* + * 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 com.alibaba.dubbo.config; + +@Deprecated +public class MethodConfig extends org.apache.dubbo.config.MethodConfig { + +} diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ModuleConfig.java similarity index 78% copy from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java copy to dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ModuleConfig.java index e6bcf4c..8b75279 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ModuleConfig.java @@ -1,21 +1,29 @@ -/* - * 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.compatible.service; - -public enum Type { - High, Normal, Lower -} \ No newline at end of file +/* + * 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 com.alibaba.dubbo.config; + +@Deprecated +public class ModuleConfig extends org.apache.dubbo.config.ModuleConfig { + + public ModuleConfig() { + } + + public ModuleConfig(String name) { + super(name); + } +} diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/MonitorConfig.java similarity index 77% copy from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java copy to dubbo-compatible/src/main/java/com/alibaba/dubbo/config/MonitorConfig.java index e6bcf4c..0c5d175 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/MonitorConfig.java @@ -1,21 +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.compatible.service; - -public enum Type { - High, Normal, Lower -} \ No newline at end of file +/* + * 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 com.alibaba.dubbo.config; + +@Deprecated +public class MonitorConfig extends org.apache.dubbo.config.MonitorConfig { + public MonitorConfig() { + } + + public MonitorConfig(String address) { + super(address); + } +} diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/common/extension/MyExtensionFactory.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ProtocolConfig.java similarity index 72% copy from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/common/extension/MyExtensionFactory.java copy to dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ProtocolConfig.java index bf098b6..0835ef0 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/common/extension/MyExtensionFactory.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ProtocolConfig.java @@ -14,14 +14,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.compatible.common.extension; -import com.alibaba.dubbo.common.extension.ExtensionFactory; +package com.alibaba.dubbo.config; -public class MyExtensionFactory implements ExtensionFactory { +@Deprecated +public class ProtocolConfig extends org.apache.dubbo.config.ProtocolConfig { - @Override - public <T> T getExtension(Class<T> type, String name) { - return null; + public ProtocolConfig() { + } + + public ProtocolConfig(String name) { + super(name); + } + + public ProtocolConfig(String name, int port) { + super(name, port); } } diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/common/extension/MyExtensionFactory.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java similarity index 73% copy from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/common/extension/MyExtensionFactory.java copy to dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java index bf098b6..026fe4e 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/common/extension/MyExtensionFactory.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java @@ -14,14 +14,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.compatible.common.extension; -import com.alibaba.dubbo.common.extension.ExtensionFactory; +package com.alibaba.dubbo.config; -public class MyExtensionFactory implements ExtensionFactory { +import org.apache.dubbo.config.annotation.Reference; - @Override - public <T> T getExtension(Class<T> type, String name) { - return null; +@Deprecated +public class ReferenceConfig<T> extends org.apache.dubbo.config.ReferenceConfig<T> { + + public ReferenceConfig() { + } + + public ReferenceConfig(Reference reference) { + super(reference); } } diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/MyCacheFactory.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/RegistryConfig.java similarity index 71% copy from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/MyCacheFactory.java copy to dubbo-compatible/src/main/java/com/alibaba/dubbo/config/RegistryConfig.java index ed55493..501f918 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/MyCacheFactory.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/RegistryConfig.java @@ -15,16 +15,19 @@ * limitations under the License. */ -package org.apache.dubbo.compatible.cache; +package com.alibaba.dubbo.config; -import com.alibaba.dubbo.cache.Cache; -import com.alibaba.dubbo.cache.support.AbstractCacheFactory; -import com.alibaba.dubbo.common.URL; +@Deprecated +public class RegistryConfig extends org.apache.dubbo.config.RegistryConfig { -public class MyCacheFactory extends AbstractCacheFactory { + public RegistryConfig() { + } + + public RegistryConfig(String address) { + super(address); + } - @Override - protected Cache createCache(URL url) { - return new MyCache(url); + public RegistryConfig(String address, String protocol) { + super(address, protocol); } } diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/common/extension/MyExtensionFactory.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java similarity index 74% copy from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/common/extension/MyExtensionFactory.java copy to dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java index bf098b6..f0f22d7 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/common/extension/MyExtensionFactory.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java @@ -14,14 +14,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.compatible.common.extension; -import com.alibaba.dubbo.common.extension.ExtensionFactory; +package com.alibaba.dubbo.config; -public class MyExtensionFactory implements ExtensionFactory { +import org.apache.dubbo.config.annotation.Service; - @Override - public <T> T getExtension(Class<T> type, String name) { - return null; +@Deprecated +public class ServiceConfig<T> extends org.apache.dubbo.config.ServiceConfig<T> { + + public ServiceConfig() { + } + + public ServiceConfig(Service service) { + super(service); } } diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/CacheTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/cache/CacheTest.java similarity index 98% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/CacheTest.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/cache/CacheTest.java index 175d907..6ff4d8b 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/CacheTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/cache/CacheTest.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dubbo.compatible.cache; +package org.apache.dubbo.cache; import com.alibaba.dubbo.cache.Cache; import com.alibaba.dubbo.cache.CacheFactory; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/MyCache.java b/dubbo-compatible/src/test/java/org/apache/dubbo/cache/MyCache.java similarity index 96% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/MyCache.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/cache/MyCache.java index f9e6ce2..c7a7528 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/MyCache.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/cache/MyCache.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dubbo.compatible.cache; +package org.apache.dubbo.cache; import com.alibaba.dubbo.cache.Cache; import com.alibaba.dubbo.common.URL; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/MyCacheFactory.java b/dubbo-compatible/src/test/java/org/apache/dubbo/cache/MyCacheFactory.java similarity index 96% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/MyCacheFactory.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/cache/MyCacheFactory.java index ed55493..aa22fbe 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/cache/MyCacheFactory.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/cache/MyCacheFactory.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dubbo.compatible.cache; +package org.apache.dubbo.cache; import com.alibaba.dubbo.cache.Cache; import com.alibaba.dubbo.cache.support.AbstractCacheFactory; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/common/extension/ExtensionTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/ExtensionTest.java similarity index 91% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/common/extension/ExtensionTest.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/ExtensionTest.java index 588446e..1243827 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/common/extension/ExtensionTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/ExtensionTest.java @@ -15,10 +15,8 @@ * limitations under the License. */ -package org.apache.dubbo.compatible.common.extension; +package org.apache.dubbo.common.extension; -import org.apache.dubbo.common.extension.ExtensionFactory; -import org.apache.dubbo.common.extension.ExtensionLoader; import org.junit.Assert; import org.junit.Test; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/common/extension/MyExtensionFactory.java b/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/MyExtensionFactory.java similarity index 95% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/common/extension/MyExtensionFactory.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/MyExtensionFactory.java index bf098b6..f9602b4 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/common/extension/MyExtensionFactory.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/MyExtensionFactory.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.compatible.common.extension; +package org.apache.dubbo.common.extension; import com.alibaba.dubbo.common.extension.ExtensionFactory; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ApplicationConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ApplicationConfigTest.java new file mode 100644 index 0000000..fe4c2ff --- /dev/null +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ApplicationConfigTest.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.config; + +import com.alibaba.dubbo.common.Constants; +import com.alibaba.dubbo.config.ApplicationConfig; +import com.alibaba.dubbo.config.MonitorConfig; +import com.alibaba.dubbo.config.RegistryConfig; +import org.junit.Test; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasEntry; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.sameInstance; +import static org.hamcrest.collection.IsCollectionWithSize.hasSize; +import static org.junit.Assert.assertThat; + +public class ApplicationConfigTest { + @Test + public void testName() throws Exception { + ApplicationConfig application = new ApplicationConfig(); + application.setName("app"); + assertThat(application.getName(), equalTo("app")); + application = new ApplicationConfig("app2"); + assertThat(application.getName(), equalTo("app2")); + Map<String, String> parameters = new HashMap<String, String>(); + ApplicationConfig.appendParameters(parameters, application); + assertThat(parameters, hasEntry(Constants.APPLICATION_KEY, "app2")); + } + + @Test + public void testVersion() throws Exception { + ApplicationConfig application = new ApplicationConfig("app"); + application.setVersion("1.0.0"); + assertThat(application.getVersion(), equalTo("1.0.0")); + Map<String, String> parameters = new HashMap<String, String>(); + ApplicationConfig.appendParameters(parameters, application); + assertThat(parameters, hasEntry("application.version", "1.0.0")); + } + + @Test + public void testOwner() throws Exception { + ApplicationConfig application = new ApplicationConfig("app"); + application.setOwner("owner"); + assertThat(application.getOwner(), equalTo("owner")); + } + + @Test + public void testOrganization() throws Exception { + ApplicationConfig application = new ApplicationConfig("app"); + application.setOrganization("org"); + assertThat(application.getOrganization(), equalTo("org")); + } + + @Test + public void testArchitecture() throws Exception { + ApplicationConfig application = new ApplicationConfig("app"); + application.setArchitecture("arch"); + assertThat(application.getArchitecture(), equalTo("arch")); + } + + @Test + public void testEnvironment1() throws Exception { + ApplicationConfig application = new ApplicationConfig("app"); + application.setEnvironment("develop"); + assertThat(application.getEnvironment(), equalTo("develop")); + application.setEnvironment("test"); + assertThat(application.getEnvironment(), equalTo("test")); + application.setEnvironment("product"); + assertThat(application.getEnvironment(), equalTo("product")); + } + + @Test(expected = IllegalStateException.class) + public void testEnvironment2() throws Exception { + ApplicationConfig application = new ApplicationConfig("app"); + application.setEnvironment("illegal-env"); + } + + @Test + public void testRegistry() throws Exception { + ApplicationConfig application = new ApplicationConfig("app"); + RegistryConfig registry = new RegistryConfig(); + application.setRegistry(registry); + assertThat(application.getRegistry(), sameInstance(registry)); + application.setRegistries(Collections.singletonList(registry)); + assertThat(application.getRegistries(), contains(registry)); + assertThat(application.getRegistries(), hasSize(1)); + } + + @Test + public void testMonitor() throws Exception { + ApplicationConfig application = new ApplicationConfig("app"); + application.setMonitor(new MonitorConfig("monitor-addr")); + assertThat(application.getMonitor().getAddress(), equalTo("monitor-addr")); + application.setMonitor("monitor-addr"); + assertThat(application.getMonitor().getAddress(), equalTo("monitor-addr")); + } + + @Test + public void testLogger() throws Exception { + ApplicationConfig application = new ApplicationConfig("app"); + application.setLogger("log4j"); + assertThat(application.getLogger(), equalTo("log4j")); + } + + @Test + public void testDefault() throws Exception { + ApplicationConfig application = new ApplicationConfig("app"); + application.setDefault(true); + assertThat(application.isDefault(), is(true)); + } + + @Test + public void testDumpDirectory() throws Exception { + ApplicationConfig application = new ApplicationConfig("app"); + application.setDumpDirectory("/dump"); + assertThat(application.getDumpDirectory(), equalTo("/dump")); + Map<String, String> parameters = new HashMap<String, String>(); + ApplicationConfig.appendParameters(parameters, application); + assertThat(parameters, hasEntry(Constants.DUMP_DIRECTORY, "/dump")); + } + + @Test + public void testQosEnable() throws Exception { + ApplicationConfig application = new ApplicationConfig("app"); + application.setQosEnable(true); + assertThat(application.getQosEnable(), is(true)); + Map<String, String> parameters = new HashMap<String, String>(); + ApplicationConfig.appendParameters(parameters, application); + assertThat(parameters, hasEntry(Constants.QOS_ENABLE, "true")); + } + + @Test + public void testQosPort() throws Exception { + ApplicationConfig application = new ApplicationConfig("app"); + application.setQosPort(8080); + assertThat(application.getQosPort(), equalTo(8080)); + } + + @Test + public void testQosAcceptForeignIp() throws Exception { + ApplicationConfig application = new ApplicationConfig("app"); + application.setQosAcceptForeignIp(true); + assertThat(application.getQosAcceptForeignIp(), is(true)); + Map<String, String> parameters = new HashMap<String, String>(); + ApplicationConfig.appendParameters(parameters, application); + assertThat(parameters, hasEntry(Constants.ACCEPT_FOREIGN_IP, "true")); + } + + @Test + public void testParameters() throws Exception { + ApplicationConfig application = new ApplicationConfig("app"); + application.setQosAcceptForeignIp(true); + Map<String, String> parameters = new HashMap<String, String>(); + parameters.put("k1", "v1"); + ApplicationConfig.appendParameters(parameters, application); + assertThat(parameters, hasEntry("k1", "v1")); + assertThat(parameters, hasEntry(Constants.ACCEPT_FOREIGN_IP, "true")); + } +} \ No newline at end of file diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ArgumentConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ArgumentConfigTest.java new file mode 100644 index 0000000..2f73c51 --- /dev/null +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ArgumentConfigTest.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.dubbo.config; + +import org.junit.Test; + +import java.util.HashMap; +import java.util.Map; + +import com.alibaba.dubbo.config.ArgumentConfig; + +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasEntry; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +public class ArgumentConfigTest { + @Test + public void testIndex() throws Exception { + ArgumentConfig argument = new ArgumentConfig(); + argument.setIndex(1); + assertThat(argument.getIndex(), is(1)); + } + + @Test + public void testType() throws Exception { + ArgumentConfig argument = new ArgumentConfig(); + argument.setType("int"); + assertThat(argument.getType(), equalTo("int")); + } + + @Test + public void testCallback() throws Exception { + ArgumentConfig argument = new ArgumentConfig(); + argument.setCallback(true); + assertThat(argument.isCallback(), is(true)); + } + + @Test + public void testArguments() throws Exception { + ArgumentConfig argument = new ArgumentConfig(); + argument.setIndex(1); + argument.setType("int"); + argument.setCallback(true); + Map<String, String> parameters = new HashMap<String, String>(); + AbstractServiceConfig.appendParameters(parameters, argument); + assertThat(parameters, hasEntry("callback", "true")); + assertThat(parameters.size(), is(1)); + } +} \ No newline at end of file diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ConfigTest.java new file mode 100644 index 0000000..2e57fec --- /dev/null +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ConfigTest.java @@ -0,0 +1,56 @@ +/* + * 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.config; + +import org.apache.dubbo.service.DemoService; +import org.apache.dubbo.service.DemoServiceImpl; + +import com.alibaba.dubbo.config.ApplicationConfig; +import com.alibaba.dubbo.config.ReferenceConfig; +import com.alibaba.dubbo.config.RegistryConfig; +import com.alibaba.dubbo.config.ServiceConfig; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class ConfigTest { + + @Before + public void setup() { + // In IDE env, make sure adding the following argument to VM options + System.setProperty("java.net.preferIPv4Stack", "true"); + } + + @Test + public void testConfig() { + com.alibaba.dubbo.config.ServiceConfig<DemoService> service = new ServiceConfig<>(); + service.setApplication(new com.alibaba.dubbo.config.ApplicationConfig("first-dubbo-provider")); + service.setRegistry(new com.alibaba.dubbo.config.RegistryConfig("multicast://224.5.6.7:1234")); + service.setInterface(DemoService.class); + service.setRef(new DemoServiceImpl()); + service.export(); + + com.alibaba.dubbo.config.ReferenceConfig<DemoService> reference = new ReferenceConfig<>(); + reference.setApplication(new ApplicationConfig("first-dubbo-client")); + reference.setRegistry(new RegistryConfig("multicast://224.5.6.7:1234")); + reference.setInterface(DemoService.class); + DemoService demoService = reference.get(); + String message = demoService.sayHello("dubbo"); + Assert.assertEquals("hello dubbo", message); + } +} diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ConsumerConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ConsumerConfigTest.java new file mode 100644 index 0000000..2b08c79 --- /dev/null +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ConsumerConfigTest.java @@ -0,0 +1,55 @@ +/* + * 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.config; + +import org.junit.Test; + +import com.alibaba.dubbo.config.ConsumerConfig; + +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +public class ConsumerConfigTest { + @Test + public void testTimeout() throws Exception { + try { + System.clearProperty("sun.rmi.transport.tcp.responseTimeout"); + ConsumerConfig consumer = new ConsumerConfig(); + consumer.setTimeout(10); + assertThat(consumer.getTimeout(), is(10)); + assertThat(System.getProperty("sun.rmi.transport.tcp.responseTimeout"), equalTo("10")); + } finally { + System.clearProperty("sun.rmi.transport.tcp.responseTimeout"); + } + } + + @Test + public void testDefault() throws Exception { + ConsumerConfig consumer = new ConsumerConfig(); + consumer.setDefault(true); + assertThat(consumer.isDefault(), is(true)); + } + + @Test + public void testClient() throws Exception { + ConsumerConfig consumer = new ConsumerConfig(); + consumer.setClient("client"); + assertThat(consumer.getClient(), equalTo("client")); + } +} \ No newline at end of file diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/MethodConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/MethodConfigTest.java new file mode 100644 index 0000000..a7c5e99 --- /dev/null +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/MethodConfigTest.java @@ -0,0 +1,184 @@ +/* + * 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.config; + +import com.alibaba.dubbo.common.Constants; +import com.alibaba.dubbo.config.MethodConfig; +import com.alibaba.dubbo.config.ArgumentConfig; +import org.hamcrest.Matchers; +import org.junit.Test; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasEntry; +import static org.hamcrest.Matchers.hasKey; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.not; +import static org.junit.Assert.assertThat; + +public class MethodConfigTest { + @Test + public void testName() throws Exception { + MethodConfig method = new MethodConfig(); + method.setName("hello"); + assertThat(method.getName(), equalTo("hello")); + Map<String, String> parameters = new HashMap<String, String>(); + MethodConfig.appendParameters(parameters, method); + assertThat(parameters, not(hasKey("name"))); + } + + @Test + public void testStat() throws Exception { + MethodConfig method = new MethodConfig(); + method.setStat(10); + assertThat(method.getStat(), equalTo(10)); + } + + @Test + public void testRetry() throws Exception { + MethodConfig method = new MethodConfig(); + method.setRetry(true); + assertThat(method.isRetry(), is(true)); + } + + @Test + public void testReliable() throws Exception { + MethodConfig method = new MethodConfig(); + method.setReliable(true); + assertThat(method.isReliable(), is(true)); + } + + @Test + public void testExecutes() throws Exception { + MethodConfig method = new MethodConfig(); + method.setExecutes(10); + assertThat(method.getExecutes(), equalTo(10)); + } + + @Test + public void testDeprecated() throws Exception { + MethodConfig method = new MethodConfig(); + method.setDeprecated(true); + assertThat(method.getDeprecated(), is(true)); + } + + @Test + public void testArguments() throws Exception { + MethodConfig method = new MethodConfig(); + ArgumentConfig argument = new ArgumentConfig(); + method.setArguments(Collections.singletonList(argument)); + assertThat(method.getArguments(), contains(argument)); + assertThat(method.getArguments(), Matchers.<org.apache.dubbo.config.ArgumentConfig>hasSize(1)); + } + + @Test + public void testSticky() throws Exception { + MethodConfig method = new MethodConfig(); + method.setSticky(true); + assertThat(method.getSticky(), is(true)); + } + + @Test + public void testOnreturn() throws Exception { + MethodConfig method = new MethodConfig(); + method.setOnreturn("on-return-object"); + assertThat(method.getOnreturn(), equalTo((Object) "on-return-object")); + Map<Object, Object> attribute = new HashMap<Object, Object>(); + MethodConfig.appendAttributes(attribute, method); + assertThat(attribute, hasEntry((Object) Constants.ON_RETURN_INSTANCE_KEY, (Object) "on-return-object")); + Map<String, String> parameters = new HashMap<String, String>(); + MethodConfig.appendParameters(parameters, method); + assertThat(parameters.size(), is(0)); + } + + @Test + public void testOnreturnMethod() throws Exception { + MethodConfig method = new MethodConfig(); + method.setOnreturnMethod("on-return-method"); + assertThat(method.getOnreturnMethod(), equalTo("on-return-method")); + Map<Object, Object> attribute = new HashMap<Object, Object>(); + MethodConfig.appendAttributes(attribute, method); + assertThat(attribute, hasEntry((Object) Constants.ON_RETURN_METHOD_KEY, (Object) "on-return-method")); + Map<String, String> parameters = new HashMap<String, String>(); + MethodConfig.appendParameters(parameters, method); + assertThat(parameters.size(), is(0)); + } + + @Test + public void testOnthrow() throws Exception { + MethodConfig method = new MethodConfig(); + method.setOnthrow("on-throw-object"); + assertThat(method.getOnthrow(), equalTo((Object) "on-throw-object")); + Map<Object, Object> attribute = new HashMap<Object, Object>(); + MethodConfig.appendAttributes(attribute, method); + assertThat(attribute, hasEntry((Object) Constants.ON_THROW_INSTANCE_KEY, (Object) "on-throw-object")); + Map<String, String> parameters = new HashMap<String, String>(); + MethodConfig.appendParameters(parameters, method); + assertThat(parameters.size(), is(0)); + } + + @Test + public void testOnthrowMethod() throws Exception { + MethodConfig method = new MethodConfig(); + method.setOnthrowMethod("on-throw-method"); + assertThat(method.getOnthrowMethod(), equalTo("on-throw-method")); + Map<Object, Object> attribute = new HashMap<Object, Object>(); + MethodConfig.appendAttributes(attribute, method); + assertThat(attribute, hasEntry((Object) Constants.ON_THROW_METHOD_KEY, (Object) "on-throw-method")); + Map<String, String> parameters = new HashMap<String, String>(); + MethodConfig.appendParameters(parameters, method); + assertThat(parameters.size(), is(0)); + } + + @Test + public void testOninvoke() throws Exception { + MethodConfig method = new MethodConfig(); + method.setOninvoke("on-invoke-object"); + assertThat(method.getOninvoke(), equalTo((Object) "on-invoke-object")); + Map<Object, Object> attribute = new HashMap<Object, Object>(); + MethodConfig.appendAttributes(attribute, method); + assertThat(attribute, hasEntry((Object) Constants.ON_INVOKE_INSTANCE_KEY, (Object) "on-invoke-object")); + Map<String, String> parameters = new HashMap<String, String>(); + MethodConfig.appendParameters(parameters, method); + assertThat(parameters.size(), is(0)); + } + + @Test + public void testOninvokeMethod() throws Exception { + MethodConfig method = new MethodConfig(); + method.setOninvokeMethod("on-invoke-method"); + assertThat(method.getOninvokeMethod(), equalTo("on-invoke-method")); + Map<Object, Object> attribute = new HashMap<Object, Object>(); + MethodConfig.appendAttributes(attribute, method); + assertThat(attribute, hasEntry((Object) Constants.ON_INVOKE_METHOD_KEY, (Object) "on-invoke-method")); + Map<String, String> parameters = new HashMap<String, String>(); + MethodConfig.appendParameters(parameters, method); + assertThat(parameters.size(), is(0)); + } + + @Test + public void testReturn() throws Exception { + MethodConfig method = new MethodConfig(); + method.setReturn(true); + assertThat(method.isReturn(), is(true)); + } +} \ No newline at end of file diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ModuleConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ModuleConfigTest.java new file mode 100644 index 0000000..5dc9701 --- /dev/null +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ModuleConfigTest.java @@ -0,0 +1,113 @@ +/* + * 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.config; + +import com.alibaba.dubbo.config.ModuleConfig; +import com.alibaba.dubbo.config.RegistryConfig; + +import org.hamcrest.Matchers; +import org.junit.Test; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasEntry; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.sameInstance; +import static org.junit.Assert.assertThat; + +public class ModuleConfigTest { + @Test(expected = IllegalStateException.class) + public void testName1() throws Exception { + ModuleConfig module = new ModuleConfig(); + Map<String, String> parameters = new HashMap<String, String>(); + ModuleConfig.appendParameters(parameters, module); + } + + @Test + public void testName2() throws Exception { + ModuleConfig module = new ModuleConfig(); + module.setName("module-name"); + assertThat(module.getName(), equalTo("module-name")); + assertThat(module.getId(), equalTo("module-name")); + Map<String, String> parameters = new HashMap<String, String>(); + ModuleConfig.appendParameters(parameters, module); + assertThat(parameters, hasEntry("module", "module-name")); + } + + @Test + public void testVersion() throws Exception { + ModuleConfig module = new ModuleConfig(); + module.setName("module-name"); + module.setVersion("1.0.0"); + assertThat(module.getVersion(), equalTo("1.0.0")); + Map<String, String> parameters = new HashMap<String, String>(); + ModuleConfig.appendParameters(parameters, module); + assertThat(parameters, hasEntry("module.version", "1.0.0")); + } + + @Test + public void testOwner() throws Exception { + ModuleConfig module = new ModuleConfig(); + module.setOwner("owner"); + assertThat(module.getOwner(), equalTo("owner")); + } + + @Test + public void testOrganization() throws Exception { + ModuleConfig module = new ModuleConfig(); + module.setOrganization("org"); + assertThat(module.getOrganization(), equalTo("org")); + } + + @Test + public void testRegistry() throws Exception { + ModuleConfig module = new ModuleConfig(); + RegistryConfig registry = new RegistryConfig(); + module.setRegistry(registry); + assertThat(module.getRegistry(), sameInstance(registry)); + } + + @Test + public void testRegistries() throws Exception { + ModuleConfig module = new ModuleConfig(); + RegistryConfig registry = new RegistryConfig(); + module.setRegistries(Collections.singletonList(registry)); + assertThat(module.getRegistries(), Matchers.<org.apache.dubbo.config.RegistryConfig>hasSize(1)); + assertThat(module.getRegistries(), contains(registry)); + } + + @Test + public void testMonitor() throws Exception { + ModuleConfig module = new ModuleConfig(); + module.setMonitor("monitor-addr1"); + assertThat(module.getMonitor().getAddress(), equalTo("monitor-addr1")); + module.setMonitor(new MonitorConfig("monitor-addr2")); + assertThat(module.getMonitor().getAddress(), equalTo("monitor-addr2")); + } + + @Test + public void testDefault() throws Exception { + ModuleConfig module = new ModuleConfig(); + module.setDefault(true); + assertThat(module.isDefault(), is(true)); + } +} \ No newline at end of file diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ProtocolConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ProtocolConfigTest.java new file mode 100644 index 0000000..48de8a1 --- /dev/null +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ProtocolConfigTest.java @@ -0,0 +1,157 @@ +/* + * 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.config; + +import com.alibaba.dubbo.rpc.Protocol; +import com.alibaba.dubbo.config.ProtocolConfig; +import org.junit.Test; +import org.mockito.Mockito; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasEntry; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +public class ProtocolConfigTest { + + @Test + public void testName() throws Exception { + ProtocolConfig protocol = new ProtocolConfig(); + protocol.setName("name"); + Map<String, String> parameters = new HashMap<String, String>(); + ProtocolConfig.appendParameters(parameters, protocol); + assertThat(protocol.getName(), equalTo("name")); + assertThat(protocol.getId(), equalTo("name")); + assertThat(parameters.isEmpty(), is(true)); + } + + @Test + public void testHost() throws Exception { + ProtocolConfig protocol = new ProtocolConfig(); + protocol.setHost("host"); + Map<String, String> parameters = new HashMap<String, String>(); + ProtocolConfig.appendParameters(parameters, protocol); + assertThat(protocol.getHost(), equalTo("host")); + assertThat(parameters.isEmpty(), is(true)); + } + + @Test + public void testPort() throws Exception { + ProtocolConfig protocol = new ProtocolConfig(); + protocol.setPort(8080); + Map<String, String> parameters = new HashMap<String, String>(); + ProtocolConfig.appendParameters(parameters, protocol); + assertThat(protocol.getPort(), equalTo(8080)); + assertThat(parameters.isEmpty(), is(true)); + } + + @Test + public void testPath() throws Exception { + ProtocolConfig protocol = new ProtocolConfig(); + protocol.setContextpath("context-path"); + Map<String, String> parameters = new HashMap<String, String>(); + ProtocolConfig.appendParameters(parameters, protocol); + assertThat(protocol.getPath(), equalTo("context-path")); + assertThat(protocol.getContextpath(), equalTo("context-path")); + assertThat(parameters.isEmpty(), is(true)); + protocol.setPath("path"); + assertThat(protocol.getPath(), equalTo("path")); + assertThat(protocol.getContextpath(), equalTo("path")); + } + + @Test + public void testThreads() throws Exception { + ProtocolConfig protocol = new ProtocolConfig(); + protocol.setThreads(10); + assertThat(protocol.getThreads(), is(10)); + } + + @Test + public void testIothreads() throws Exception { + ProtocolConfig protocol = new ProtocolConfig(); + protocol.setIothreads(10); + assertThat(protocol.getIothreads(), is(10)); + } + + @Test + public void testQueues() throws Exception { + ProtocolConfig protocol = new ProtocolConfig(); + protocol.setQueues(10); + assertThat(protocol.getQueues(), is(10)); + } + + @Test + public void testAccepts() throws Exception { + ProtocolConfig protocol = new ProtocolConfig(); + protocol.setAccepts(10); + assertThat(protocol.getAccepts(), is(10)); + } + + @Test + public void testAccesslog() throws Exception { + ProtocolConfig protocol = new ProtocolConfig(); + protocol.setAccesslog("access.log"); + assertThat(protocol.getAccesslog(), equalTo("access.log")); + } + + @Test + public void testRegister() throws Exception { + ProtocolConfig protocol = new ProtocolConfig(); + protocol.setRegister(true); + assertThat(protocol.isRegister(), is(true)); + } + + @Test + public void testParameters() throws Exception { + ProtocolConfig protocol = new ProtocolConfig(); + protocol.setParameters(Collections.singletonMap("k1", "v1")); + assertThat(protocol.getParameters(), hasEntry("k1", "v1")); + } + + @Test + public void testDefault() throws Exception { + ProtocolConfig protocol = new ProtocolConfig(); + protocol.setDefault(true); + assertThat(protocol.isDefault(), is(true)); + } + + @Test + public void testKeepAlive() throws Exception { + ProtocolConfig protocol = new ProtocolConfig(); + protocol.setKeepAlive(true); + assertThat(protocol.getKeepAlive(), is(true)); + } + + @Test + public void testOptimizer() throws Exception { + ProtocolConfig protocol = new ProtocolConfig(); + protocol.setOptimizer("optimizer"); + assertThat(protocol.getOptimizer(), equalTo("optimizer")); + } + + @Test + public void testExtension() throws Exception { + ProtocolConfig protocol = new ProtocolConfig(); + protocol.setExtension("extension"); + assertThat(protocol.getExtension(), equalTo("extension")); + } +} \ No newline at end of file diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ProviderConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ProviderConfigTest.java new file mode 100644 index 0000000..10bdeb7 --- /dev/null +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ProviderConfigTest.java @@ -0,0 +1,187 @@ +/* + * 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.config; + +import com.alibaba.dubbo.config.ProviderConfig; + +import org.junit.Test; + +import java.util.HashMap; +import java.util.Map; + +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasEntry; +import static org.hamcrest.Matchers.hasKey; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.not; +import static org.junit.Assert.assertThat; + +public class ProviderConfigTest { + @Test + public void testProtocol() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setProtocol("protocol"); + assertThat(provider.getProtocol().getName(), equalTo("protocol")); + } + + @Test + public void testDefault() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setDefault(true); + Map<String, String> parameters = new HashMap<String, String>(); + ProviderConfig.appendParameters(parameters, provider); + assertThat(provider.isDefault(), is(true)); + assertThat(parameters, not(hasKey("default"))); + } + + @Test + public void testHost() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setHost("demo-host"); + Map<String, String> parameters = new HashMap<String, String>(); + ProviderConfig.appendParameters(parameters, provider); + assertThat(provider.getHost(), equalTo("demo-host")); + assertThat(parameters, not(hasKey("host"))); + } + + @Test + public void testPort() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setPort(8080); + Map<String, String> parameters = new HashMap<String, String>(); + ProviderConfig.appendParameters(parameters, provider); + assertThat(provider.getPort(), is(8080)); + assertThat(parameters, not(hasKey("port"))); + } + + @Test + public void testPath() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setPath("/path"); + Map<String, String> parameters = new HashMap<String, String>(); + ProviderConfig.appendParameters(parameters, provider); + assertThat(provider.getPath(), equalTo("/path")); + assertThat(provider.getContextpath(), equalTo("/path")); + assertThat(parameters, not(hasKey("path"))); + } + + @Test + public void testContextPath() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setContextpath("/context-path"); + Map<String, String> parameters = new HashMap<String, String>(); + ProviderConfig.appendParameters(parameters, provider); + assertThat(provider.getContextpath(), equalTo("/context-path")); + assertThat(parameters, not(hasKey("/context-path"))); + } + + + @Test + public void testThreads() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setThreads(10); + assertThat(provider.getThreads(), is(10)); + } + + @Test + public void testIothreads() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setIothreads(10); + assertThat(provider.getIothreads(), is(10)); + } + + @Test + public void testQueues() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setQueues(10); + assertThat(provider.getQueues(), is(10)); + } + + @Test + public void testAccepts() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setAccepts(10); + assertThat(provider.getAccepts(), is(10)); + } + + @Test + public void testCharset() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setCharset("utf-8"); + assertThat(provider.getCharset(), equalTo("utf-8")); + } + + @Test + public void testPayload() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setPayload(10); + assertThat(provider.getPayload(), is(10)); + } + + @Test + public void testBuffer() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setBuffer(10); + assertThat(provider.getBuffer(), is(10)); + } + + @Test + public void testServer() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setServer("demo-server"); + assertThat(provider.getServer(), equalTo("demo-server")); + } + + @Test + public void testClient() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setClient("client"); + assertThat(provider.getClient(), equalTo("client")); + } + + @Test + public void testPrompt() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setPrompt("#"); + Map<String, String> parameters = new HashMap<String, String>(); + ProviderConfig.appendParameters(parameters, provider); + assertThat(provider.getPrompt(), equalTo("#")); + assertThat(parameters, hasEntry("prompt", "%23")); + } + + @Test + public void testDispatcher() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setDispatcher("mockdispatcher"); + assertThat(provider.getDispatcher(), equalTo("mockdispatcher")); + } + + @Test + public void testNetworker() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setNetworker("networker"); + assertThat(provider.getNetworker(), equalTo("networker")); + } + + @Test + public void testWait() throws Exception { + ProviderConfig provider = new ProviderConfig(); + provider.setWait(10); + assertThat(provider.getWait(), equalTo(10)); + } +} \ No newline at end of file diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java new file mode 100644 index 0000000..7f331e6 --- /dev/null +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.dubbo.config; + +import org.apache.dubbo.service.DemoService; +import org.apache.dubbo.service.DemoServiceImpl; + +import com.alibaba.dubbo.config.ApplicationConfig; +import com.alibaba.dubbo.config.RegistryConfig; +import com.alibaba.dubbo.config.ProtocolConfig; +import com.alibaba.dubbo.config.ServiceConfig; +import com.alibaba.dubbo.config.ReferenceConfig; + +import org.junit.Test; + +public class ReferenceConfigTest { + + @Test + public void testInjvm() throws Exception { + ApplicationConfig application = new ApplicationConfig(); + application.setName("test-protocol-random-port"); + + RegistryConfig registry = new RegistryConfig(); + registry.setAddress("multicast://224.5.6.7:1234"); + + ProtocolConfig protocol = new ProtocolConfig(); + protocol.setName("dubbo"); + + ServiceConfig<DemoService> demoService; + demoService = new ServiceConfig<DemoService>(); + demoService.setInterface(DemoService.class); + demoService.setRef(new DemoServiceImpl()); + demoService.setApplication(application); + demoService.setRegistry(registry); + demoService.setProtocol(protocol); + + ReferenceConfig<DemoService> rc = new ReferenceConfig<DemoService>(); + rc.setApplication(application); + rc.setRegistry(registry); + rc.setInterface(DemoService.class.getName()); + rc.setInjvm(false); + + try { + demoService.export(); + rc.get(); + } finally { + demoService.unexport(); + } + } +} \ No newline at end of file diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java new file mode 100644 index 0000000..1511f42 --- /dev/null +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java @@ -0,0 +1,175 @@ +/* + * 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.config; + +import com.alibaba.dubbo.common.Constants; +import com.alibaba.dubbo.config.RegistryConfig; +import org.junit.Test; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasEntry; +import static org.hamcrest.Matchers.hasKey; +import static org.hamcrest.Matchers.not; +import static org.junit.Assert.assertThat; + +public class RegistryConfigTest { + @Test + public void testProtocol() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setProtocol("protocol"); + assertThat(registry.getProtocol(), equalTo(registry.getProtocol())); + } + + @Test + public void testAddress() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setAddress("localhost"); + assertThat(registry.getAddress(), equalTo("localhost")); + Map<String, String> parameters = new HashMap<String, String>(); + RegistryConfig.appendParameters(parameters, registry); + assertThat(parameters, not(hasKey("address"))); + } + + @Test + public void testUsername() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setUsername("username"); + assertThat(registry.getUsername(), equalTo("username")); + } + + @Test + public void testPassword() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setPassword("password"); + assertThat(registry.getPassword(), equalTo("password")); + } + + @Test + public void testWait() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setWait(10); + assertThat(registry.getWait(), is(10)); + assertThat(System.getProperty(Constants.SHUTDOWN_WAIT_KEY), equalTo("10")); + } + + @Test + public void testCheck() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setCheck(true); + assertThat(registry.isCheck(), is(true)); + } + + @Test + public void testFile() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setFile("file"); + assertThat(registry.getFile(), equalTo("file")); + } + + @Test + public void testTransporter() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setTransporter("transporter"); + assertThat(registry.getTransporter(), equalTo("transporter")); + } + + @Test + public void testClient() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setClient("client"); + assertThat(registry.getClient(), equalTo("client")); + } + + @Test + public void testTimeout() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setTimeout(10); + assertThat(registry.getTimeout(), is(10)); + } + + @Test + public void testSession() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setSession(10); + assertThat(registry.getSession(), is(10)); + } + + @Test + public void testDynamic() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setDynamic(true); + assertThat(registry.isDynamic(), is(true)); + } + + @Test + public void testRegister() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setRegister(true); + assertThat(registry.isRegister(), is(true)); + } + + @Test + public void testSubscribe() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setSubscribe(true); + assertThat(registry.isSubscribe(), is(true)); + } + + @Test + public void testCluster() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setCluster("cluster"); + assertThat(registry.getCluster(), equalTo("cluster")); + } + + @Test + public void testGroup() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setGroup("group"); + assertThat(registry.getGroup(), equalTo("group")); + } + + @Test + public void testVersion() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setVersion("1.0.0"); + assertThat(registry.getVersion(), equalTo("1.0.0")); + } + + @Test + public void testParameters() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setParameters(Collections.singletonMap("k1", "v1")); + assertThat(registry.getParameters(), hasEntry("k1", "v1")); + Map<String, String> parameters = new HashMap<String, String>(); + RegistryConfig.appendParameters(parameters, registry); + assertThat(parameters, hasEntry("k1", "v1")); + } + + @Test + public void testDefault() throws Exception { + RegistryConfig registry = new RegistryConfig(); + registry.setDefault(true); + assertThat(registry.isDefault(), is(true)); + } +} \ No newline at end of file diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/echo/EchoServiceTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/echo/EchoServiceTest.java similarity index 93% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/echo/EchoServiceTest.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/echo/EchoServiceTest.java index d02a70f..b9d1cf7 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/echo/EchoServiceTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/echo/EchoServiceTest.java @@ -15,18 +15,19 @@ * limitations under the License. */ -package org.apache.dubbo.compatible.echo; +package org.apache.dubbo.echo; import com.alibaba.dubbo.rpc.service.EchoService; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.ExtensionLoader; -import org.apache.dubbo.compatible.service.DemoService; -import org.apache.dubbo.compatible.service.DemoServiceImpl; +import org.apache.dubbo.service.DemoService; +import org.apache.dubbo.service.DemoServiceImpl; import org.apache.dubbo.rpc.Exporter; import org.apache.dubbo.rpc.Invoker; import org.apache.dubbo.rpc.Protocol; import org.apache.dubbo.rpc.ProxyFactory; + import org.junit.Assert; import org.junit.Test; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/filter/FilterTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/filter/FilterTest.java similarity index 94% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/filter/FilterTest.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/filter/FilterTest.java index 20fce74..53a2db3 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/filter/FilterTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/filter/FilterTest.java @@ -15,14 +15,15 @@ * limitations under the License. */ -package org.apache.dubbo.compatible.filter; +package org.apache.dubbo.filter; -import org.apache.dubbo.compatible.service.MockInvocation; +import org.apache.dubbo.service.MockInvocation; import org.apache.dubbo.rpc.Filter; import org.apache.dubbo.rpc.Invocation; import org.apache.dubbo.rpc.Invoker; import org.apache.dubbo.rpc.Result; import org.apache.dubbo.rpc.RpcException; + import org.junit.AfterClass; import org.junit.Assert; import org.junit.Test; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/filter/MyFilter.java b/dubbo-compatible/src/test/java/org/apache/dubbo/filter/MyFilter.java similarity index 97% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/filter/MyFilter.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/filter/MyFilter.java index 7970547..b7d7e24 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/filter/MyFilter.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/filter/MyFilter.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dubbo.compatible.filter; +package org.apache.dubbo.filter; import com.alibaba.dubbo.rpc.Filter; import com.alibaba.dubbo.rpc.Invocation; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/filter/MyInvoker.java b/dubbo-compatible/src/test/java/org/apache/dubbo/filter/MyInvoker.java similarity index 92% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/filter/MyInvoker.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/filter/MyInvoker.java index 6602422..5d69754 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/filter/MyInvoker.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/filter/MyInvoker.java @@ -14,10 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.compatible.filter; +package org.apache.dubbo.filter; import org.apache.dubbo.common.URL; -import org.apache.dubbo.compatible.service.DemoService; +import org.apache.dubbo.service.DemoService; import org.apache.dubbo.rpc.Invocation; import org.apache.dubbo.rpc.Invoker; import org.apache.dubbo.rpc.Result; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/generic/GenericServiceTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/generic/GenericServiceTest.java similarity index 95% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/generic/GenericServiceTest.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/generic/GenericServiceTest.java index bebcf52..f31234b 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/generic/GenericServiceTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/generic/GenericServiceTest.java @@ -15,18 +15,19 @@ * limitations under the License. */ -package org.apache.dubbo.compatible.generic; +package org.apache.dubbo.generic; import com.alibaba.dubbo.rpc.service.GenericService; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.extension.ExtensionLoader; -import org.apache.dubbo.compatible.service.DemoService; -import org.apache.dubbo.compatible.service.DemoServiceImpl; +import org.apache.dubbo.service.DemoService; +import org.apache.dubbo.service.DemoServiceImpl; import org.apache.dubbo.rpc.Exporter; import org.apache.dubbo.rpc.Invoker; import org.apache.dubbo.rpc.Protocol; import org.apache.dubbo.rpc.ProxyFactory; + import org.junit.Assert; import org.junit.Test; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/serialization/MyObjectInput.java b/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/MyObjectInput.java similarity index 97% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/serialization/MyObjectInput.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/serialization/MyObjectInput.java index 9703d8e..0e1d96c 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/serialization/MyObjectInput.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/MyObjectInput.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dubbo.compatible.serialization; +package org.apache.dubbo.serialization; import com.alibaba.dubbo.common.serialize.ObjectInput; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/serialization/MyObjectOutput.java b/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/MyObjectOutput.java similarity index 97% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/serialization/MyObjectOutput.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/serialization/MyObjectOutput.java index c4f7524..7147515 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/serialization/MyObjectOutput.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/MyObjectOutput.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dubbo.compatible.serialization; +package org.apache.dubbo.serialization; import com.alibaba.dubbo.common.serialize.ObjectOutput; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/serialization/MySerialization.java b/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/MySerialization.java similarity index 96% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/serialization/MySerialization.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/serialization/MySerialization.java index d2d5125..94db705 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/serialization/MySerialization.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/MySerialization.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dubbo.compatible.serialization; +package org.apache.dubbo.serialization; import com.alibaba.dubbo.common.URL; import com.alibaba.dubbo.common.serialize.ObjectInput; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/serialization/SerializationTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/SerializationTest.java similarity index 98% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/serialization/SerializationTest.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/serialization/SerializationTest.java index aea0f9b..b2adac4 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/serialization/SerializationTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/SerializationTest.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.apache.dubbo.compatible.serialization; +package org.apache.dubbo.serialization; import org.apache.dubbo.common.serialize.ObjectInput; import org.apache.dubbo.common.serialize.ObjectOutput; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/CustomArgument.java b/dubbo-compatible/src/test/java/org/apache/dubbo/service/CustomArgument.java similarity index 96% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/CustomArgument.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/service/CustomArgument.java index 400aaeb..76ffeb4 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/CustomArgument.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/service/CustomArgument.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.compatible.service; +package org.apache.dubbo.service; import java.io.Serializable; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/DemoService.java b/dubbo-compatible/src/test/java/org/apache/dubbo/service/DemoService.java similarity index 96% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/DemoService.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/service/DemoService.java index 6183cad..b73fa49 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/DemoService.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/service/DemoService.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.compatible.service; +package org.apache.dubbo.service; public interface DemoService { String sayHello(String name); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/DemoServiceImpl.java b/dubbo-compatible/src/test/java/org/apache/dubbo/service/DemoServiceImpl.java similarity index 97% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/DemoServiceImpl.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/service/DemoServiceImpl.java index 4fdfe59..cfbcf80 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/DemoServiceImpl.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/service/DemoServiceImpl.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.compatible.service; +package org.apache.dubbo.service; import org.apache.dubbo.rpc.RpcContext; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/MockInvocation.java b/dubbo-compatible/src/test/java/org/apache/dubbo/service/MockInvocation.java similarity index 94% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/MockInvocation.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/service/MockInvocation.java index a361603..148b5bc 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/MockInvocation.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/service/MockInvocation.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.compatible.service; +package org.apache.dubbo.service; import org.apache.dubbo.common.Constants; import org.apache.dubbo.rpc.Invocation; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Person.java b/dubbo-compatible/src/test/java/org/apache/dubbo/service/Person.java similarity index 93% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Person.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/service/Person.java index 7651233..3a856a1 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Person.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/service/Person.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.compatible.service; +package org.apache.dubbo.service; import java.io.Serializable; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java b/dubbo-compatible/src/test/java/org/apache/dubbo/service/Type.java similarity index 92% rename from dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java rename to dubbo-compatible/src/test/java/org/apache/dubbo/service/Type.java index e6bcf4c..070ceaa 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/compatible/service/Type.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/service/Type.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.compatible.service; +package org.apache.dubbo.service; public enum Type { High, Normal, Lower diff --git a/dubbo-compatible/src/test/resources/META-INF/services/com.alibaba.dubbo.common.extension.ExtensionFactory b/dubbo-compatible/src/test/resources/META-INF/services/com.alibaba.dubbo.common.extension.ExtensionFactory index 2cc5026..e4e4b43 100644 --- a/dubbo-compatible/src/test/resources/META-INF/services/com.alibaba.dubbo.common.extension.ExtensionFactory +++ b/dubbo-compatible/src/test/resources/META-INF/services/com.alibaba.dubbo.common.extension.ExtensionFactory @@ -1 +1 @@ -myfactory=org.apache.dubbo.compatible.common.extension.MyExtensionFactory \ No newline at end of file +myfactory=org.apache.dubbo.common.extension.MyExtensionFactory \ No newline at end of file