You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2021/11/25 06:20:31 UTC
[dubbo] 45/45: remove unit test to pass security check
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch release/3.0.14-rpccontext-bugfix
in repository https://gitbox.apache.org/repos/asf/dubbo.git
commit 3212992996d5d21e40cf4c09e3cf90dd97b4d936
Author: ken.lj <ke...@gmail.com>
AuthorDate: Thu Nov 25 14:18:47 2021 +0800
remove unit test to pass security check
---
...DynamicConfigurationServiceNameMappingTest.java | 90 ----
.../InMemoryWritableMetadataServiceTest.java | 149 -------
.../dubbo/metadata/LocalMetadataServiceTest.java | 36 --
.../dubbo/metadata/definition/MetadataTest.java | 151 -------
.../dubbo/metadata/definition/MetadataUtils.java | 75 ----
.../definition/ServiceDefinitionBuilderTest.java | 98 -----
.../metadata/definition/Test3TypeBuilder.java | 43 --
.../dubbo/metadata/definition/TestTypeBuilder.java | 43 --
.../definition/TypeDefinitionBuilderTest.java | 34 --
.../definition/common/ClassExtendsMap.java | 32 --
.../metadata/definition/common/ColorEnum.java | 22 -
.../metadata/definition/common/OuterClass.java | 40 --
.../common/ResultWithRawCollections.java | 54 ---
.../metadata/definition/common/TestService.java | 55 ---
.../metadata/definition/service/ComplexObject.java | 296 -------------
.../metadata/definition/service/DemoService.java | 30 --
.../report/identifier/MetadataIdentifierTest.java | 51 ---
.../support/AbstractMetadataReportFactoryTest.java | 130 ------
.../report/support/AbstractMetadataReportTest.java | 389 -----------------
.../dubbo/metadata/rest/DefaultRestService.java | 69 ---
.../apache/dubbo/metadata/rest/RestService.java | 42 --
.../dubbo/metadata/rest/SpringRestService.java | 97 -----
.../dubbo/metadata/rest/StandardRestService.java | 107 -----
.../java/org/apache/dubbo/metadata/rest/User.java | 62 ---
.../JAXRSServiceRestMetadataResolverTest.java | 82 ----
.../store/InMemoryWritableMetadataServiceTest.java | 111 -----
.../metadata/store/InterfaceNameTestService.java | 25 --
.../metadata/store/InterfaceNameTestService2.java | 25 --
.../store/RemoteWritableMeatadataServiceTest.java | 190 ---------
.../RemoteWritableMetadataServiceDelegateTest.java | 216 ----------
.../dubbo/metadata/store/RetryTestService.java | 27 --
.../metadata/test/JTestMetadataReport4Test.java | 103 -----
.../test/JTestMetadataReportFactory4Test.java | 33 --
...e.dubbo.metadata.definition.builder.TypeBuilder | 2 -
...che.dubbo.metadata.report.MetadataReportFactory | 1 -
.../dubbo/jax-rs-service-rest-metadata.json | 349 ---------------
.../AbstractAnnotationProcessingTest.java | 66 ---
.../AnnotationProcessingTestProcessor.java | 76 ----
.../processing/CompilerInvocationInterceptor.java | 45 --
.../builder/ArrayTypeDefinitionBuilderTest.java | 121 ------
.../CollectionTypeDefinitionBuilderTest.java | 105 -----
.../builder/EnumTypeDefinitionBuilderTest.java | 67 ---
.../builder/GeneralTypeDefinitionBuilderTest.java | 67 ---
.../builder/MapTypeDefinitionBuilderTest.java | 134 ------
.../PrimitiveTypeDefinitionBuilderTest.java | 130 ------
.../builder/ServiceDefinitionBuilderTest.java | 64 ---
.../builder/SimpleTypeDefinitionBuilderTest.java | 146 -------
.../processing/model/ArrayTypeModel.java | 36 --
.../processing/model/CollectionTypeModel.java | 42 --
.../annotation/processing/model/Color.java | 46 --
.../annotation/processing/model/MapTypeModel.java | 41 --
.../annotation/processing/model/Model.java | 89 ----
.../processing/model/PrimitiveTypeModel.java | 73 ----
.../processing/model/SimpleTypeModel.java | 161 -------
.../AnnotatedMethodParameterProcessorTest.java | 59 ---
.../processing/util/AnnotationUtilsTest.java | 231 ----------
.../annotation/processing/util/FieldUtilsTest.java | 259 ------------
.../processing/util/LoggerUtilsTest.java | 50 ---
.../processing/util/MemberUtilsTest.java | 113 -----
.../processing/util/MethodUtilsTest.java | 195 ---------
.../util/ServiceAnnotationUtilsTest.java | 136 ------
.../annotation/processing/util/TypeUtilsTest.java | 468 ---------------------
.../dubbo/metadata/rest/DefaultRestService.java | 69 ---
.../apache/dubbo/metadata/rest/RestService.java | 42 --
.../dubbo/metadata/rest/SpringRestService.java | 97 -----
.../dubbo/metadata/rest/StandardRestService.java | 107 -----
.../java/org/apache/dubbo/metadata/rest/User.java | 62 ---
.../org/apache/dubbo/metadata/tools/Ancestor.java | 35 --
.../org/apache/dubbo/metadata/tools/Compiler.java | 120 ------
.../apache/dubbo/metadata/tools/CompilerTest.java | 37 --
.../metadata/tools/DefaultRestServiceTest.java | 45 --
.../dubbo/metadata/tools/DefaultTestService.java | 63 ---
.../dubbo/metadata/tools/GenericTestService.java | 38 --
.../org/apache/dubbo/metadata/tools/Parent.java | 63 ---
.../dubbo/metadata/tools/RestServiceTest.java | 42 --
.../metadata/tools/SpringRestServiceTest.java | 39 --
.../metadata/tools/StandardRestServiceTest.java | 39 --
.../apache/dubbo/metadata/tools/TestProcessor.java | 50 ---
.../apache/dubbo/metadata/tools/TestService.java | 54 ---
.../dubbo/metadata/tools/TestServiceImpl.java | 51 ---
80 files changed, 7432 deletions(-)
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/DynamicConfigurationServiceNameMappingTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/DynamicConfigurationServiceNameMappingTest.java
deleted file mode 100644
index 0e677df..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/DynamicConfigurationServiceNameMappingTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.metadata;
-
-import org.apache.dubbo.common.config.configcenter.DynamicConfiguration;
-import org.apache.dubbo.common.config.configcenter.DynamicConfigurationFactory;
-import org.apache.dubbo.config.ApplicationConfig;
-import org.apache.dubbo.rpc.model.ApplicationModel;
-
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-
-import java.util.Set;
-import java.util.TreeSet;
-
-import static java.util.Arrays.asList;
-import static org.apache.dubbo.common.extension.ExtensionLoader.getExtensionLoader;
-import static org.apache.dubbo.metadata.DynamicConfigurationServiceNameMapping.buildGroup;
-import static org.apache.dubbo.metadata.ServiceNameMapping.getDefaultExtension;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-/**
- * {@link DynamicConfigurationServiceNameMapping} Test
- *
- * @since 2.7.5
- */
-public class DynamicConfigurationServiceNameMappingTest {
-
-
- private final ServiceNameMapping serviceNameMapping = getDefaultExtension();
-
- @BeforeAll
- public static void setUp() throws Exception {
-
- DynamicConfiguration configuration = getExtensionLoader(DynamicConfigurationFactory.class)
- .getExtension("file")
- .getDynamicConfiguration(null);
-
- ApplicationModel.getEnvironment().setDynamicConfiguration(configuration);
- }
-
- @Test
- public void testBuildGroup() {
- assertEquals("mapping/test", buildGroup("test", null, null, null));
- assertEquals("mapping/test", buildGroup("test", "default", null, null));
- assertEquals("mapping/test", buildGroup("test", "default", "1.0.0", null));
- assertEquals("mapping/test", buildGroup("test", "default", "1.0.0", "dubbo"));
- }
-
- @Test
- public void testMapAndGet() {
-
- String serviceName = "test";
- String serviceName2 = "test2";
-
- ApplicationModel.getConfigManager().setApplication(new ApplicationConfig(serviceName));
-
- String serviceInterface = "org.apache.dubbo.service.UserService";
- String group = null;
- String version = null;
- String protocol = null;
-
- serviceNameMapping.map(serviceInterface, group, version, protocol);
-
- ApplicationModel.getConfigManager().removeConfig(new ApplicationConfig(serviceName));
- ApplicationModel.getConfigManager().setApplication(new ApplicationConfig(serviceName2));
-
- serviceNameMapping.map(serviceInterface, group, version, protocol);
-
- Set<String> serviceNames = serviceNameMapping.get(serviceInterface, group, version, protocol);
-
- assertEquals(new TreeSet(asList(serviceName, serviceName2)), serviceNames);
-
- ApplicationModel.getConfigManager().removeConfig(new ApplicationConfig(serviceName2));
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/InMemoryWritableMetadataServiceTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/InMemoryWritableMetadataServiceTest.java
deleted file mode 100644
index 461cf28..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/InMemoryWritableMetadataServiceTest.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * 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.metadata;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.metadata.store.InMemoryWritableMetadataService;
-import org.apache.dubbo.rpc.model.ApplicationModel;
-
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import static java.util.Arrays.asList;
-import static java.util.Collections.unmodifiableSortedSet;
-import static org.apache.dubbo.common.URL.valueOf;
-import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY;
-import static org.apache.dubbo.common.constants.CommonConstants.PROTOCOL_KEY;
-import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * {@link InMemoryWritableMetadataService} Test
- *
- * @since 2.7.5
- */
-public class InMemoryWritableMetadataServiceTest {
-
- private WritableMetadataService metadataService = new InMemoryWritableMetadataService();
-
- private static final String TEST_SERVICE = "org.apache.dubbo.test.TestService";
-
- private static final URL BASE_URL = valueOf("dubbo://127.0.0.1:20880/" + TEST_SERVICE);
- private static final URL REST_BASE_URL = valueOf("rest://127.0.0.1:20880/" + TEST_SERVICE);
- private static final URL BASE_URL_GROUP = BASE_URL.addParameter(GROUP_KEY, "test");
- private static final URL BASE_URL_GROUP_AND_VERSION = BASE_URL_GROUP.addParameter(VERSION_KEY, "1.0.0");
- private static final URL BASE_URL_GROUP_AND_VERSION_AND_PROTOCOL = BASE_URL_GROUP_AND_VERSION.addParameter(PROTOCOL_KEY, "rest");
-
- @BeforeAll
- public static void init() {
- ApplicationModel.setApplication("test");
- }
-
- @Test
- public void testServiceName() {
- assertEquals("test", metadataService.serviceName());
- }
-
- @Test
- public void testVersion() {
- assertEquals("1.0.0", MetadataService.VERSION);
- assertEquals("1.0.0", metadataService.version());
- }
-
- @Test
- public void testGetExportedURLs() {
-
- assertTrue(metadataService.exportURL(BASE_URL));
- Set<String> exportedURLs = metadataService.getExportedURLs(TEST_SERVICE);
- assertEquals(1, exportedURLs.size());
- assertEquals(asSortedSet(BASE_URL.toFullString()), exportedURLs);
- assertTrue(metadataService.unexportURL(BASE_URL));
-
- assertTrue(metadataService.exportURL(BASE_URL));
- assertFalse(metadataService.exportURL(BASE_URL));
-
- assertTrue(metadataService.exportURL(BASE_URL_GROUP));
- assertTrue(metadataService.exportURL(BASE_URL_GROUP_AND_VERSION));
-
- exportedURLs = metadataService.getExportedURLs(TEST_SERVICE);
- assertEquals(asSortedSet(BASE_URL.toFullString()), exportedURLs);
- assertEquals(asSortedSet(
- BASE_URL.toFullString(),
- BASE_URL_GROUP.toFullString(),
- BASE_URL_GROUP_AND_VERSION.toFullString()), metadataService.getExportedURLs());
-
- assertTrue(metadataService.exportURL(REST_BASE_URL));
- exportedURLs = metadataService.getExportedURLs(TEST_SERVICE);
- assertEquals(asSortedSet(BASE_URL.toFullString(), REST_BASE_URL.toFullString()), exportedURLs);
-
- metadataService.exportURL(BASE_URL_GROUP_AND_VERSION_AND_PROTOCOL);
-
- exportedURLs = metadataService.getExportedURLs(TEST_SERVICE, "test", "1.0.0", "rest");
-
- assertEquals(asSortedSet(BASE_URL_GROUP_AND_VERSION_AND_PROTOCOL.toFullString()), exportedURLs);
- }
-
- @Test
- public void testGetSubscribedURLs() {
- assertTrue(metadataService.subscribeURL(BASE_URL));
- assertFalse(metadataService.subscribeURL(BASE_URL));
-
- assertTrue(metadataService.subscribeURL(BASE_URL_GROUP));
- assertTrue(metadataService.subscribeURL(BASE_URL_GROUP_AND_VERSION));
- assertTrue(metadataService.subscribeURL(REST_BASE_URL));
-
- Set<String> subscribedURLs = metadataService.getSubscribedURLs();
- assertEquals(4, subscribedURLs.size());
- assertEquals(asSortedSet(
- BASE_URL.toFullString(),
- REST_BASE_URL.toFullString(),
- BASE_URL_GROUP.toFullString(),
- BASE_URL_GROUP_AND_VERSION.toFullString()), subscribedURLs);
-
- assertTrue(metadataService.unsubscribeURL(REST_BASE_URL));
- subscribedURLs = metadataService.getSubscribedURLs();
- assertEquals(3, subscribedURLs.size());
- assertEquals(asSortedSet(
- BASE_URL.toFullString(),
- BASE_URL_GROUP.toFullString(),
- BASE_URL_GROUP_AND_VERSION.toFullString()), subscribedURLs);
-
- assertTrue(metadataService.unsubscribeURL(BASE_URL_GROUP));
- subscribedURLs = metadataService.getSubscribedURLs();
- assertEquals(2, subscribedURLs.size());
- assertEquals(asSortedSet(
- BASE_URL.toFullString(),
- BASE_URL_GROUP_AND_VERSION.toFullString()), subscribedURLs);
-
- assertTrue(metadataService.unsubscribeURL(BASE_URL_GROUP_AND_VERSION));
- subscribedURLs = metadataService.getSubscribedURLs();
- assertEquals(1, subscribedURLs.size());
- assertEquals(asSortedSet(
- BASE_URL.toFullString()), subscribedURLs);
- }
-
- private static <T extends Comparable<T>> SortedSet<T> asSortedSet(T... values) {
- return unmodifiableSortedSet(new TreeSet<>(asList(values)));
- }
-
-}
\ No newline at end of file
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/LocalMetadataServiceTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/LocalMetadataServiceTest.java
deleted file mode 100644
index 45fc8e0..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/LocalMetadataServiceTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.metadata;
-
-import org.apache.dubbo.metadata.store.InMemoryWritableMetadataService;
-
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-/**
- * {@link WritableMetadataService} Test
- *
- * @since 2.7.5
- */
-public class LocalMetadataServiceTest {
-
- @Test
- public void testDefaultExtension() {
- assertEquals(InMemoryWritableMetadataService.class, WritableMetadataService.getDefaultExtension().getClass());
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/MetadataTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/MetadataTest.java
deleted file mode 100644
index 5a921f8..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/MetadataTest.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * 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.metadata.definition;
-
-import org.apache.dubbo.metadata.definition.builder.CollectionTypeBuilder;
-import org.apache.dubbo.metadata.definition.builder.DefaultTypeBuilder;
-import org.apache.dubbo.metadata.definition.builder.EnumTypeBuilder;
-import org.apache.dubbo.metadata.definition.builder.MapTypeBuilder;
-import org.apache.dubbo.metadata.definition.common.ClassExtendsMap;
-import org.apache.dubbo.metadata.definition.common.ColorEnum;
-import org.apache.dubbo.metadata.definition.common.OuterClass;
-import org.apache.dubbo.metadata.definition.common.ResultWithRawCollections;
-import org.apache.dubbo.metadata.definition.common.TestService;
-import org.apache.dubbo.metadata.definition.model.ServiceDefinition;
-import org.apache.dubbo.metadata.definition.model.TypeDefinition;
-
-import com.google.gson.Gson;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-/**
- * TypeDefinitionBuilder
- * <p>
- * 16/9/22.
- */
-public class MetadataTest {
-
- /**
- */
- @Test
- public void testInnerClassType() {
- TypeDefinitionBuilder builder = new TypeDefinitionBuilder();
- TypeDefinition td = builder.build(OuterClass.InnerClass.class, OuterClass.InnerClass.class);
- System.out.println(">> testInnerClassType: " + new Gson().toJson(td));
-
- Assertions.assertEquals("org.apache.dubbo.metadata.definition.common.OuterClass$InnerClass", td.getType());
- Assertions.assertEquals(1, td.getProperties().size());
- Assertions.assertNotNull(td.getProperties().get("name"));
- Assertions.assertEquals(DefaultTypeBuilder.class.getName(), td.getTypeBuilderName());
- ServiceDefinition sd = MetadataUtils.generateMetadata(TestService.class);
- System.out.println(">> testInnerClassType: " + new Gson().toJson(sd));
-
- Assertions.assertEquals(TestService.class.getName(), sd.getCanonicalName());
- Assertions.assertEquals(TestService.class.getMethods().length, sd.getMethods().size());
- boolean containsType = false;
- for (TypeDefinition type : sd.getTypes()) {
- if (type.getType().equals("org.apache.dubbo.metadata.definition.common.OuterClass$InnerClass")) {
- containsType = true;
- break;
- }
- }
- Assertions.assertTrue(containsType);
- }
-
- /**
- */
- @Test
- public void testRawMap() {
- TypeDefinitionBuilder builder = new TypeDefinitionBuilder();
- TypeDefinition td = builder.build(ResultWithRawCollections.class, ResultWithRawCollections.class);
- System.out.println(">> testRawMap: " + new Gson().toJson(td));
-
- Assertions.assertEquals("org.apache.dubbo.metadata.definition.common.ResultWithRawCollections", td.getType());
- Assertions.assertEquals(2, td.getProperties().size());
- Assertions.assertEquals("java.util.Map", td.getProperties().get("map").getType());
- Assertions.assertEquals(MapTypeBuilder.class.getName(), td.getProperties().get("map").getTypeBuilderName());
- Assertions.assertEquals("java.util.List", td.getProperties().get("list").getType());
- Assertions.assertEquals(CollectionTypeBuilder.class.getName(), td.getProperties().get("list").getTypeBuilderName());
-
- ServiceDefinition sd = MetadataUtils.generateMetadata(TestService.class);
- System.out.println(">> testRawMap: " + new Gson().toJson(sd));
-
- Assertions.assertEquals(TestService.class.getName(), sd.getCanonicalName());
- Assertions.assertEquals(TestService.class.getMethods().length, sd.getMethods().size());
- boolean containsType = false;
- for (TypeDefinition type : sd.getTypes()) {
- if (type.getType().equals("org.apache.dubbo.metadata.definition.common.ResultWithRawCollections")) {
- containsType = true;
- break;
- }
- }
- Assertions.assertTrue(containsType);
- }
-
- @Test
- public void testEnum() {
- TypeDefinitionBuilder builder = new TypeDefinitionBuilder();
- TypeDefinition td = builder.build(ColorEnum.class, ColorEnum.class);
- System.out.println(">> testEnum: " + new Gson().toJson(td));
-
- Assertions.assertEquals("org.apache.dubbo.metadata.definition.common.ColorEnum", td.getType());
- Assertions.assertEquals(EnumTypeBuilder.class.getName(), td.getTypeBuilderName());
- Assertions.assertEquals(3, td.getEnums().size());
- Assertions.assertTrue(td.getEnums().contains("RED"));
- Assertions.assertTrue(td.getEnums().contains("YELLOW"));
- Assertions.assertTrue(td.getEnums().contains("BLUE"));
-
- ServiceDefinition sd = MetadataUtils.generateMetadata(TestService.class);
- System.out.println(">> testEnum: " + new Gson().toJson(sd));
-
- Assertions.assertEquals(TestService.class.getName(), sd.getCanonicalName());
- Assertions.assertEquals(TestService.class.getMethods().length, sd.getMethods().size());
- boolean containsType = false;
- for (TypeDefinition type : sd.getTypes()) {
- if (type.getType().equals("org.apache.dubbo.metadata.definition.common.ColorEnum")) {
- containsType = true;
- break;
- }
- }
- Assertions.assertTrue(containsType);
- }
-
- @Test
- public void testExtendsMap() {
- TypeDefinitionBuilder builder = new TypeDefinitionBuilder();
- TypeDefinition td = builder.build(ClassExtendsMap.class, ClassExtendsMap.class);
- System.out.println(">> testExtendsMap: " + new Gson().toJson(td));
-
- Assertions.assertEquals("org.apache.dubbo.metadata.definition.common.ClassExtendsMap", td.getType());
- Assertions.assertEquals(MapTypeBuilder.class.getName(), td.getTypeBuilderName());
- Assertions.assertEquals(0, td.getProperties().size());
-
- ServiceDefinition sd = MetadataUtils.generateMetadata(TestService.class);
- System.out.println(">> testExtendsMap: " + new Gson().toJson(sd));
-
- Assertions.assertEquals(TestService.class.getName(), sd.getCanonicalName());
- Assertions.assertEquals(TestService.class.getMethods().length, sd.getMethods().size());
- boolean containsType = false;
- for (TypeDefinition type : sd.getTypes()) {
- if (type.getType().equals("org.apache.dubbo.metadata.definition.common.ClassExtendsMap")) {
- containsType = true;
- break;
- }
- }
- Assertions.assertFalse(containsType);
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/MetadataUtils.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/MetadataUtils.java
deleted file mode 100644
index 14ae62f..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/MetadataUtils.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.metadata.definition;
-
-import org.apache.dubbo.metadata.definition.model.MethodDefinition;
-import org.apache.dubbo.metadata.definition.model.ServiceDefinition;
-import org.apache.dubbo.metadata.definition.model.TypeDefinition;
-import org.apache.dubbo.metadata.definition.util.ClassUtils;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.List;
-
-/**
- * generate metadata
- * <p>
- * 2017-4-17 14:33:24
- */
-public class MetadataUtils {
-
- /**
- * com.taobao.hsf.metadata.store.MetadataInfoStoreServiceRedis.publishClassInfo(ServiceMetadata) 生成元数据的代码
- */
- public static ServiceDefinition generateMetadata(Class<?> interfaceClass) {
- ServiceDefinition sd = new ServiceDefinition();
- sd.setCanonicalName(interfaceClass.getCanonicalName());
- sd.setCodeSource(ClassUtils.getCodeSource(interfaceClass));
-
- TypeDefinitionBuilder builder = new TypeDefinitionBuilder();
- List<Method> methods = ClassUtils.getPublicNonStaticMethods(interfaceClass);
- for (Method method : methods) {
- MethodDefinition md = new MethodDefinition();
- md.setName(method.getName());
-
- Class<?>[] paramTypes = method.getParameterTypes();
- Type[] genericParamTypes = method.getGenericParameterTypes();
-
- String[] parameterTypes = new String[paramTypes.length];
- for (int i = 0; i < paramTypes.length; i++) {
- try {
- TypeDefinition td = builder.build(genericParamTypes[i], paramTypes[i]);
- parameterTypes[i] = td.getType();
- } catch (Exception e) {
- parameterTypes[i] = paramTypes[i].getName();
- }
- }
- md.setParameterTypes(parameterTypes);
- try {
- TypeDefinition td = builder.build(method.getGenericReturnType(), method.getReturnType());
- md.setReturnType(td.getType());
- } catch (Exception e) {
- md.setReturnType(method.getReturnType().getName());
- }
-
- sd.getMethods().add(md);
- }
-
- sd.setTypes(builder.getTypeDefinitions());
- return sd;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/ServiceDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/ServiceDefinitionBuilderTest.java
deleted file mode 100644
index 3762f3a..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/ServiceDefinitionBuilderTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.metadata.definition;
-
-import org.apache.dubbo.metadata.definition.model.FullServiceDefinition;
-import org.apache.dubbo.metadata.definition.model.MethodDefinition;
-import org.apache.dubbo.metadata.definition.model.TypeDefinition;
-import org.apache.dubbo.metadata.definition.service.ComplexObject;
-import org.apache.dubbo.metadata.definition.service.DemoService;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * 2018/11/6
- */
-public class ServiceDefinitionBuilderTest {
-
- @Test
- public void testBuilderComplextObject() {
- FullServiceDefinition fullServiceDefinition = ServiceDefinitionBuilder.buildFullDefinition(DemoService.class);
- checkComplextObjectAsParam(fullServiceDefinition);
- }
-
-
- void checkComplextObjectAsParam(FullServiceDefinition fullServiceDefinition) {
- List<MethodDefinition> methodDefinitions = fullServiceDefinition.getMethods();
- MethodDefinition complexCompute = null;
- MethodDefinition findComplexObject = null;
- for (MethodDefinition methodDefinition : methodDefinitions) {
- if ("complexCompute".equals(methodDefinition.getName())) {
- complexCompute = methodDefinition;
- } else if ("findComplexObject".equals(methodDefinition.getName())) {
- findComplexObject = methodDefinition;
- }
- }
- Assertions.assertTrue(Arrays.equals(complexCompute.getParameterTypes(), new String[]{String.class.getName(), ComplexObject.class.getName()}));
- Assertions.assertEquals(complexCompute.getReturnType(), String.class.getName());
-
- Assertions.assertTrue(Arrays.equals(findComplexObject.getParameterTypes(), new String[]{String.class.getName(), "int", "long",
- String[].class.getCanonicalName(), "java.util.List<java.lang.Integer>", ComplexObject.TestEnum.class.getCanonicalName()}));
- Assertions.assertEquals(findComplexObject.getReturnType(), ComplexObject.class.getCanonicalName());
-
-
- List<TypeDefinition> typeDefinitions = fullServiceDefinition.getTypes();
-
- TypeDefinition topTypeDefinition = null;
- TypeDefinition innerTypeDefinition = null;
- TypeDefinition inner2TypeDefinition = null;
- TypeDefinition inner3TypeDefinition = null;
- for (TypeDefinition typeDefinition : typeDefinitions) {
- if (typeDefinition.getType().equals(ComplexObject.class.getName())) {
- topTypeDefinition = typeDefinition;
- } else if (typeDefinition.getType().equals(ComplexObject.InnerObject.class.getName())) {
- innerTypeDefinition = typeDefinition;
- } else if (typeDefinition.getType().contains(ComplexObject.InnerObject2.class.getName())) {
- inner2TypeDefinition = typeDefinition;
- } else if (typeDefinition.getType().equals(ComplexObject.InnerObject3.class.getName())) {
- inner3TypeDefinition = typeDefinition;
- }
- }
- Assertions.assertEquals(topTypeDefinition.getProperties().get("v").getType(), "long");
- Assertions.assertEquals(topTypeDefinition.getProperties().get("maps").getType(), "java.util.Map<java.lang.String,java.lang.String>");
- Assertions.assertEquals(topTypeDefinition.getProperties().get("innerObject").getType(), ComplexObject.InnerObject.class.getName());
- Assertions.assertEquals(topTypeDefinition.getProperties().get("intList").getType(), "java.util.List<java.lang.Integer>");
- Assertions.assertEquals(topTypeDefinition.getProperties().get("strArrays").getType(), "java.lang.String[]");
- Assertions.assertEquals(topTypeDefinition.getProperties().get("innerObject3").getType(), "org.apache.dubbo.metadata.definition.service.ComplexObject.InnerObject3[]");
- Assertions.assertEquals(topTypeDefinition.getProperties().get("testEnum").getType(), "org.apache.dubbo.metadata.definition.service.ComplexObject.TestEnum");
- Assertions.assertEquals(topTypeDefinition.getProperties().get("innerObject2").getType(), "java.util.Set<org.apache.dubbo.metadata.definition.service.ComplexObject$InnerObject2>");
-
- Assertions.assertSame(innerTypeDefinition.getProperties().get("innerA").getType(), "java.lang.String");
- Assertions.assertSame(innerTypeDefinition.getProperties().get("innerB").getType(), "int");
-
- Assertions.assertSame(inner2TypeDefinition.getProperties().get("innerA2").getType(), "java.lang.String");
- Assertions.assertSame(inner2TypeDefinition.getProperties().get("innerB2").getType(), "int");
-
- Assertions.assertSame(inner3TypeDefinition.getProperties().get("innerA3").getType(), "java.lang.String");
-
- }
-
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/Test3TypeBuilder.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/Test3TypeBuilder.java
deleted file mode 100644
index 075a69e..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/Test3TypeBuilder.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.metadata.definition;
-
-import org.apache.dubbo.metadata.definition.builder.TypeBuilder;
-import org.apache.dubbo.metadata.definition.model.TypeDefinition;
-
-import java.lang.reflect.Type;
-import java.util.Map;
-
-/**
- * test for sort
- */
-public class Test3TypeBuilder implements TypeBuilder {
- // it is smaller than the implements of TypeBuilder
- public int getPriority(){
- return 10;
- }
-
- @Override
- public boolean accept(Type type, Class<?> clazz) {
- return false;
- }
-
- @Override
- public TypeDefinition build(Type type, Class<?> clazz, Map<Class<?>, TypeDefinition> typeCache) {
- return null;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/TestTypeBuilder.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/TestTypeBuilder.java
deleted file mode 100644
index bf7e9c6..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/TestTypeBuilder.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.metadata.definition;
-
-import org.apache.dubbo.metadata.definition.builder.TypeBuilder;
-import org.apache.dubbo.metadata.definition.model.TypeDefinition;
-
-import java.lang.reflect.Type;
-import java.util.Map;
-
-/**
- * test for sort
- */
-public class TestTypeBuilder implements TypeBuilder {
- // it is smaller than the implements of TypeBuilder
- public int getPriority(){
- return -3;
- }
-
- @Override
- public boolean accept(Type type, Class<?> clazz) {
- return false;
- }
-
- @Override
- public TypeDefinition build(Type type, Class<?> clazz, Map<Class<?>, TypeDefinition> typeCache) {
- return null;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/TypeDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/TypeDefinitionBuilderTest.java
deleted file mode 100644
index 11d03a1..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/TypeDefinitionBuilderTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.metadata.definition;
-
-import org.apache.dubbo.metadata.definition.builder.TypeBuilder;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-public class TypeDefinitionBuilderTest {
-
- @Test
- public void testSortTypeBuilder(){
- TypeBuilder tb = TypeDefinitionBuilder.BUILDERS.get(0);
- Assertions.assertTrue(tb instanceof TestTypeBuilder);
-
- tb = TypeDefinitionBuilder.BUILDERS.get(TypeDefinitionBuilder.BUILDERS.size()-1);
- Assertions.assertTrue(tb instanceof Test3TypeBuilder);
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/common/ClassExtendsMap.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/common/ClassExtendsMap.java
deleted file mode 100644
index eacd124..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/common/ClassExtendsMap.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.metadata.definition.common;
-
-import java.util.HashMap;
-
-public class ClassExtendsMap extends HashMap<String, Object> {
-
- private static final long serialVersionUID = 5108356684263812575L;
- private ClassExtendsMap resultMap;
-
- public ClassExtendsMap() {
- }
-
- public ClassExtendsMap getResultMap() {
- return resultMap;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/common/ColorEnum.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/common/ColorEnum.java
deleted file mode 100644
index db00d58..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/common/ColorEnum.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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.metadata.definition.common;
-
-public enum ColorEnum {
-
- RED, YELLOW, BLUE
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/common/OuterClass.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/common/OuterClass.java
deleted file mode 100644
index 8f3f9df..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/common/OuterClass.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.metadata.definition.common;
-
-/**
- * 16/9/22.
- */
-public class OuterClass {
-
- public static class InnerClass {
-
- private String name;
-
- public InnerClass() {
- System.out.println("I am inner class");
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/common/ResultWithRawCollections.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/common/ResultWithRawCollections.java
deleted file mode 100644
index 07f1711..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/common/ResultWithRawCollections.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.metadata.definition.common;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- *
- */
-@SuppressWarnings("rawtypes")
-public class ResultWithRawCollections {
-
- private Map map;
- private List list;
-
- public ResultWithRawCollections() {
- }
-
- public ResultWithRawCollections(Map map, List list) {
- this.map = map;
- this.list = list;
- }
-
- public List getList() {
- return list;
- }
-
- public void setList(List list) {
- this.list = list;
- }
-
- public Map getMap() {
- return map;
- }
-
- public void setMap(Map map) {
- this.map = map;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/common/TestService.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/common/TestService.java
deleted file mode 100644
index 3f2066c..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/common/TestService.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.metadata.definition.common;
-
-/**
- * 16/9/22.
- */
-public interface TestService {
- /**
- *
- * @param innerClass
- * @return
- */
- void m1(OuterClass.InnerClass innerClass);
-
- /**
- *
- * @param a
- */
- void m2(int[] a);
-
- /**
- *
- * @param s1
- * @return
- */
- ResultWithRawCollections m3(String s1);
-
- /**
- *
- * @param color
- */
- void m4(ColorEnum color);
-
- /**
- *
- * @param s1
- * @return
- */
- ClassExtendsMap m5(String s1);
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/service/ComplexObject.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/service/ComplexObject.java
deleted file mode 100644
index 9371e8a..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/service/ComplexObject.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * 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.metadata.definition.service;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-
-/**
- * for test
- */
-public class ComplexObject {
-
- public ComplexObject() {
- }
-
- public ComplexObject(String var1, int var2, long l, String[] var3, List<Integer> var4, ComplexObject.TestEnum testEnum) {
- this.setInnerObject(new ComplexObject.InnerObject());
- this.getInnerObject().setInnerA(var1);
- this.getInnerObject().setInnerB(var2);
- this.setIntList(var4);
- this.setStrArrays(var3);
- this.setTestEnum(testEnum);
- this.setV(l);
- InnerObject2 io21 = new InnerObject2();
- io21.setInnerA2(var1 + "_21");
- io21.setInnerB2(var2 + 100000);
- InnerObject2 io22 = new InnerObject2();
- io22.setInnerA2(var1 + "_22");
- io22.setInnerB2(var2 + 200000);
- this.setInnerObject2(new HashSet<InnerObject2>(Arrays.asList(io21, io22)));
-
- InnerObject3 io31 = new InnerObject3();
- io31.setInnerA3(var1 + "_31");
- InnerObject3 io32 = new InnerObject3();
- io32.setInnerA3(var1 + "_32");
- InnerObject3 io33 = new InnerObject3();
- io33.setInnerA3(var1 + "_33");
- this.setInnerObject3(new InnerObject3[]{io31, io32, io33});
- this.maps = new HashMap<>(4);
- this.maps.put(var1 + "_k1", var1 + "_v1");
- this.maps.put(var1 + "_k2", var1 + "_v2");
- }
-
- private InnerObject innerObject;
- private Set<InnerObject2> innerObject2;
- private InnerObject3[] innerObject3;
- private String[] strArrays;
- private List<Integer> intList;
- private long v;
- private TestEnum testEnum;
- private Map<String, String> maps;
-
- public InnerObject getInnerObject() {
- return innerObject;
- }
-
- public void setInnerObject(InnerObject innerObject) {
- this.innerObject = innerObject;
- }
-
- public String[] getStrArrays() {
- return strArrays;
- }
-
- public void setStrArrays(String[] strArrays) {
- this.strArrays = strArrays;
- }
-
- public List<Integer> getIntList() {
- return intList;
- }
-
- public void setIntList(List<Integer> intList) {
- this.intList = intList;
- }
-
- public long getV() {
- return v;
- }
-
- public void setV(long v) {
- this.v = v;
- }
-
- public TestEnum getTestEnum() {
- return testEnum;
- }
-
- public void setTestEnum(TestEnum testEnum) {
- this.testEnum = testEnum;
- }
-
- public Set<InnerObject2> getInnerObject2() {
- return innerObject2;
- }
-
- public void setInnerObject2(Set<InnerObject2> innerObject2) {
- this.innerObject2 = innerObject2;
- }
-
- public InnerObject3[] getInnerObject3() {
- return innerObject3;
- }
-
- public void setInnerObject3(InnerObject3[] innerObject3) {
- this.innerObject3 = innerObject3;
- }
-
- public Map<String, String> getMaps() {
- return maps;
- }
-
- public void setMaps(Map<String, String> maps) {
- this.maps = maps;
- }
-
- @Override
- public String toString() {
- return "ComplexObject{" +
- "innerObject=" + innerObject +
- ", innerObject2=" + innerObject2 +
- ", innerObject3=" + Arrays.toString(innerObject3) +
- ", strArrays=" + Arrays.toString(strArrays) +
- ", intList=" + intList +
- ", v=" + v +
- ", testEnum=" + testEnum +
- ", maps=" + maps +
- '}';
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof ComplexObject)) return false;
- ComplexObject that = (ComplexObject) o;
- return getV() == that.getV() &&
- Objects.equals(getInnerObject(), that.getInnerObject()) &&
- Objects.equals(getInnerObject2(), that.getInnerObject2()) &&
- Arrays.equals(getInnerObject3(), that.getInnerObject3()) &&
- Arrays.equals(getStrArrays(), that.getStrArrays()) &&
- Objects.equals(getIntList(), that.getIntList()) &&
- getTestEnum() == that.getTestEnum() &&
- Objects.equals(getMaps(), that.getMaps());
- }
-
- @Override
- public int hashCode() {
- int result = Objects.hash(getInnerObject(), getInnerObject2(), getIntList(), getV(), getTestEnum(), getMaps());
- result = 31 * result + Arrays.hashCode(getInnerObject3());
- result = 31 * result + Arrays.hashCode(getStrArrays());
- return result;
- }
-
- public enum TestEnum {
- VALUE1, VALUE2
- }
-
- static public class InnerObject {
- String innerA;
- int innerB;
-
- public String getInnerA() {
- return innerA;
- }
-
- public void setInnerA(String innerA) {
- this.innerA = innerA;
- }
-
- public int getInnerB() {
- return innerB;
- }
-
- public void setInnerB(int innerB) {
- this.innerB = innerB;
- }
-
- @Override
- public String toString() {
- return "InnerObject{" +
- "innerA='" + innerA + '\'' +
- ", innerB=" + innerB +
- '}';
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof InnerObject)) return false;
- InnerObject that = (InnerObject) o;
- return getInnerB() == that.getInnerB() &&
- Objects.equals(getInnerA(), that.getInnerA());
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(getInnerA(), getInnerB());
- }
- }
-
- static public class InnerObject2 {
- String innerA2;
- int innerB2;
-
- public String getInnerA2() {
- return innerA2;
- }
-
- public void setInnerA2(String innerA2) {
- this.innerA2 = innerA2;
- }
-
- public int getInnerB2() {
- return innerB2;
- }
-
- public void setInnerB2(int innerB2) {
- this.innerB2 = innerB2;
- }
-
- @Override
- public String toString() {
- return "InnerObject{" +
- "innerA='" + innerA2 + '\'' +
- ", innerB=" + innerB2 +
- '}';
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof InnerObject2)) return false;
- InnerObject2 that = (InnerObject2) o;
- return getInnerB2() == that.getInnerB2() &&
- Objects.equals(getInnerA2(), that.getInnerA2());
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(getInnerA2(), getInnerB2());
- }
- }
-
- static public class InnerObject3 {
- String innerA3;
-
- public String getInnerA3() {
- return innerA3;
- }
-
- public void setInnerA3(String innerA3) {
- this.innerA3 = innerA3;
- }
-
- @Override
- public String toString() {
- return "InnerObject3{" +
- "innerA3='" + innerA3 + '\'' +
- '}';
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof InnerObject3)) return false;
- InnerObject3 that = (InnerObject3) o;
- return Objects.equals(getInnerA3(), that.getInnerA3());
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(getInnerA3());
- }
- }
-}
-
-
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/service/DemoService.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/service/DemoService.java
deleted file mode 100644
index c839c66..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/definition/service/DemoService.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.metadata.definition.service;
-
-import java.util.List;
-
-/**
- * for test
- */
-public interface DemoService {
-
- String complexCompute(String input, ComplexObject co);
-
- ComplexObject findComplexObject(String var1, int var2, long l, String[] var3, List<Integer> var4, ComplexObject.TestEnum testEnum);
-
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/identifier/MetadataIdentifierTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/identifier/MetadataIdentifierTest.java
deleted file mode 100644
index 90df3db..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/identifier/MetadataIdentifierTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.metadata.report.identifier;
-
-import org.apache.dubbo.metadata.MetadataConstants;
-import org.apache.dubbo.metadata.report.identifier.KeyTypeEnum;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import static org.apache.dubbo.common.constants.CommonConstants.PATH_SEPARATOR;
-import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER_SIDE;
-
-/**
- * 2019/1/7
- */
-public class MetadataIdentifierTest {
-
- @Test
- public void testGetUniqueKey() {
- String interfaceName = "org.apache.dubbo.metadata.integration.InterfaceNameTestService";
- String version = "1.0.0.zk.md";
- String group = null;
- String application = "vic.zk.md";
- MetadataIdentifier providerMetadataIdentifier = new MetadataIdentifier(interfaceName, version, group, PROVIDER_SIDE, application);
- Assertions.assertEquals(providerMetadataIdentifier.getUniqueKey(KeyTypeEnum.PATH),
- "metadata" + PATH_SEPARATOR + interfaceName + PATH_SEPARATOR +
- (version == null ? "" : (version + PATH_SEPARATOR))
- + (group == null ? "" : (group + PATH_SEPARATOR)) + PROVIDER_SIDE
- + PATH_SEPARATOR + application);
- Assertions.assertEquals(providerMetadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY),
- interfaceName + MetadataConstants.KEY_SEPARATOR +
- (version == null ? "" : version) + MetadataConstants.KEY_SEPARATOR
- + (group == null ? "" : group) + MetadataConstants.KEY_SEPARATOR
- + PROVIDER_SIDE + MetadataConstants.KEY_SEPARATOR + application);
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportFactoryTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportFactoryTest.java
deleted file mode 100644
index 30d4ad1..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportFactoryTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.metadata.report.support;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.utils.NetUtils;
-import org.apache.dubbo.metadata.definition.model.ServiceDefinition;
-import org.apache.dubbo.metadata.report.MetadataReport;
-import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;
-import org.apache.dubbo.metadata.report.identifier.ServiceMetadataIdentifier;
-import org.apache.dubbo.metadata.report.identifier.SubscriberMetadataIdentifier;
-
-import com.alibaba.fastjson.JSON;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * 2018/9/14
- */
-public class AbstractMetadataReportFactoryTest {
-
- private AbstractMetadataReportFactory metadataReportFactory = new AbstractMetadataReportFactory() {
- @Override
- protected MetadataReport createMetadataReport(URL url) {
- return new MetadataReport() {
-
- @Override
- public void storeProviderMetadata(MetadataIdentifier providerMetadataIdentifier, ServiceDefinition serviceDefinition) {
- store.put(providerMetadataIdentifier.getIdentifierKey(), JSON.toJSONString(serviceDefinition));
- }
-
- @Override
- public void saveServiceMetadata(ServiceMetadataIdentifier metadataIdentifier, URL url) {
-
- }
-
- @Override
- public void removeServiceMetadata(ServiceMetadataIdentifier metadataIdentifier) {
-
- }
-
- @Override
- public List<String> getExportedURLs(ServiceMetadataIdentifier metadataIdentifier) {
- return null;
- }
-
- @Override
- public void saveSubscribedData(SubscriberMetadataIdentifier subscriberMetadataIdentifier,
- Set<String> urls) {
-
- }
-
- @Override
- public List<String> getSubscribedURLs(SubscriberMetadataIdentifier subscriberMetadataIdentifier) {
- return null;
- }
-
- @Override
- public String getServiceDefinition(MetadataIdentifier consumerMetadataIdentifier) {
- return null;
- }
-
- @Override
- public void storeConsumerMetadata(MetadataIdentifier consumerMetadataIdentifier, Map serviceParameterMap) {
- store.put(consumerMetadataIdentifier.getIdentifierKey(), JSON.toJSONString(serviceParameterMap));
- }
-
- Map<String, String> store = new ConcurrentHashMap<>();
-
-
- };
- }
- };
-
- @Test
- public void testGetOneMetadataReport() {
- URL url = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic");
- MetadataReport metadataReport1 = metadataReportFactory.getMetadataReport(url);
- MetadataReport metadataReport2 = metadataReportFactory.getMetadataReport(url);
- Assertions.assertEquals(metadataReport1, metadataReport2);
- }
-
- @Test
- public void testGetOneMetadataReportForIpFormat() {
- String hostName = NetUtils.getLocalAddress().getHostName();
- String ip = NetUtils.getIpByHost(hostName);
- URL url1 = URL.valueOf("zookeeper://" + hostName + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic");
- URL url2 = URL.valueOf("zookeeper://" + ip + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic");
- MetadataReport metadataReport1 = metadataReportFactory.getMetadataReport(url1);
- MetadataReport metadataReport2 = metadataReportFactory.getMetadataReport(url2);
- Assertions.assertEquals(metadataReport1, metadataReport2);
- }
-
- @Test
- public void testGetForDiffService() {
- URL url1 = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService1?version=1.0.0&application=vic");
- URL url2 = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService2?version=1.0.0&application=vic");
- MetadataReport metadataReport1 = metadataReportFactory.getMetadataReport(url1);
- MetadataReport metadataReport2 = metadataReportFactory.getMetadataReport(url2);
- Assertions.assertEquals(metadataReport1, metadataReport2);
- }
-
- @Test
- public void testGetForDiffGroup() {
- URL url1 = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic&group=aaa");
- URL url2 = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic&group=bbb");
- MetadataReport metadataReport1 = metadataReportFactory.getMetadataReport(url1);
- MetadataReport metadataReport2 = metadataReportFactory.getMetadataReport(url2);
- Assertions.assertNotEquals(metadataReport1, metadataReport2);
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportTest.java
deleted file mode 100644
index 9d4267f..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportTest.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * 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.metadata.report.support;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.utils.NetUtils;
-import org.apache.dubbo.metadata.definition.ServiceDefinitionBuilder;
-import org.apache.dubbo.metadata.definition.model.FullServiceDefinition;
-import org.apache.dubbo.metadata.report.identifier.KeyTypeEnum;
-import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;
-import org.apache.dubbo.metadata.report.identifier.ServiceMetadataIdentifier;
-import org.apache.dubbo.metadata.report.identifier.SubscriberMetadataIdentifier;
-
-import com.google.gson.Gson;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER_SIDE;
-import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER_SIDE;
-
-/**
- *
- */
-public class AbstractMetadataReportTest {
-
- private NewMetadataReport abstractMetadataReport;
-
-
- @BeforeEach
- public void before() {
- URL url = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic");
- abstractMetadataReport = new NewMetadataReport(url);
- }
-
- @Test
- public void testGetProtocol() {
- URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic&side=provider");
- String protocol = abstractMetadataReport.getProtocol(url);
- Assertions.assertEquals(protocol, "provider");
-
- URL url2 = URL.valueOf("consumer://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic");
- String protocol2 = abstractMetadataReport.getProtocol(url2);
- Assertions.assertEquals(protocol2, "consumer");
- }
-
- @Test
- public void testStoreProviderUsual() throws ClassNotFoundException, InterruptedException {
- String interfaceName = "org.apache.dubbo.metadata.store.InterfaceNameTestService";
- String version = "1.0.0";
- String group = null;
- String application = "vic";
- MetadataIdentifier providerMetadataIdentifier = storePrivider(abstractMetadataReport, interfaceName, version, group, application);
- Thread.sleep(1500);
- Assertions.assertNotNull(abstractMetadataReport.store.get(providerMetadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY)));
- }
-
- @Test
- public void testStoreProviderSync() throws ClassNotFoundException, InterruptedException {
- String interfaceName = "org.apache.dubbo.metadata.store.InterfaceNameTestService";
- String version = "1.0.0";
- String group = null;
- String application = "vic";
- abstractMetadataReport.syncReport = true;
- MetadataIdentifier providerMetadataIdentifier = storePrivider(abstractMetadataReport, interfaceName, version, group, application);
- Assertions.assertNotNull(abstractMetadataReport.store.get(providerMetadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY)));
- }
-
- @Test
- public void testFileExistAfterPut() throws InterruptedException, ClassNotFoundException {
- //just for one method
- URL singleUrl = URL.valueOf("redis://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.metadata.store.InterfaceNameTestService?version=1.0.0&application=singleTest");
- NewMetadataReport singleMetadataReport = new NewMetadataReport(singleUrl);
-
- Assertions.assertFalse(singleMetadataReport.file.exists());
-
- String interfaceName = "org.apache.dubbo.metadata.store.InterfaceNameTestService";
- String version = "1.0.0";
- String group = null;
- String application = "vic";
- MetadataIdentifier providerMetadataIdentifier = storePrivider(singleMetadataReport, interfaceName, version, group, application);
-
- Thread.sleep(2000);
- Assertions.assertTrue(singleMetadataReport.file.exists());
- Assertions.assertTrue(singleMetadataReport.properties.containsKey(providerMetadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY)));
- }
-
- @Test
- public void testRetry() throws InterruptedException, ClassNotFoundException {
- String interfaceName = "org.apache.dubbo.metadata.store.RetryTestService";
- String version = "1.0.0.retry";
- String group = null;
- String application = "vic.retry";
- URL storeUrl = URL.valueOf("retryReport://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestServiceForRetry?version=1.0.0.retry&application=vic.retry");
- RetryMetadataReport retryReport = new RetryMetadataReport(storeUrl, 2);
- retryReport.metadataReportRetry.retryPeriod = 400L;
- URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic");
- Assertions.assertNull(retryReport.metadataReportRetry.retryScheduledFuture);
- Assertions.assertEquals(0, retryReport.metadataReportRetry.retryCounter.get());
- Assertions.assertTrue(retryReport.store.isEmpty());
- Assertions.assertTrue(retryReport.failedReports.isEmpty());
-
-
- storePrivider(retryReport, interfaceName, version, group, application);
- Thread.sleep(150);
-
- Assertions.assertTrue(retryReport.store.isEmpty());
- Assertions.assertFalse(retryReport.failedReports.isEmpty());
- Assertions.assertNotNull(retryReport.metadataReportRetry.retryScheduledFuture);
- Thread.sleep(2000L);
- Assertions.assertTrue(retryReport.metadataReportRetry.retryCounter.get() != 0);
- Assertions.assertTrue(retryReport.metadataReportRetry.retryCounter.get() >= 3);
- Assertions.assertFalse(retryReport.store.isEmpty());
- Assertions.assertTrue(retryReport.failedReports.isEmpty());
- }
-
- @Test
- public void testRetryCancel() throws InterruptedException, ClassNotFoundException {
- String interfaceName = "org.apache.dubbo.metadata.store.RetryTestService";
- String version = "1.0.0.retrycancel";
- String group = null;
- String application = "vic.retry";
- URL storeUrl = URL.valueOf("retryReport://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestServiceForRetryCancel?version=1.0.0.retrycancel&application=vic.retry");
- RetryMetadataReport retryReport = new RetryMetadataReport(storeUrl, 2);
- retryReport.metadataReportRetry.retryPeriod = 150L;
- retryReport.metadataReportRetry.retryTimesIfNonFail = 2;
-
- storePrivider(retryReport, interfaceName, version, group, application);
- Thread.sleep(80);
-
- Assertions.assertFalse(retryReport.metadataReportRetry.retryScheduledFuture.isCancelled());
- Assertions.assertFalse(retryReport.metadataReportRetry.retryExecutor.isShutdown());
- Thread.sleep(1000L);
- Assertions.assertTrue(retryReport.metadataReportRetry.retryScheduledFuture.isCancelled());
- Assertions.assertTrue(retryReport.metadataReportRetry.retryExecutor.isShutdown());
-
- }
-
- private MetadataIdentifier storePrivider(AbstractMetadataReport abstractMetadataReport, String interfaceName, String version, String group, String application) throws ClassNotFoundException {
- URL url = URL.valueOf("xxx://" + NetUtils.getLocalAddress().getHostName() + ":4444/" + interfaceName + "?version=" + version + "&application="
- + application + (group == null ? "" : "&group=" + group) + "&testPKey=8989");
-
- MetadataIdentifier providerMetadataIdentifier = new MetadataIdentifier(interfaceName, version, group, PROVIDER_SIDE, application);
- Class interfaceClass = Class.forName(interfaceName);
- FullServiceDefinition fullServiceDefinition = ServiceDefinitionBuilder.buildFullDefinition(interfaceClass, url.getParameters());
-
- abstractMetadataReport.storeProviderMetadata(providerMetadataIdentifier, fullServiceDefinition);
-
- return providerMetadataIdentifier;
- }
-
- private MetadataIdentifier storeConsumer(AbstractMetadataReport abstractMetadataReport, String interfaceName, String version, String group, String application, Map<String, String> tmp) throws ClassNotFoundException {
- URL url = URL.valueOf("xxx://" + NetUtils.getLocalAddress().getHostName() + ":4444/" + interfaceName + "?version=" + version + "&application="
- + application + (group == null ? "" : "&group=" + group) + "&testPKey=9090");
-
- tmp.putAll(url.getParameters());
- MetadataIdentifier consumerMetadataIdentifier = new MetadataIdentifier(interfaceName, version, group, CONSUMER_SIDE, application);
-
- abstractMetadataReport.storeConsumerMetadata(consumerMetadataIdentifier, tmp);
-
- return consumerMetadataIdentifier;
- }
-
- @Test
- public void testPublishAll() throws ClassNotFoundException, InterruptedException {
-
- Assertions.assertTrue(abstractMetadataReport.store.isEmpty());
- Assertions.assertTrue(abstractMetadataReport.allMetadataReports.isEmpty());
- String interfaceName = "org.apache.dubbo.metadata.store.InterfaceNameTestService";
- String version = "1.0.0";
- String group = null;
- String application = "vic";
- MetadataIdentifier providerMetadataIdentifier1 = storePrivider(abstractMetadataReport, interfaceName, version, group, application);
- Thread.sleep(1000);
- Assertions.assertEquals(abstractMetadataReport.allMetadataReports.size(), 1);
- Assertions.assertTrue(((FullServiceDefinition) abstractMetadataReport.allMetadataReports.get(providerMetadataIdentifier1)).getParameters().containsKey("testPKey"));
-
- MetadataIdentifier providerMetadataIdentifier2 = storePrivider(abstractMetadataReport, interfaceName, version + "_2", group + "_2", application);
- Thread.sleep(1000);
- Assertions.assertEquals(abstractMetadataReport.allMetadataReports.size(), 2);
- Assertions.assertTrue(((FullServiceDefinition) abstractMetadataReport.allMetadataReports.get(providerMetadataIdentifier2)).getParameters().containsKey("testPKey"));
- Assertions.assertEquals(((FullServiceDefinition) abstractMetadataReport.allMetadataReports.get(providerMetadataIdentifier2)).getParameters().get("version"), version + "_2");
-
- Map<String, String> tmpMap = new HashMap<>();
- tmpMap.put("testKey", "value");
- MetadataIdentifier consumerMetadataIdentifier = storeConsumer(abstractMetadataReport, interfaceName, version + "_3", group + "_3", application, tmpMap);
- Thread.sleep(1000);
- Assertions.assertEquals(abstractMetadataReport.allMetadataReports.size(), 3);
-
- Map tmpMapResult = (Map) abstractMetadataReport.allMetadataReports.get(consumerMetadataIdentifier);
- Assertions.assertEquals(tmpMapResult.get("testPKey"), "9090");
- Assertions.assertEquals(tmpMapResult.get("testKey"), "value");
- Assertions.assertEquals(3, abstractMetadataReport.store.size());
-
- abstractMetadataReport.store.clear();
-
- Assertions.assertEquals(0, abstractMetadataReport.store.size());
-
- abstractMetadataReport.publishAll();
- Thread.sleep(200);
-
- Assertions.assertEquals(3, abstractMetadataReport.store.size());
-
- String v = abstractMetadataReport.store.get(providerMetadataIdentifier1.getUniqueKey(KeyTypeEnum.UNIQUE_KEY));
- Gson gson = new Gson();
- FullServiceDefinition data = gson.fromJson(v, FullServiceDefinition.class);
- checkParam(data.getParameters(), application, version);
-
- String v2 = abstractMetadataReport.store.get(providerMetadataIdentifier2.getUniqueKey(KeyTypeEnum.UNIQUE_KEY));
- gson = new Gson();
- data = gson.fromJson(v2, FullServiceDefinition.class);
- checkParam(data.getParameters(), application, version + "_2");
-
- String v3 = abstractMetadataReport.store.get(consumerMetadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY));
- gson = new Gson();
- Map v3Map = gson.fromJson(v3, Map.class);
- checkParam(v3Map, application, version + "_3");
- }
-
- @Test
- public void testCalculateStartTime() {
- for (int i = 0; i < 300; i++) {
- long t = abstractMetadataReport.calculateStartTime() + System.currentTimeMillis();
- Calendar c = Calendar.getInstance();
- c.setTimeInMillis(t);
- Assertions.assertTrue(c.get(Calendar.HOUR_OF_DAY) >= 2);
- Assertions.assertTrue(c.get(Calendar.HOUR_OF_DAY) <= 6);
- }
- }
-
- private FullServiceDefinition toServiceDefinition(String v) {
- Gson gson = new Gson();
- FullServiceDefinition data = gson.fromJson(v, FullServiceDefinition.class);
- return data;
- }
-
- private void checkParam(Map<String, String> map, String application, String version) {
- Assertions.assertEquals(map.get("application"), application);
- Assertions.assertEquals(map.get("version"), version);
- }
-
- private Map<String, String> queryUrlToMap(String urlQuery) {
- if (urlQuery == null) {
- return Collections.emptyMap();
- }
- String[] pairs = urlQuery.split("&");
- Map<String, String> map = new HashMap<>();
- for (String pairStr : pairs) {
- String[] pair = pairStr.split("=");
- map.put(pair[0], pair[1]);
- }
- return map;
- }
-
-
- private static class NewMetadataReport extends AbstractMetadataReport {
-
- Map<String, String> store = new ConcurrentHashMap<>();
-
- public NewMetadataReport(URL metadataReportURL) {
- super(metadataReportURL);
- }
-
- @Override
- protected void doStoreProviderMetadata(MetadataIdentifier providerMetadataIdentifier, String serviceDefinitions) {
- store.put(providerMetadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY), serviceDefinitions);
- }
-
- @Override
- protected void doStoreConsumerMetadata(MetadataIdentifier consumerMetadataIdentifier, String serviceParameterString) {
- store.put(consumerMetadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY), serviceParameterString);
- }
-
- @Override
- protected void doSaveMetadata(ServiceMetadataIdentifier metadataIdentifier, URL url) {
- throw new UnsupportedOperationException("This extension does not support working as a remote metadata center.");
- }
-
- @Override
- protected void doRemoveMetadata(ServiceMetadataIdentifier metadataIdentifier) {
- throw new UnsupportedOperationException("This extension does not support working as a remote metadata center.");
- }
-
- @Override
- protected List<String> doGetExportedURLs(ServiceMetadataIdentifier metadataIdentifier) {
- throw new UnsupportedOperationException("This extension does not support working as a remote metadata center.");
- }
-
- @Override
- protected void doSaveSubscriberData(SubscriberMetadataIdentifier subscriberMetadataIdentifier, String urls) {
-
- }
-
- @Override
- protected String doGetSubscribedURLs(SubscriberMetadataIdentifier metadataIdentifier) {
- throw new UnsupportedOperationException("This extension does not support working as a remote metadata center.");
- }
-
- @Override
- public String getServiceDefinition(MetadataIdentifier consumerMetadataIdentifier) {
- throw new UnsupportedOperationException("This extension does not support working as a remote metadata center.");
- }
- }
-
- private static class RetryMetadataReport extends AbstractMetadataReport {
-
- Map<String, String> store = new ConcurrentHashMap<>();
- int needRetryTimes;
- int executeTimes = 0;
-
- public RetryMetadataReport(URL metadataReportURL, int needRetryTimes) {
- super(metadataReportURL);
- this.needRetryTimes = needRetryTimes;
- }
-
- @Override
- protected void doStoreProviderMetadata(MetadataIdentifier providerMetadataIdentifier, String serviceDefinitions) {
- ++executeTimes;
- System.out.println("***" + executeTimes + ";" + System.currentTimeMillis());
- if (executeTimes <= needRetryTimes) {
- throw new RuntimeException("must retry:" + executeTimes);
- }
- store.put(providerMetadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY), serviceDefinitions);
- }
-
- @Override
- protected void doStoreConsumerMetadata(MetadataIdentifier consumerMetadataIdentifier, String serviceParameterString) {
- ++executeTimes;
- if (executeTimes <= needRetryTimes) {
- throw new RuntimeException("must retry:" + executeTimes);
- }
- store.put(consumerMetadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY), serviceParameterString);
- }
-
- @Override
- protected void doSaveMetadata(ServiceMetadataIdentifier metadataIdentifier, URL url) {
- throw new UnsupportedOperationException("This extension does not support working as a remote metadata center.");
- }
-
- @Override
- protected void doRemoveMetadata(ServiceMetadataIdentifier metadataIdentifier) {
- throw new UnsupportedOperationException("This extension does not support working as a remote metadata center.");
- }
-
- @Override
- protected List<String> doGetExportedURLs(ServiceMetadataIdentifier metadataIdentifier) {
- throw new UnsupportedOperationException("This extension does not support working as a remote metadata center.");
- }
-
- @Override
- protected void doSaveSubscriberData(SubscriberMetadataIdentifier subscriberMetadataIdentifier, String urls) {
-
- }
-
- @Override
- protected String doGetSubscribedURLs(SubscriberMetadataIdentifier metadataIdentifier) {
- throw new UnsupportedOperationException("This extension does not support working as a remote metadata center.");
- }
-
- @Override
- public String getServiceDefinition(MetadataIdentifier consumerMetadataIdentifier) {
- throw new UnsupportedOperationException("This extension does not support working as a remote metadata center.");
- }
-
- }
-
-
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/DefaultRestService.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/DefaultRestService.java
deleted file mode 100644
index 210952a..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/DefaultRestService.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.metadata.rest;
-
-import org.apache.dubbo.config.annotation.Service;
-
-import java.util.Map;
-
-/**
- * The default implementation of {@link RestService}
- *
- * @since 2.7.6
- */
-@Service(version = "1.0.0")
-public class DefaultRestService implements RestService {
-
- @Override
- public String param(String param) {
- return null;
- }
-
- @Override
- public String params(int a, String b) {
- return null;
- }
-
- @Override
- public String headers(String header, String header2, Integer param) {
- return null;
- }
-
- @Override
- public String pathVariables(String path1, String path2, String param) {
- return null;
- }
-
- @Override
- public String form(String form) {
- return null;
- }
-
- @Override
- public User requestBodyMap(Map<String, Object> data, String param) {
- return null;
- }
-
- @Override
- public Map<String, Object> requestBodyUser(User user) {
- return null;
- }
-
- public User user(User user) {
- return user;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/RestService.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/RestService.java
deleted file mode 100644
index 65d67ab..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/RestService.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.metadata.rest;
-
-
-import java.util.Map;
-
-/**
- * An interface for REST service
- *
- * @since 2.7.6
- */
-public interface RestService {
-
- String param(String param);
-
- String params(int a, String b);
-
- String headers(String header, String header2, Integer param);
-
- String pathVariables(String path1, String path2, String param);
-
- String form(String form);
-
- User requestBodyMap(Map<String, Object> data, String param);
-
- Map<String, Object> requestBodyUser(User user);
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/SpringRestService.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/SpringRestService.java
deleted file mode 100644
index ead5186..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/SpringRestService.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.metadata.rest;
-
-import org.apache.dubbo.config.annotation.Service;
-
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Spring MVC {@link RestService}
- *
- * @since 2.7.6
- */
-@Service(version = "2.0.0")
-@RestController
-public class SpringRestService implements RestService {
-
- @Override
- @GetMapping(value = "/param")
- public String param(@RequestParam(defaultValue = "value-param") String param) {
- return param;
- }
-
- @Override
- @PostMapping("/params")
- public String params(@RequestParam(defaultValue = "value-a") int a, @RequestParam(defaultValue = "value-b") String b) {
- return a + b;
- }
-
- @Override
- @GetMapping("/headers")
- public String headers(@RequestHeader(name = "h", defaultValue = "value-h") String header,
- @RequestHeader(name = "h2", defaultValue = "value-h2") String header2,
- @RequestParam(value = "v", defaultValue = "1") Integer param) {
- String result = header + " , " + header2 + " , " + param;
- return result;
- }
-
- @Override
- @GetMapping("/path-variables/{p1}/{p2}")
- public String pathVariables(@PathVariable("p1") String path1,
- @PathVariable("p2") String path2, @RequestParam("v") String param) {
- String result = path1 + " , " + path2 + " , " + param;
- return result;
- }
-
- @Override
- @PostMapping("/form")
- public String form(@RequestParam("f") String form) {
- return String.valueOf(form);
- }
-
- @Override
- @PostMapping(value = "/request/body/map", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
- public User requestBodyMap(@RequestBody Map<String, Object> data,
- @RequestParam("param") String param) {
- User user = new User();
- user.setId(((Integer) data.get("id")).longValue());
- user.setName((String) data.get("name"));
- user.setAge((Integer) data.get("age"));
- return user;
- }
-
- @PostMapping(value = "/request/body/user", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
- @Override
- public Map<String, Object> requestBodyUser(@RequestBody User user) {
- Map<String, Object> map = new HashMap<>();
- map.put("id", user.getId());
- map.put("name", user.getName());
- map.put("age", user.getAge());
- return map;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/StandardRestService.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/StandardRestService.java
deleted file mode 100644
index f5d94b7..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/StandardRestService.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.metadata.rest;
-
-import org.apache.dubbo.config.annotation.Service;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- * JAX-RS {@link RestService}
- */
-@Service(version = "3.0.0", protocol = {"dubbo", "rest"}, group = "standard")
-@Path("/")
-public class StandardRestService implements RestService {
-
- @Override
- @Path("param")
- @GET
- public String param(@QueryParam("param") String param) {
- return param;
- }
-
- @Override
- @Path("params")
- @POST
- public String params(@QueryParam("a") int a, @QueryParam("b") String b) {
- return a + b;
- }
-
- @Override
- @Path("headers")
- @GET
- public String headers(@HeaderParam("h") String header,
- @HeaderParam("h2") String header2, @QueryParam("v") Integer param) {
- String result = header + " , " + header2 + " , " + param;
- return result;
- }
-
- @Override
- @Path("path-variables/{p1}/{p2}")
- @GET
- public String pathVariables(@PathParam("p1") String path1,
- @PathParam("p2") String path2, @QueryParam("v") String param) {
- String result = path1 + " , " + path2 + " , " + param;
- return result;
- }
-
- // @CookieParam does not support : https://github.com/OpenFeign/feign/issues/913
- // @CookieValue also does not support
-
- @Override
- @Path("form")
- @POST
- public String form(@FormParam("f") String form) {
- return String.valueOf(form);
- }
-
- @Override
- @Path("request/body/map")
- @POST
- @Produces("application/json;charset=UTF-8")
- public User requestBodyMap(Map<String, Object> data,
- @QueryParam("param") String param) {
- User user = new User();
- user.setId(((Integer) data.get("id")).longValue());
- user.setName((String) data.get("name"));
- user.setAge((Integer) data.get("age"));
- return user;
- }
-
- @Path("request/body/user")
- @POST
- @Override
- @Consumes("application/json;charset=UTF-8")
- public Map<String, Object> requestBodyUser(User user) {
- Map<String, Object> map = new HashMap<>();
- map.put("id", user.getId());
- map.put("name", user.getName());
- map.put("age", user.getAge());
- return map;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/User.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/User.java
deleted file mode 100644
index 2b6c4a2..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/User.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.metadata.rest;
-
-import java.io.Serializable;
-
-/**
- * User Entity
- *
- * @since 2.7.6
- */
-public class User implements Serializable {
-
- private Long id;
-
- private String name;
-
- private Integer age;
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Integer getAge() {
- return age;
- }
-
- public void setAge(Integer age) {
- this.age = age;
- }
-
- @Override
- public String toString() {
- return "User{" + "id=" + id + ", name='" + name + '\'' + ", age=" + age + '}';
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/resolver/jaxrs/JAXRSServiceRestMetadataResolverTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/resolver/jaxrs/JAXRSServiceRestMetadataResolverTest.java
deleted file mode 100644
index d959007..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/rest/resolver/jaxrs/JAXRSServiceRestMetadataResolverTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.metadata.rest.resolver.jaxrs;
-
-import org.apache.dubbo.metadata.rest.ClassPathServiceRestMetadataReader;
-import org.apache.dubbo.metadata.rest.DefaultRestService;
-import org.apache.dubbo.metadata.rest.RestMethodMetadata;
-import org.apache.dubbo.metadata.rest.RestService;
-import org.apache.dubbo.metadata.rest.ServiceRestMetadata;
-import org.apache.dubbo.metadata.rest.SpringRestService;
-import org.apache.dubbo.metadata.rest.StandardRestService;
-import org.apache.dubbo.metadata.rest.jaxrs.JAXRSServiceRestMetadataResolver;
-
-import org.junit.jupiter.api.Test;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * {@link JAXRSServiceRestMetadataResolver} Test
- *
- * @since 2.7.6
- */
-public class JAXRSServiceRestMetadataResolverTest {
-
- private JAXRSServiceRestMetadataResolver instance = new JAXRSServiceRestMetadataResolver();
-
- @Test
- public void testSupports() {
- // JAX-RS RestService class
- assertTrue(instance.supports(StandardRestService.class));
- // Spring MVC RestService class
- assertFalse(instance.supports(SpringRestService.class));
- // Default RestService class
- assertFalse(instance.supports(DefaultRestService.class));
- // No annotated RestService class
- assertFalse(instance.supports(RestService.class));
- // null
- assertFalse(instance.supports(null));
- }
-
- @Test
- public void testResolve() {
- // Generated by "dubbo-metadata-processor"
- ClassPathServiceRestMetadataReader reader = new ClassPathServiceRestMetadataReader("META-INF/dubbo/jax-rs-service-rest-metadata.json");
- List<ServiceRestMetadata> serviceRestMetadataList = reader.read();
-
- ServiceRestMetadata expectedServiceRestMetadata = serviceRestMetadataList.get(0);
- ServiceRestMetadata serviceRestMetadata = instance.resolve(StandardRestService.class);
-
-
- List<RestMethodMetadata> meta1 = new LinkedList<>(expectedServiceRestMetadata.getMeta());
- List<RestMethodMetadata> meta2 = new LinkedList<>(serviceRestMetadata.getMeta());
-
- for (int i = 0; i < meta1.size(); i++) {
- RestMethodMetadata restMethodMetadata = meta1.get(i);
- RestMethodMetadata restMethodMetadata2 = meta2.get(i);
- assertEquals(restMethodMetadata, restMethodMetadata2);
- }
-
- assertEquals(expectedServiceRestMetadata, serviceRestMetadata);
-
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/InMemoryWritableMetadataServiceTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/InMemoryWritableMetadataServiceTest.java
deleted file mode 100644
index 1995644..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/InMemoryWritableMetadataServiceTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * 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.metadata.store;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.utils.NetUtils;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-/**
- * 2019-08-29
- */
-public class InMemoryWritableMetadataServiceTest {
-
- String interfaceName = "org.apache.dubbo.metadata.store.InterfaceNameTestService2", version = "0.9.9", group = null;
- URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/?interface=" + interfaceName + "&version="
- + version + "&application=vicpubprovder&side=provider");
-
- @BeforeEach
- public void before() {
- }
-
- @Test
- public void testPublishServiceDefinition() {
- InMemoryWritableMetadataService inMemoryWritableMetadataService = new InMemoryWritableMetadataService();
- inMemoryWritableMetadataService.publishServiceDefinition(url);
-
- String v = inMemoryWritableMetadataService.getServiceDefinition(interfaceName, version, group);
- Assertions.assertNotNull(v);
- }
-
- @Test
- public void testExportURL() {
- InMemoryWritableMetadataService inMemoryWritableMetadataService = new InMemoryWritableMetadataService();
- URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.Test567Service?version=1.0.44&application=vicpubprovder&side=provider");
- inMemoryWritableMetadataService.exportURL(url);
-
- Assertions.assertTrue(inMemoryWritableMetadataService.exportedServiceURLs.size() == 1);
- Assertions.assertEquals(inMemoryWritableMetadataService.exportedServiceURLs.get(url.getServiceKey()).first(), url);
- }
-
- @Test
- public void testSubscribeURL() {
- InMemoryWritableMetadataService inMemoryWritableMetadataService = new InMemoryWritableMetadataService();
- URL url = URL.valueOf("subscriber://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.Test678Service?version=1.0.44&application=vicpubprovder&side=provider");
- inMemoryWritableMetadataService.subscribeURL(url);
-
- Assertions.assertTrue(inMemoryWritableMetadataService.subscribedServiceURLs.size() == 1);
- Assertions.assertEquals(inMemoryWritableMetadataService.subscribedServiceURLs.get(url.getServiceKey()).first(), url);
- }
-
- @Test
- public void testUnExportURL() {
- InMemoryWritableMetadataService inMemoryWritableMetadataService = new InMemoryWritableMetadataService();
- URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.Test567Service?version=1.0.44&application=vicpubprovder&side=provider");
- inMemoryWritableMetadataService.exportURL(url);
-
- Assertions.assertTrue(inMemoryWritableMetadataService.exportedServiceURLs.size() == 1);
- Assertions.assertEquals(inMemoryWritableMetadataService.exportedServiceURLs.get(url.getServiceKey()).first(), url);
-
- inMemoryWritableMetadataService.unexportURL(url);
- Assertions.assertTrue(inMemoryWritableMetadataService.exportedServiceURLs.size() == 0);
- }
-
- @Test
- public void testUnSubscribeURL() {
- InMemoryWritableMetadataService inMemoryWritableMetadataService = new InMemoryWritableMetadataService();
- URL url = URL.valueOf("subscriber://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.Test678Service?version=1.0.44&application=vicpubprovder&side=provider");
- inMemoryWritableMetadataService.subscribeURL(url);
-
- Assertions.assertTrue(inMemoryWritableMetadataService.subscribedServiceURLs.size() == 1);
- Assertions.assertEquals(inMemoryWritableMetadataService.subscribedServiceURLs.get(url.getServiceKey()).first(), url);
-
- inMemoryWritableMetadataService.unsubscribeURL(url);
- Assertions.assertTrue(inMemoryWritableMetadataService.subscribedServiceURLs.size() == 0);
- }
-
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/InterfaceNameTestService.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/InterfaceNameTestService.java
deleted file mode 100644
index e45fc38..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/InterfaceNameTestService.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.metadata.store;
-
-/**
- * 2018/9/19
- */
-public interface InterfaceNameTestService {
-
- public void test();
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/InterfaceNameTestService2.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/InterfaceNameTestService2.java
deleted file mode 100644
index 234e37f..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/InterfaceNameTestService2.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.metadata.store;
-
-/**
- * 2018/9/19
- */
-public interface InterfaceNameTestService2 {
-
- void test2();
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/RemoteWritableMeatadataServiceTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/RemoteWritableMeatadataServiceTest.java
deleted file mode 100644
index bdd748c..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/RemoteWritableMeatadataServiceTest.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * 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.metadata.store;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.utils.NetUtils;
-import org.apache.dubbo.metadata.definition.model.FullServiceDefinition;
-import org.apache.dubbo.metadata.report.MetadataReportInstance;
-import org.apache.dubbo.metadata.report.identifier.KeyTypeEnum;
-import org.apache.dubbo.metadata.report.identifier.ServiceMetadataIdentifier;
-import org.apache.dubbo.metadata.report.identifier.SubscriberMetadataIdentifier;
-import org.apache.dubbo.metadata.test.JTestMetadataReport4Test;
-import org.apache.dubbo.rpc.model.ApplicationModel;
-
-import com.google.gson.Gson;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.util.Map;
-
-/**
- * 2018/9/14
- */
-public class RemoteWritableMeatadataServiceTest {
- URL url = URL.valueOf("JTest://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic");
- RemoteWritableMetadataService metadataReportService1;
- InMemoryWritableMetadataService inMemoryWritableMetadataService;
-
- @BeforeEach
- public void before() {
- inMemoryWritableMetadataService = new InMemoryWritableMetadataService();
- metadataReportService1 = new RemoteWritableMetadataService(inMemoryWritableMetadataService);
- MetadataReportInstance.init(url);
- }
-
- @Test
- public void testPublishProviderNoInterfaceName() {
- URL publishUrl = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vicpubprovder&side=provider");
- metadataReportService1.publishServiceDefinition(publishUrl);
-
- Assertions.assertTrue(metadataReportService1.getMetadataReport() instanceof JTestMetadataReport4Test);
-
- JTestMetadataReport4Test jTestMetadataReport4Test = (JTestMetadataReport4Test) metadataReportService1.getMetadataReport();
- Assertions.assertTrue(!jTestMetadataReport4Test.store.containsKey(JTestMetadataReport4Test.getProviderKey(publishUrl)));
-
- }
-
- @Test
- public void testPublishProviderWrongInterface() {
-
- URL publishUrl = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vicpu&interface=ccc&side=provider");
- metadataReportService1.publishServiceDefinition(publishUrl);
-
- Assertions.assertTrue(metadataReportService1.getMetadataReport() instanceof JTestMetadataReport4Test);
-
- JTestMetadataReport4Test jTestMetadataReport4Test = (JTestMetadataReport4Test) metadataReportService1.getMetadataReport();
- Assertions.assertTrue(!jTestMetadataReport4Test.store.containsKey(JTestMetadataReport4Test.getProviderKey(publishUrl)));
-
- }
-
- @Test
- public void testPublishProviderContainInterface() throws InterruptedException {
-
- URL publishUrl = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.3&application=vicpubp&interface=org.apache.dubbo.metadata.store.InterfaceNameTestService&side=provider");
- metadataReportService1.publishServiceDefinition(publishUrl);
- Thread.sleep(300);
-
- Assertions.assertTrue(metadataReportService1.getMetadataReport() instanceof JTestMetadataReport4Test);
-
- JTestMetadataReport4Test jTestMetadataReport4Test = (JTestMetadataReport4Test) metadataReportService1.getMetadataReport();
- Assertions.assertTrue(jTestMetadataReport4Test.store.containsKey(JTestMetadataReport4Test.getProviderKey(publishUrl)));
-
- String value = jTestMetadataReport4Test.store.get(JTestMetadataReport4Test.getProviderKey(publishUrl));
- FullServiceDefinition fullServiceDefinition = toServiceDefinition(value);
- Map<String, String> map = fullServiceDefinition.getParameters();
- Assertions.assertEquals(map.get("application"), "vicpubp");
- Assertions.assertEquals(map.get("version"), "1.0.3");
- Assertions.assertEquals(map.get("interface"), "org.apache.dubbo.metadata.store.InterfaceNameTestService");
- }
-
- @Test
- public void testPublishConsumer() throws InterruptedException {
-
- URL publishUrl = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.x&application=vicpubconsumer&side=consumer");
- metadataReportService1.publishServiceDefinition(publishUrl);
- Thread.sleep(300);
-
- Assertions.assertTrue(metadataReportService1.getMetadataReport() instanceof JTestMetadataReport4Test);
-
- JTestMetadataReport4Test jTestMetadataReport4Test = (JTestMetadataReport4Test) metadataReportService1.getMetadataReport();
- Assertions.assertTrue(jTestMetadataReport4Test.store.containsKey(JTestMetadataReport4Test.getConsumerKey(publishUrl)));
-
- String value = jTestMetadataReport4Test.store.get(JTestMetadataReport4Test.getConsumerKey(publishUrl));
- Gson gson = new Gson();
- Map<String, String> map = gson.fromJson(value, Map.class);
- Assertions.assertEquals(map.get("application"), "vicpubconsumer");
- Assertions.assertEquals(map.get("version"), "1.0.x");
-
- }
-
- @Test
- public void testPublishServiceDefinition() {
- URL publishUrl = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vicpubprovder&side=provider");
- metadataReportService1.publishServiceDefinition(publishUrl);
-
- Assertions.assertTrue(metadataReportService1.getMetadataReport() instanceof JTestMetadataReport4Test);
-
- JTestMetadataReport4Test jTestMetadataReport4Test = (JTestMetadataReport4Test) metadataReportService1.getMetadataReport();
- Assertions.assertTrue(!jTestMetadataReport4Test.store.containsKey(JTestMetadataReport4Test.getProviderKey(publishUrl)));
-
- }
-
- @Test
- public void testUnexportURL() {
-
- }
-
- @Test
- public void testRefreshMetadataService() throws InterruptedException {
- URL publishUrl = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestRefreshMetadataService?version=1.0.8&application=vicpubprovder&side=provider");
- URL publishUrl2 = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestRefreshMetadata2Service?version=1.0.5&application=vicpubprovder&side=provider");
- inMemoryWritableMetadataService.exportURL(publishUrl);
- inMemoryWritableMetadataService.exportURL(publishUrl2);
- String exportedRevision = "9999";
- JTestMetadataReport4Test jTestMetadataReport4Test = (JTestMetadataReport4Test) metadataReportService1.getMetadataReport();
- int origSize = jTestMetadataReport4Test.store.size();
- Assertions.assertTrue(metadataReportService1.refreshMetadata(exportedRevision, "1109"));
- Thread.sleep(200);
- int size = jTestMetadataReport4Test.store.size();
- Assertions.assertTrue(size - origSize == 2);
- Assertions.assertEquals(jTestMetadataReport4Test.store.get(getServiceMetadataIdentifier(publishUrl, exportedRevision).getUniqueKey(KeyTypeEnum.UNIQUE_KEY)), publishUrl.toFullString());
- Assertions.assertEquals(jTestMetadataReport4Test.store.get(getServiceMetadataIdentifier(publishUrl2, exportedRevision).getUniqueKey(KeyTypeEnum.UNIQUE_KEY)), publishUrl2.toFullString());
- }
-
- @Test
- public void testRefreshMetadataSubscription() throws InterruptedException {
- URL subscriberUrl1 = URL.valueOf("subscriber://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestRefreshMetadata00Service?version=1.0.8&application=vicpubprovder&side=provider");
- URL subscriberUrl2 = URL.valueOf("subscriber://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestRefreshMetadata09Service?version=1.0.5&application=vicpubprovder&side=provider");
- inMemoryWritableMetadataService.subscribeURL(subscriberUrl1);
- inMemoryWritableMetadataService.subscribeURL(subscriberUrl2);
- String exportedRevision = "9999";
- String subscriberRevision = "2099";
- String applicationName = "wriableMetadataService";
- JTestMetadataReport4Test jTestMetadataReport4Test = (JTestMetadataReport4Test) metadataReportService1.getMetadataReport();
- int origSize = jTestMetadataReport4Test.store.size();
- ApplicationModel.setApplication(applicationName);
- Assertions.assertTrue(metadataReportService1.refreshMetadata(exportedRevision, subscriberRevision));
- Thread.sleep(200);
- int size = jTestMetadataReport4Test.store.size();
- Assertions.assertTrue(size - origSize == 1);
- String r = jTestMetadataReport4Test.store.get(getSubscriberMetadataIdentifier(
- subscriberRevision).getUniqueKey(KeyTypeEnum.UNIQUE_KEY));
- Assertions.assertNotNull(r);
- }
-
- private ServiceMetadataIdentifier getServiceMetadataIdentifier(URL publishUrl, String exportedRevision) {
- ServiceMetadataIdentifier serviceMetadataIdentifier = new ServiceMetadataIdentifier(publishUrl);
- serviceMetadataIdentifier.setRevision(exportedRevision);
- serviceMetadataIdentifier.setProtocol(publishUrl.getProtocol());
- return serviceMetadataIdentifier;
- }
-
- private SubscriberMetadataIdentifier getSubscriberMetadataIdentifier(String subscriberRevision) {
- SubscriberMetadataIdentifier subscriberMetadataIdentifier = new SubscriberMetadataIdentifier();
- subscriberMetadataIdentifier.setRevision(subscriberRevision);
- subscriberMetadataIdentifier.setApplication(ApplicationModel.getApplication());
- return subscriberMetadataIdentifier;
- }
-
- private FullServiceDefinition toServiceDefinition(String urlQuery) {
- Gson gson = new Gson();
- return gson.fromJson(urlQuery, FullServiceDefinition.class);
- }
-
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/RemoteWritableMetadataServiceDelegateTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/RemoteWritableMetadataServiceDelegateTest.java
deleted file mode 100644
index 8db9534..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/RemoteWritableMetadataServiceDelegateTest.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * 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.metadata.store;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.utils.NetUtils;
-import org.apache.dubbo.metadata.WritableMetadataService;
-import org.apache.dubbo.metadata.report.MetadataReportInstance;
-import org.apache.dubbo.metadata.report.identifier.KeyTypeEnum;
-import org.apache.dubbo.metadata.report.identifier.ServiceMetadataIdentifier;
-import org.apache.dubbo.metadata.report.identifier.SubscriberMetadataIdentifier;
-import org.apache.dubbo.metadata.test.JTestMetadataReport4Test;
-import org.apache.dubbo.rpc.model.ApplicationModel;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.util.SortedSet;
-
-
-/**
- * 2019-08-27
- */
-public class RemoteWritableMetadataServiceDelegateTest {
- static URL metadataURL = URL.valueOf("JTest://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.Tes33tService?version=1.0.0&application=vic");
-
- RemoteWritableMetadataServiceDelegate metadataReportService;
-
- String interfaceName = "org.apache.dubbo.metadata.store.InterfaceNameTestService80", version = "0.6.9", group = null;
- URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/?interface=" + interfaceName + "&version="
- + version + "&application=vicpubprovder&side=provider");
-
- @BeforeAll
- public static void beforeAll() {
- MetadataReportInstance.init(metadataURL);
- }
-
- @BeforeEach
- public void before() {
- metadataReportService = new RemoteWritableMetadataServiceDelegate();
- }
-
-
- @Test
- public void testInstance() {
- WritableMetadataService metadataReportService1 = WritableMetadataService.getExtension("remote");
- WritableMetadataService metadataReportService2 = WritableMetadataService.getExtension("remote");
- Assertions.assertSame(metadataReportService1, metadataReportService2);
- Assertions.assertTrue(metadataReportService1 instanceof RemoteWritableMetadataServiceDelegate);
- }
-
- @Test
- public void testPublishServiceDefinition() throws InterruptedException {
- String interfaceName = "org.apache.dubbo.metadata.store.InterfaceNameTestService2", version = "0.9.9", group = null;
- URL tmpUrl = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/?interface=" + interfaceName + "&version="
- + version + "&application=vicpubprovder&side=provider");
- metadataReportService.publishServiceDefinition(tmpUrl);
- Thread.sleep(150);
- String v = metadataReportService.getServiceDefinition(interfaceName, version, group);
- Assertions.assertNotNull(v);
- }
-
- @Test
- public void testExportURL() throws InterruptedException {
- URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.Test567Service?version=1.0.44&application=vicpubprovder&side=provider");
- metadataReportService.exportURL(url);
- Thread.sleep(100);
- Assertions.assertTrue(getInMemoryWriableMetadataService().exportedServiceURLs.size() == 1);
- Assertions.assertEquals(getInMemoryWriableMetadataService().exportedServiceURLs.get(url.getServiceKey()).first(), url);
- }
-
- @Test
- public void testSubscribeURL() throws InterruptedException {
- URL url = URL.valueOf("subscriber://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.Test0678Service?version=1.3.144&application=vicpubprovder&side=provider");
- int origSize = getInMemoryWriableMetadataService().subscribedServiceURLs.size();
- metadataReportService.subscribeURL(url);
- Thread.sleep(100);
- int size = getInMemoryWriableMetadataService().subscribedServiceURLs.size();
- Assertions.assertTrue(size - origSize == 1);
- Assertions.assertEquals(getInMemoryWriableMetadataService().subscribedServiceURLs.get(url.getServiceKey()).first(), url);
- }
-
- @Test
- public void testUnExportURL() throws InterruptedException {
- URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.Test0567Service?version=1.2.44&application=vicpubprovder&side=provider");
- int origSize = getInMemoryWriableMetadataService().exportedServiceURLs.size();
- metadataReportService.exportURL(url);
- Thread.sleep(100);
- int size = getInMemoryWriableMetadataService().exportedServiceURLs.size();
- Assertions.assertTrue(size - origSize == 1);
- Assertions.assertEquals(getInMemoryWriableMetadataService().exportedServiceURLs.get(url.getServiceKey()).first(), url);
-
- metadataReportService.unexportURL(url);
- int unexportSize = getInMemoryWriableMetadataService().exportedServiceURLs.size();
- Assertions.assertTrue(size - unexportSize == 1);
- }
-
- @Test
- public void testUnSubscribeURL() throws InterruptedException {
- URL url = URL.valueOf("subscriber://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.Test0678Service?version=1.5.477&application=vicpubprovder&side=provider");
- int origSize = getInMemoryWriableMetadataService().subscribedServiceURLs.size();
- metadataReportService.subscribeURL(url);
- Thread.sleep(100);
- int size = getInMemoryWriableMetadataService().subscribedServiceURLs.size();
- Assertions.assertTrue(size - origSize == 1);
- Assertions.assertEquals(getInMemoryWriableMetadataService().subscribedServiceURLs.get(url.getServiceKey()).first(), url);
-
- metadataReportService.unsubscribeURL(url);
- Thread.sleep(100);
- Assertions.assertTrue(getInMemoryWriableMetadataService().subscribedServiceURLs.size() == 0);
- }
-
- @Test
- public void testRefreshMetadataService() throws InterruptedException {
- URL publishUrl = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestRefreshMetadataService?version=1.6.8&application=vicpubprovder&side=provider");
- URL publishUrl2 = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestRefreshMetadata2Service?version=1.6.5&application=vicpubprovder&side=provider");
- metadataReportService.exportURL(publishUrl);
- metadataReportService.exportURL(publishUrl2);
- String exportedRevision = "9999";
- JTestMetadataReport4Test jTestMetadataReport4Test = (JTestMetadataReport4Test) MetadataReportInstance.getMetadataReport(true);
- int origSize = jTestMetadataReport4Test.store.size();
- int num = countNum();
- Assertions.assertTrue(metadataReportService.refreshMetadata(exportedRevision, "1109"));
- Thread.sleep(200);
- int size = jTestMetadataReport4Test.store.size();
- Assertions.assertTrue(size - origSize == num);
- Assertions.assertEquals(jTestMetadataReport4Test.store.get(getServiceMetadataIdentifier(publishUrl, exportedRevision).getUniqueKey(KeyTypeEnum.UNIQUE_KEY)), publishUrl.toFullString());
- Assertions.assertEquals(jTestMetadataReport4Test.store.get(getServiceMetadataIdentifier(publishUrl2, exportedRevision).getUniqueKey(KeyTypeEnum.UNIQUE_KEY)), publishUrl2.toFullString());
- }
-
-
- // unstable test
-// @Test
-// public void testRefreshMetadataSubscription() throws InterruptedException {
-// URL subscriberUrl1 = URL.valueOf("subscriber://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestRefreshMetadata00Service?version=2.0.8&application=vicpubprovder&side=provider");
-// URL subscriberUrl2 = URL.valueOf("subscriber://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestRefreshMetadata09Service?version=2.0.5&application=vicpubprovder&side=provider");
-// metadataReportService.subscribeURL(subscriberUrl1);
-// metadataReportService.subscribeURL(subscriberUrl2);
-// String exportedRevision = "9999";
-// String subscriberRevision = "2099";
-// String applicationName = "wriableMetadataService";
-// JTestMetadataReport4Test jTestMetadataReport4Test = (JTestMetadataReport4Test) MetadataReportInstance.getMetadataReport(true);
-// int origSize = jTestMetadataReport4Test.store.size();
-// ApplicationModel.setApplication(applicationName);
-// Assertions.assertTrue(metadataReportService.refreshMetadata(exportedRevision, subscriberRevision));
-// Thread.sleep(200);
-// int size = jTestMetadataReport4Test.store.size();
-// Assertions.assertTrue(size - origSize == 1);
-// String r = jTestMetadataReport4Test.store.get(getSubscriberMetadataIdentifier(
-// subscriberRevision).getUniqueKey(KeyTypeEnum.UNIQUE_KEY));
-// Assertions.assertNotNull(r);
-// }
-
-
- private ServiceMetadataIdentifier getServiceMetadataIdentifier(URL publishUrl, String exportedRevision) {
- ServiceMetadataIdentifier serviceMetadataIdentifier = new ServiceMetadataIdentifier(publishUrl);
- serviceMetadataIdentifier.setRevision(exportedRevision);
- serviceMetadataIdentifier.setProtocol(publishUrl.getProtocol());
- return serviceMetadataIdentifier;
- }
-
- private SubscriberMetadataIdentifier getSubscriberMetadataIdentifier(String subscriberRevision) {
- SubscriberMetadataIdentifier subscriberMetadataIdentifier = new SubscriberMetadataIdentifier();
- subscriberMetadataIdentifier.setRevision(subscriberRevision);
- subscriberMetadataIdentifier.setApplication(ApplicationModel.getApplication());
- return subscriberMetadataIdentifier;
- }
-
- private InMemoryWritableMetadataService getInMemoryWriableMetadataService() {
- return (InMemoryWritableMetadataService) metadataReportService.defaultWritableMetadataService;
- }
-
- private int countNum() {
- int num = 0;
- for (SortedSet<URL> tmp : getInMemoryWriableMetadataService().exportedServiceURLs.values()) {
- num += tmp.size();
- }
- if (!getInMemoryWriableMetadataService().subscribedServiceURLs.values().isEmpty()) {
- num++;
- }
- return num;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/RetryTestService.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/RetryTestService.java
deleted file mode 100644
index 9133d25..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/store/RetryTestService.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.metadata.store;
-
-/**
- * 2018/10/26
- */
-public interface RetryTestService {
-
- void sayHello(String input);
-
- String getName();
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/test/JTestMetadataReport4Test.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/test/JTestMetadataReport4Test.java
deleted file mode 100644
index 34ebce3..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/test/JTestMetadataReport4Test.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.metadata.test;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.common.logger.Logger;
-import org.apache.dubbo.common.logger.LoggerFactory;
-import org.apache.dubbo.metadata.report.identifier.KeyTypeEnum;
-import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;
-import org.apache.dubbo.metadata.report.identifier.ServiceMetadataIdentifier;
-import org.apache.dubbo.metadata.report.identifier.SubscriberMetadataIdentifier;
-import org.apache.dubbo.metadata.report.support.AbstractMetadataReport;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY;
-
-/**
- * ZookeeperRegistry
- */
-public class JTestMetadataReport4Test extends AbstractMetadataReport {
-
- private final static Logger logger = LoggerFactory.getLogger(JTestMetadataReport4Test.class);
-
-
- public JTestMetadataReport4Test(URL url) {
- super(url);
- }
-
- public volatile Map<String, String> store = new ConcurrentHashMap<>();
-
-
- private static String getProtocol(URL url) {
- String protocol = url.getParameter(SIDE_KEY);
- protocol = protocol == null ? url.getProtocol() : protocol;
- return protocol;
- }
-
- @Override
- protected void doStoreProviderMetadata(MetadataIdentifier providerMetadataIdentifier, String serviceDefinitions) {
- store.put(providerMetadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY), serviceDefinitions);
- }
-
- @Override
- protected void doStoreConsumerMetadata(MetadataIdentifier consumerMetadataIdentifier, String serviceParameterString) {
- store.put(consumerMetadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY), serviceParameterString);
- }
-
- @Override
- protected void doSaveMetadata(ServiceMetadataIdentifier metadataIdentifier, URL url) {
- store.put(metadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY), url.toFullString());
- }
-
- @Override
- protected void doRemoveMetadata(ServiceMetadataIdentifier metadataIdentifier) {
- store.remove(metadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY));
- }
-
- @Override
- protected List<String> doGetExportedURLs(ServiceMetadataIdentifier metadataIdentifier) {
- return Arrays.asList(store.getOrDefault(metadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY), ""));
- }
-
- @Override
- protected void doSaveSubscriberData(SubscriberMetadataIdentifier subscriberMetadataIdentifier, String urls) {
- store.put(subscriberMetadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY), urls);
- }
-
- @Override
- protected String doGetSubscribedURLs(SubscriberMetadataIdentifier metadataIdentifier) {
- throw new UnsupportedOperationException("This extension does not support working as a remote metadata center.");
- }
-
- public static String getProviderKey(URL url) {
- return new MetadataIdentifier(url).getUniqueKey(KeyTypeEnum.UNIQUE_KEY);
- }
-
- public static String getConsumerKey(URL url) {
- return new MetadataIdentifier(url).getUniqueKey(KeyTypeEnum.UNIQUE_KEY);
- }
-
- @Override
- public String getServiceDefinition(MetadataIdentifier consumerMetadataIdentifier) {
- return store.get(consumerMetadataIdentifier.getUniqueKey(KeyTypeEnum.UNIQUE_KEY));
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/test/JTestMetadataReportFactory4Test.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/test/JTestMetadataReportFactory4Test.java
deleted file mode 100644
index 6e26408..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/test/JTestMetadataReportFactory4Test.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.metadata.test;
-
-import org.apache.dubbo.common.URL;
-import org.apache.dubbo.metadata.report.MetadataReport;
-import org.apache.dubbo.metadata.report.support.AbstractMetadataReportFactory;
-
-/**
- * ZookeeperRegistryFactory.
- */
-public class JTestMetadataReportFactory4Test extends AbstractMetadataReportFactory {
-
- @Override
- public MetadataReport createMetadataReport(URL url) {
- return new JTestMetadataReport4Test(url);
- }
-
-}
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.metadata.definition.builder.TypeBuilder b/dubbo-metadata/dubbo-metadata-api/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.metadata.definition.builder.TypeBuilder
deleted file mode 100644
index 1b1b7d2..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.metadata.definition.builder.TypeBuilder
+++ /dev/null
@@ -1,2 +0,0 @@
-test=org.apache.dubbo.metadata.definition.TestTypeBuilder
-test3=org.apache.dubbo.metadata.definition.Test3TypeBuilder
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.metadata.report.MetadataReportFactory b/dubbo-metadata/dubbo-metadata-api/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.metadata.report.MetadataReportFactory
deleted file mode 100644
index 2354eff..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/resources/META-INF/dubbo/internal/org.apache.dubbo.metadata.report.MetadataReportFactory
+++ /dev/null
@@ -1 +0,0 @@
-JTest=org.apache.dubbo.metadata.test.JTestMetadataReportFactory4Test
\ No newline at end of file
diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/resources/META-INF/dubbo/jax-rs-service-rest-metadata.json b/dubbo-metadata/dubbo-metadata-api/src/test/resources/META-INF/dubbo/jax-rs-service-rest-metadata.json
deleted file mode 100644
index 3830369..0000000
--- a/dubbo-metadata/dubbo-metadata-api/src/test/resources/META-INF/dubbo/jax-rs-service-rest-metadata.json
+++ /dev/null
@@ -1,349 +0,0 @@
-[
- {
- "serviceInterface": "org.apache.dubbo.metadata.rest.RestService",
- "version": "3.0.0",
- "group": "standard",
- "meta": [
- {
- "method": {
- "name": "form",
- "parameterTypes": [
- "java.lang.String"
- ],
- "returnType": "java.lang.String",
- "parameters": [
- {
- "type": "java.lang.String",
- "items": [],
- "enum": [],
- "properties": {}
- }
- ]
- },
- "request": {
- "method": "POST",
- "path": "/form",
- "params": {
- "f": [
- "{0}"
- ]
- },
- "headers": {},
- "consumes": [],
- "produces": []
- },
- "indexToName": {
- "0": [
- "form"
- ]
- }
- },
- {
- "method": {
- "name": "headers",
- "parameterTypes": [
- "java.lang.String",
- "java.lang.String",
- "java.lang.Integer"
- ],
- "returnType": "java.lang.String",
- "parameters": [
- {
- "type": "java.lang.String",
- "items": [],
- "enum": [],
- "properties": {}
- },
- {
- "type": "java.lang.String",
- "items": [],
- "enum": [],
- "properties": {}
- },
- {
- "type": "java.lang.Integer",
- "items": [],
- "enum": [],
- "properties": {}
- }
- ]
- },
- "request": {
- "method": "GET",
- "path": "/headers",
- "params": {
- "v": [
- "{2}"
- ]
- },
- "headers": {
- "h": [
- "{0}"
- ],
- "h2": [
- "{1}"
- ]
- },
- "consumes": [],
- "produces": []
- },
- "indexToName": {
- "0": [
- "header"
- ],
- "1": [
- "header2"
- ],
- "2": [
- "param"
- ]
- }
- },
- {
- "method": {
- "name": "param",
- "parameterTypes": [
- "java.lang.String"
- ],
- "returnType": "java.lang.String",
- "parameters": [
- {
- "type": "java.lang.String",
- "items": [],
- "enum": [],
- "properties": {}
- }
- ]
- },
- "request": {
- "method": "GET",
- "path": "/param",
- "params": {
- "param": [
- "{0}"
- ]
- },
- "headers": {},
- "consumes": [],
- "produces": []
- },
- "indexToName": {
- "0": [
- "param"
- ]
- }
- },
- {
- "method": {
- "name": "params",
- "parameterTypes": [
- "int",
- "java.lang.String"
- ],
- "returnType": "java.lang.String",
- "parameters": [
- {
- "type": "int",
- "items": [],
- "enum": [],
- "properties": {}
- },
- {
- "type": "java.lang.String",
- "items": [],
- "enum": [],
- "properties": {}
- }
- ]
- },
- "request": {
- "method": "POST",
- "path": "/params",
- "params": {
- "a": [
- "{0}"
- ],
- "b": [
- "{1}"
- ]
- },
- "headers": {},
- "consumes": [],
- "produces": []
- },
- "indexToName": {
- "0": [
- "a"
- ],
- "1": [
- "b"
- ]
- }
- },
- {
- "method": {
- "name": "pathVariables",
- "parameterTypes": [
- "java.lang.String",
- "java.lang.String",
- "java.lang.String"
- ],
- "returnType": "java.lang.String",
- "parameters": [
- {
- "type": "java.lang.String",
- "items": [],
- "enum": [],
- "properties": {}
- },
- {
- "type": "java.lang.String",
- "items": [],
- "enum": [],
- "properties": {}
- },
- {
- "type": "java.lang.String",
- "items": [],
- "enum": [],
- "properties": {}
- }
- ]
- },
- "request": {
- "method": "GET",
- "path": "/path-variables/{p1}/{p2}",
- "params": {
- "v": [
- "{2}"
- ]
- },
- "headers": {},
- "consumes": [],
- "produces": []
- },
- "indexToName": {
- "0": [
- "path1"
- ],
- "1": [
- "path2"
- ],
- "2": [
- "param"
- ]
- }
- },
- {
- "method": {
- "name": "requestBodyMap",
- "parameterTypes": [
- "java.util.Map\u003cjava.lang.String,java.lang.Object\u003e",
- "java.lang.String"
- ],
- "returnType": "org.apache.dubbo.metadata.rest.User",
- "parameters": [
- {
- "type": "java.util.Map\u003cjava.lang.String,java.lang.Object\u003e",
- "items": [
- {
- "type": "java.lang.String",
- "items": [],
- "enum": [],
- "properties": {}
- },
- {
- "type": "java.lang.Object",
- "items": [],
- "enum": [],
- "properties": {}
- }
- ],
- "enum": [],
- "properties": {}
- },
- {
- "type": "java.lang.String",
- "items": [],
- "enum": [],
- "properties": {}
- }
- ]
- },
- "request": {
- "method": "POST",
- "path": "/request/body/map",
- "params": {
- "param": [
- "{1}"
- ]
- },
- "headers": {},
- "consumes": [],
- "produces": [
- "application/json;charset\u003dUTF-8"
- ]
- },
- "indexToName": {
- "0": [
- "data"
- ],
- "1": [
- "param"
- ]
- }
- },
- {
- "method": {
- "name": "requestBodyUser",
- "parameterTypes": [
- "org.apache.dubbo.metadata.rest.User"
- ],
- "returnType": "java.util.Map\u003cjava.lang.String,java.lang.Object\u003e",
- "parameters": [
- {
- "type": "org.apache.dubbo.metadata.rest.User",
- "items": [],
- "enum": [],
- "properties": {
- "name": {
- "type": "java.lang.String",
- "items": [],
- "enum": [],
- "properties": {}
- },
- "id": {
- "type": "java.lang.Long",
- "items": [],
- "enum": [],
- "properties": {}
- },
- "age": {
- "type": "java.lang.Integer",
- "items": [],
- "enum": [],
- "properties": {}
- }
- }
- }
- ]
- },
- "request": {
- "method": "POST",
- "path": "/request/body/user",
- "params": {},
- "headers": {},
- "consumes": [
- "application/json;charset\u003dUTF-8"
- ],
- "produces": []
- },
- "indexToName": {
- "0": [
- "user"
- ]
- }
- }
- ]
- }
-]
\ No newline at end of file
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/AbstractAnnotationProcessingTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/AbstractAnnotationProcessingTest.java
deleted file mode 100644
index d224f07..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/AbstractAnnotationProcessingTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.metadata.annotation.processing;
-
-import org.apache.dubbo.metadata.annotation.processing.util.TypeUtils;
-
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.extension.ExtendWith;
-
-import javax.annotation.processing.ProcessingEnvironment;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.util.Elements;
-import javax.lang.model.util.Types;
-import java.io.IOException;
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-/**
- * Abstract {@link Annotation} Processing Test case
- *
- * @since 2.7.6
- */
-@ExtendWith(CompilerInvocationInterceptor.class)
-public abstract class AbstractAnnotationProcessingTest {
-
- static ThreadLocal<AbstractAnnotationProcessingTest> testInstanceHolder = new ThreadLocal<>();
-
- protected ProcessingEnvironment processingEnv;
-
- protected Elements elements;
-
- protected Types types;
-
- @BeforeEach
- public final void init() throws IOException {
- testInstanceHolder.set(this);
- }
-
- @AfterEach
- public final void destroy() {
- testInstanceHolder.remove();
- }
-
- protected abstract void addCompiledClasses(Set<Class<?>> classesToBeCompiled);
-
- protected abstract void beforeEach();
-
- protected TypeElement getType(Class<?> type) {
- return TypeUtils.getType(processingEnv, type);
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/AnnotationProcessingTestProcessor.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/AnnotationProcessingTestProcessor.java
deleted file mode 100644
index 2b13813..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/AnnotationProcessingTestProcessor.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.metadata.annotation.processing;
-
-import org.junit.jupiter.api.extension.ExtensionContext;
-import org.junit.jupiter.api.extension.InvocationInterceptor;
-import org.junit.jupiter.api.extension.ReflectiveInvocationContext;
-
-import javax.annotation.processing.AbstractProcessor;
-import javax.annotation.processing.RoundEnvironment;
-import javax.annotation.processing.SupportedAnnotationTypes;
-import javax.lang.model.SourceVersion;
-import javax.lang.model.element.TypeElement;
-import java.lang.reflect.Method;
-import java.util.Set;
-
-import static javax.lang.model.SourceVersion.latestSupported;
-
-@SupportedAnnotationTypes("*")
-public class AnnotationProcessingTestProcessor extends AbstractProcessor {
-
- private final AbstractAnnotationProcessingTest abstractAnnotationProcessingTest;
- private final InvocationInterceptor.Invocation<Void> invocation;
-
- private final ReflectiveInvocationContext<Method> invocationContext;
-
- private final ExtensionContext extensionContext;
-
- public AnnotationProcessingTestProcessor(AbstractAnnotationProcessingTest abstractAnnotationProcessingTest, InvocationInterceptor.Invocation<Void> invocation,
- ReflectiveInvocationContext<Method> invocationContext,
- ExtensionContext extensionContext) {
- this.abstractAnnotationProcessingTest = abstractAnnotationProcessingTest;
- this.invocation = invocation;
- this.invocationContext = invocationContext;
- this.extensionContext = extensionContext;
- }
-
- @Override
- public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
- if (!roundEnv.processingOver()) {
- prepare();
- abstractAnnotationProcessingTest.beforeEach();
- try {
- invocation.proceed();
- } catch (Throwable throwable) {
- throw new RuntimeException(throwable);
- }
- }
- return false;
- }
-
- private void prepare() {
- abstractAnnotationProcessingTest.processingEnv = super.processingEnv;
- abstractAnnotationProcessingTest.elements = super.processingEnv.getElementUtils();
- abstractAnnotationProcessingTest.types = super.processingEnv.getTypeUtils();
- }
-
- @Override
- public SourceVersion getSupportedSourceVersion() {
- return latestSupported();
- }
-}
\ No newline at end of file
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/CompilerInvocationInterceptor.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/CompilerInvocationInterceptor.java
deleted file mode 100644
index fe97b4b..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/CompilerInvocationInterceptor.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.metadata.annotation.processing;
-
-import org.apache.dubbo.metadata.tools.Compiler;
-
-import org.junit.jupiter.api.extension.ExtensionContext;
-import org.junit.jupiter.api.extension.InvocationInterceptor;
-import org.junit.jupiter.api.extension.ReflectiveInvocationContext;
-
-import java.lang.reflect.Method;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import static org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest.testInstanceHolder;
-
-public class CompilerInvocationInterceptor implements InvocationInterceptor {
-
- @Override
- public void interceptTestMethod(Invocation<Void> invocation,
- ReflectiveInvocationContext<Method> invocationContext,
- ExtensionContext extensionContext) throws Throwable {
- Set<Class<?>> classesToBeCompiled = new LinkedHashSet<>();
- AbstractAnnotationProcessingTest abstractAnnotationProcessingTest = testInstanceHolder.get();
- classesToBeCompiled.add(getClass());
- abstractAnnotationProcessingTest.addCompiledClasses(classesToBeCompiled);
- Compiler compiler = new Compiler();
- compiler.processors(new AnnotationProcessingTestProcessor(abstractAnnotationProcessingTest, invocation, invocationContext, extensionContext));
- compiler.compile(classesToBeCompiled.toArray(new Class[0]));
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/ArrayTypeDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/ArrayTypeDefinitionBuilderTest.java
deleted file mode 100644
index 3290a8a..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/ArrayTypeDefinitionBuilderTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.metadata.annotation.processing.builder;
-
-import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.annotation.processing.model.ArrayTypeModel;
-import org.apache.dubbo.metadata.definition.model.TypeDefinition;
-
-import org.junit.jupiter.api.Test;
-
-import javax.annotation.processing.ProcessingEnvironment;
-import javax.lang.model.element.ElementKind;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import java.util.Set;
-import java.util.function.BiConsumer;
-import java.util.stream.Stream;
-
-import static org.apache.dubbo.metadata.annotation.processing.util.FieldUtils.findField;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * {@link ArrayTypeDefinitionBuilder} Test
- *
- * @since 2.7.6
- */
-public class ArrayTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
-
- private ArrayTypeDefinitionBuilder builder;
-
- private TypeElement testType;
-
- private VariableElement integersField;
-
- private VariableElement stringsField;
-
- private VariableElement primitiveTypeModelsField;
-
- private VariableElement modelsField;
-
- private VariableElement colorsField;
-
- @Override
- protected void addCompiledClasses(Set<Class<?>> classesToBeCompiled) {
- classesToBeCompiled.add(ArrayTypeModel.class);
- }
-
- @Override
- protected void beforeEach() {
- builder = new ArrayTypeDefinitionBuilder();
- testType = getType(ArrayTypeModel.class);
- integersField = findField(testType, "integers");
- stringsField = findField(testType, "strings");
- primitiveTypeModelsField = findField(testType, "primitiveTypeModels");
- modelsField = findField(testType, "models");
- colorsField = findField(testType, "colors");
- }
-
- @Test
- public void testAccept() {
- assertTrue(builder.accept(processingEnv, integersField.asType()));
- assertTrue(builder.accept(processingEnv, stringsField.asType()));
- assertTrue(builder.accept(processingEnv, primitiveTypeModelsField.asType()));
- assertTrue(builder.accept(processingEnv, modelsField.asType()));
- assertTrue(builder.accept(processingEnv, colorsField.asType()));
- }
-
- @Test
- public void testBuild() {
-
- buildAndAssertTypeDefinition(processingEnv, integersField, "int[]", "int", builder);
-
- buildAndAssertTypeDefinition(processingEnv, stringsField, "java.lang.String[]", "java.lang.String", builder);
-
- buildAndAssertTypeDefinition(processingEnv, primitiveTypeModelsField,
- "org.apache.dubbo.metadata.annotation.processing.model.PrimitiveTypeModel[]",
- "org.apache.dubbo.metadata.annotation.processing.model.PrimitiveTypeModel", builder);
-
- buildAndAssertTypeDefinition(processingEnv, modelsField,
- "org.apache.dubbo.metadata.annotation.processing.model.Model[]",
- "org.apache.dubbo.metadata.annotation.processing.model.Model", builder, (def, subDef) -> {
- TypeElement subType = elements.getTypeElement(subDef.getType());
- assertEquals(ElementKind.CLASS, subType.getKind());
- });
-
- buildAndAssertTypeDefinition(processingEnv, colorsField,
- "org.apache.dubbo.metadata.annotation.processing.model.Color[]",
- "org.apache.dubbo.metadata.annotation.processing.model.Color", builder, (def, subDef) -> {
- TypeElement subType = elements.getTypeElement(subDef.getType());
- assertEquals(ElementKind.ENUM, subType.getKind());
- });
-
- }
-
- static void buildAndAssertTypeDefinition(ProcessingEnvironment processingEnv, VariableElement field,
- String expectedType, String compositeType, TypeDefinitionBuilder builder,
- BiConsumer<TypeDefinition, TypeDefinition>... assertions) {
- TypeDefinition typeDefinition = TypeDefinitionBuilder.build(processingEnv, field);
- TypeDefinition subTypeDefinition = typeDefinition.getItems().get(0);
- assertEquals(expectedType, typeDefinition.getType());
-// assertEquals(field.getSimpleName().toString(), typeDefinition.get$ref());
- assertEquals(compositeType, subTypeDefinition.getType());
-// assertEquals(builder.getClass().getName(), typeDefinition.getTypeBuilderName());
- Stream.of(assertions).forEach(assertion -> assertion.accept(typeDefinition, subTypeDefinition));
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/CollectionTypeDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/CollectionTypeDefinitionBuilderTest.java
deleted file mode 100644
index bd6e7a4..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/CollectionTypeDefinitionBuilderTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.metadata.annotation.processing.builder;
-
-import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.annotation.processing.model.CollectionTypeModel;
-
-import org.junit.jupiter.api.Test;
-
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import java.util.Set;
-
-import static org.apache.dubbo.metadata.annotation.processing.builder.ArrayTypeDefinitionBuilderTest.buildAndAssertTypeDefinition;
-import static org.apache.dubbo.metadata.annotation.processing.util.FieldUtils.findField;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * {@link CollectionTypeDefinitionBuilder} Test
- *
- * @since 2.7.6
- */
-public class CollectionTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
-
- private CollectionTypeDefinitionBuilder builder;
-
- private VariableElement stringsField;
-
- private VariableElement colorsField;
-
- private VariableElement primitiveTypeModelsField;
-
- private VariableElement modelsField;
-
- private VariableElement modelArraysField;
-
- @Override
- protected void addCompiledClasses(Set<Class<?>> classesToBeCompiled) {
- classesToBeCompiled.add(CollectionTypeModel.class);
- }
-
- @Override
- protected void beforeEach() {
- builder = new CollectionTypeDefinitionBuilder();
- TypeElement testType = getType(CollectionTypeModel.class);
- stringsField = findField( testType, "strings");
- colorsField = findField( testType, "colors");
- primitiveTypeModelsField = findField( testType, "primitiveTypeModels");
- modelsField = findField( testType, "models");
- modelArraysField = findField( testType, "modelArrays");
-
- assertEquals("strings", stringsField.getSimpleName().toString());
- assertEquals("colors", colorsField.getSimpleName().toString());
- assertEquals("primitiveTypeModels", primitiveTypeModelsField.getSimpleName().toString());
- assertEquals("models", modelsField.getSimpleName().toString());
- assertEquals("modelArrays", modelArraysField.getSimpleName().toString());
- }
-
- @Test
- public void testAccept() {
- assertTrue(builder.accept(processingEnv, stringsField.asType()));
- assertTrue(builder.accept(processingEnv, colorsField.asType()));
- assertTrue(builder.accept(processingEnv, primitiveTypeModelsField.asType()));
- assertTrue(builder.accept(processingEnv, modelsField.asType()));
- assertTrue(builder.accept(processingEnv, modelArraysField.asType()));
- }
-
- @Test
- public void testBuild() {
-
- buildAndAssertTypeDefinition(processingEnv, stringsField, "java.util.Collection<java.lang.String>", "java.lang.String", builder);
-
- buildAndAssertTypeDefinition(processingEnv, colorsField, "java.util.List<org.apache.dubbo.metadata.annotation.processing.model.Color>",
- "org.apache.dubbo.metadata.annotation.processing.model.Color", builder);
-
- buildAndAssertTypeDefinition(processingEnv, primitiveTypeModelsField,
- "java.util.Queue<org.apache.dubbo.metadata.annotation.processing.model.PrimitiveTypeModel>",
- "org.apache.dubbo.metadata.annotation.processing.model.PrimitiveTypeModel", builder);
-
- buildAndAssertTypeDefinition(processingEnv, modelsField,
- "java.util.Deque<org.apache.dubbo.metadata.annotation.processing.model.Model>",
- "org.apache.dubbo.metadata.annotation.processing.model.Model", builder);
-
- buildAndAssertTypeDefinition(processingEnv, modelArraysField,
- "java.util.Set<org.apache.dubbo.metadata.annotation.processing.model.Model[]>",
- "org.apache.dubbo.metadata.annotation.processing.model.Model[]", builder);
-
-
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/EnumTypeDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/EnumTypeDefinitionBuilderTest.java
deleted file mode 100644
index 1157584..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/EnumTypeDefinitionBuilderTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.metadata.annotation.processing.builder;
-
-import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.annotation.processing.model.Color;
-import org.apache.dubbo.metadata.definition.model.TypeDefinition;
-
-import org.junit.jupiter.api.Test;
-
-import javax.lang.model.element.TypeElement;
-import java.util.Set;
-
-import static java.util.Arrays.asList;
-import static org.apache.dubbo.metadata.annotation.processing.builder.TypeDefinitionBuilder.build;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * {@link EnumTypeDefinitionBuilder} Test
- *
- * @since 2.7.6
- */
-public class EnumTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
-
- private EnumTypeDefinitionBuilder builder;
-
- @Override
- protected void addCompiledClasses(Set<Class<?>> classesToBeCompiled) {
- classesToBeCompiled.add(Color.class);
- }
-
- @Override
- protected void beforeEach() {
- builder = new EnumTypeDefinitionBuilder();
- }
-
- @Test
- public void testAccept() {
- TypeElement typeElement = getType(Color.class);
- assertTrue(builder.accept(processingEnv, typeElement.asType()));
- }
-
- @Test
- public void testBuild() {
- TypeElement typeElement = getType(Color.class);
- TypeDefinition typeDefinition = build(processingEnv, typeElement);
- assertEquals(Color.class.getName(), typeDefinition.getType());
- assertEquals(asList("RED", "YELLOW", "BLUE"), typeDefinition.getEnums());
-// assertEquals(typeDefinition.getTypeBuilderName(), builder.getClass().getName());
- }
-
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/GeneralTypeDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/GeneralTypeDefinitionBuilderTest.java
deleted file mode 100644
index 33e27d3..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/GeneralTypeDefinitionBuilderTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.metadata.annotation.processing.builder;
-
-import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.annotation.processing.model.ArrayTypeModel;
-import org.apache.dubbo.metadata.annotation.processing.model.CollectionTypeModel;
-import org.apache.dubbo.metadata.annotation.processing.model.Color;
-import org.apache.dubbo.metadata.annotation.processing.model.Model;
-import org.apache.dubbo.metadata.annotation.processing.model.PrimitiveTypeModel;
-import org.apache.dubbo.metadata.annotation.processing.model.SimpleTypeModel;
-
-import org.junit.jupiter.api.Test;
-
-import java.util.Set;
-
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * {@link GeneralTypeDefinitionBuilder} Test
- *
- * @since 2.7.6
- */
-public class GeneralTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
-
- private GeneralTypeDefinitionBuilder builder;
-
- @Override
- protected void addCompiledClasses(Set<Class<?>> classesToBeCompiled) {
- classesToBeCompiled.add(Model.class);
- }
-
- @Override
- protected void beforeEach() {
- builder = new GeneralTypeDefinitionBuilder();
- }
-
- @Test
- public void testAccept() {
- assertTrue(builder.accept(processingEnv, getType(Model.class).asType()));
- assertTrue(builder.accept(processingEnv, getType(PrimitiveTypeModel.class).asType()));
- assertTrue(builder.accept(processingEnv, getType(SimpleTypeModel.class).asType()));
- assertTrue(builder.accept(processingEnv, getType(ArrayTypeModel.class).asType()));
- assertTrue(builder.accept(processingEnv, getType(CollectionTypeModel.class).asType()));
- assertFalse(builder.accept(processingEnv, getType(Color.class).asType()));
- }
-
- @Test
- public void testBuild() {
-
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/MapTypeDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/MapTypeDefinitionBuilderTest.java
deleted file mode 100644
index f7b32b5..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/MapTypeDefinitionBuilderTest.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * 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.metadata.annotation.processing.builder;
-
-import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.annotation.processing.model.MapTypeModel;
-import org.apache.dubbo.metadata.definition.model.TypeDefinition;
-
-import org.junit.jupiter.api.Test;
-
-import javax.annotation.processing.ProcessingEnvironment;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import java.util.Set;
-import java.util.function.BiConsumer;
-import java.util.stream.Stream;
-
-import static org.apache.dubbo.metadata.annotation.processing.util.FieldUtils.findField;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * {@link MapTypeDefinitionBuilder} Test
- *
- * @since 2.7.6
- */
-public class MapTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
-
- private MapTypeDefinitionBuilder builder;
-
- private VariableElement stringsField;
-
- private VariableElement colorsField;
-
- private VariableElement primitiveTypeModelsField;
-
- private VariableElement modelsField;
-
- private VariableElement modelArraysField;
-
- @Override
- protected void addCompiledClasses(Set<Class<?>> classesToBeCompiled) {
- classesToBeCompiled.add(MapTypeModel.class);
- }
-
- @Override
- protected void beforeEach() {
- builder = new MapTypeDefinitionBuilder();
- TypeElement testType = getType(MapTypeModel.class);
- stringsField = findField( testType, "strings");
- colorsField = findField( testType, "colors");
- primitiveTypeModelsField = findField( testType, "primitiveTypeModels");
- modelsField = findField( testType, "models");
- modelArraysField = findField( testType, "modelArrays");
-
- assertEquals("strings", stringsField.getSimpleName().toString());
- assertEquals("colors", colorsField.getSimpleName().toString());
- assertEquals("primitiveTypeModels", primitiveTypeModelsField.getSimpleName().toString());
- assertEquals("models", modelsField.getSimpleName().toString());
- assertEquals("modelArrays", modelArraysField.getSimpleName().toString());
- }
-
- @Test
- public void testAccept() {
- assertTrue(builder.accept(processingEnv, stringsField.asType()));
- assertTrue(builder.accept(processingEnv, colorsField.asType()));
- assertTrue(builder.accept(processingEnv, primitiveTypeModelsField.asType()));
- assertTrue(builder.accept(processingEnv, modelsField.asType()));
- assertTrue(builder.accept(processingEnv, modelArraysField.asType()));
- }
-
- @Test
- public void testBuild() {
-
- buildAndAssertTypeDefinition(processingEnv, stringsField,
- "java.util.Map<java.lang.String,java.lang.String>",
- "java.lang.String",
- "java.lang.String",
- builder);
-
- buildAndAssertTypeDefinition(processingEnv, colorsField,
- "java.util.SortedMap<java.lang.String,org.apache.dubbo.metadata.annotation.processing.model.Color>",
- "java.lang.String",
- "org.apache.dubbo.metadata.annotation.processing.model.Color",
- builder);
-
- buildAndAssertTypeDefinition(processingEnv, primitiveTypeModelsField,
- "java.util.NavigableMap<org.apache.dubbo.metadata.annotation.processing.model.Color,org.apache.dubbo.metadata.annotation.processing.model.PrimitiveTypeModel>",
- "org.apache.dubbo.metadata.annotation.processing.model.Color",
- "org.apache.dubbo.metadata.annotation.processing.model.PrimitiveTypeModel",
- builder);
-
- buildAndAssertTypeDefinition(processingEnv, modelsField,
- "java.util.HashMap<java.lang.String,org.apache.dubbo.metadata.annotation.processing.model.Model>",
- "java.lang.String",
- "org.apache.dubbo.metadata.annotation.processing.model.Model",
- builder);
-
- buildAndAssertTypeDefinition(processingEnv, modelArraysField,
- "java.util.TreeMap<org.apache.dubbo.metadata.annotation.processing.model.PrimitiveTypeModel,org.apache.dubbo.metadata.annotation.processing.model.Model[]>",
- "org.apache.dubbo.metadata.annotation.processing.model.PrimitiveTypeModel",
- "org.apache.dubbo.metadata.annotation.processing.model.Model[]",
- builder);
- }
-
- static void buildAndAssertTypeDefinition(ProcessingEnvironment processingEnv, VariableElement field,
- String expectedType, String keyType, String valueType,
- TypeDefinitionBuilder builder,
- BiConsumer<TypeDefinition, TypeDefinition>... assertions) {
- TypeDefinition typeDefinition = TypeDefinitionBuilder.build(processingEnv, field);
- TypeDefinition keyTypeDefinition = typeDefinition.getItems().get(0);
- TypeDefinition valueTypeDefinition = typeDefinition.getItems().get(1);
- assertEquals(expectedType, typeDefinition.getType());
-// assertEquals(field.getSimpleName().toString(), typeDefinition.get$ref());
- assertEquals(keyType, keyTypeDefinition.getType());
- assertEquals(valueType, valueTypeDefinition.getType());
-// assertEquals(builder.getClass().getName(), typeDefinition.getTypeBuilderName());
- Stream.of(assertions).forEach(assertion -> assertion.accept(typeDefinition, keyTypeDefinition));
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/PrimitiveTypeDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/PrimitiveTypeDefinitionBuilderTest.java
deleted file mode 100644
index adc2512..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/PrimitiveTypeDefinitionBuilderTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.metadata.annotation.processing.builder;
-
-import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.annotation.processing.model.PrimitiveTypeModel;
-import org.apache.dubbo.metadata.definition.model.TypeDefinition;
-
-import org.junit.jupiter.api.Test;
-
-import javax.annotation.processing.ProcessingEnvironment;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import java.util.Set;
-
-import static org.apache.dubbo.metadata.annotation.processing.util.FieldUtils.findField;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * {@link PrimitiveTypeDefinitionBuilder} Test
- *
- * @since 2.7.6
- */
-public class PrimitiveTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
-
- private PrimitiveTypeDefinitionBuilder builder;
-
- private VariableElement zField;
-
- private VariableElement bField;
-
- private VariableElement cField;
-
- private VariableElement sField;
-
- private VariableElement iField;
-
- private VariableElement lField;
-
- private VariableElement fField;
-
- private VariableElement dField;
-
- @Override
- protected void addCompiledClasses(Set<Class<?>> classesToBeCompiled) {
- classesToBeCompiled.add(PrimitiveTypeModel.class);
- }
-
- @Override
- protected void beforeEach() {
-
- builder = new PrimitiveTypeDefinitionBuilder();
-
- TypeElement testType = getType(PrimitiveTypeModel.class);
-
- zField = findField( testType, "z");
- bField = findField( testType, "b");
- cField = findField( testType, "c");
- sField = findField( testType, "s");
- iField = findField( testType, "i");
- lField = findField( testType, "l");
- fField = findField( testType, "f");
- dField = findField( testType, "d");
-
- assertEquals("boolean", zField.asType().toString());
- assertEquals("byte", bField.asType().toString());
- assertEquals("char", cField.asType().toString());
- assertEquals("short", sField.asType().toString());
- assertEquals("int", iField.asType().toString());
- assertEquals("long", lField.asType().toString());
- assertEquals("float", fField.asType().toString());
- assertEquals("double", dField.asType().toString());
- }
-
- @Test
- public void testAccept() {
- assertTrue(builder.accept(processingEnv, zField.asType()));
- assertTrue(builder.accept(processingEnv, bField.asType()));
- assertTrue(builder.accept(processingEnv, cField.asType()));
- assertTrue(builder.accept(processingEnv, sField.asType()));
- assertTrue(builder.accept(processingEnv, iField.asType()));
- assertTrue(builder.accept(processingEnv, lField.asType()));
- assertTrue(builder.accept(processingEnv, fField.asType()));
- assertTrue(builder.accept(processingEnv, dField.asType()));
- }
-
- @Test
- public void testBuild() {
- buildAndAssertTypeDefinition(processingEnv, zField, builder);
- buildAndAssertTypeDefinition(processingEnv, bField, builder);
- buildAndAssertTypeDefinition(processingEnv, cField, builder);
- buildAndAssertTypeDefinition(processingEnv, sField, builder);
- buildAndAssertTypeDefinition(processingEnv, iField, builder);
- buildAndAssertTypeDefinition(processingEnv, lField, builder);
- buildAndAssertTypeDefinition(processingEnv, zField, builder);
- buildAndAssertTypeDefinition(processingEnv, fField, builder);
- buildAndAssertTypeDefinition(processingEnv, dField, builder);
- }
-
- static void buildAndAssertTypeDefinition(ProcessingEnvironment processingEnv, VariableElement field, TypeDefinitionBuilder builder) {
- TypeDefinition typeDefinition = TypeDefinitionBuilder.build(processingEnv, field);
- assertBasicTypeDefinition(typeDefinition, field.asType().toString(), builder);
-// assertEquals(field.getSimpleName().toString(), typeDefinition.get$ref());
- }
-
- static void assertBasicTypeDefinition(TypeDefinition typeDefinition, String type, TypeDefinitionBuilder builder) {
- assertEquals(type, typeDefinition.getType());
-// assertEquals(builder.getClass().getName(), typeDefinition.getTypeBuilderName());
- assertTrue(typeDefinition.getProperties().isEmpty());
- assertTrue(typeDefinition.getItems().isEmpty());
- assertTrue(typeDefinition.getEnums().isEmpty());
- assertNull(typeDefinition.getId());
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/ServiceDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/ServiceDefinitionBuilderTest.java
deleted file mode 100644
index 7f21cef..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/ServiceDefinitionBuilderTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.metadata.annotation.processing.builder;
-
-import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.definition.model.ServiceDefinition;
-import org.apache.dubbo.metadata.tools.TestServiceImpl;
-
-import org.junit.jupiter.api.Test;
-
-import java.util.Set;
-
-import static org.apache.dubbo.metadata.annotation.processing.builder.ServiceDefinitionBuilder.build;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-/**
- * {@link ServiceDefinitionBuilder} Test
- *
- * @since 2.7.6
- */
-public class ServiceDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
-
-
- @Override
- protected void addCompiledClasses(Set<Class<?>> classesToBeCompiled) {
- classesToBeCompiled.add(TestServiceImpl.class);
- }
-
- @Override
- protected void beforeEach() {
- }
-
- @Test
- public void testBuild() {
- ServiceDefinition serviceDefinition = build(processingEnv, getType(TestServiceImpl.class));
- assertEquals(TestServiceImpl.class.getTypeName(), serviceDefinition.getCanonicalName());
- assertEquals("org/apache/dubbo/metadata/tools/TestServiceImpl.class", serviceDefinition.getCodeSource());
- // types
- int i = 0;
- assertEquals("org.apache.dubbo.metadata.tools.TestServiceImpl", serviceDefinition.getTypes().get(i++).getType());
- assertEquals("org.apache.dubbo.metadata.tools.GenericTestService", serviceDefinition.getTypes().get(i++).getType());
- assertEquals("org.apache.dubbo.metadata.tools.DefaultTestService", serviceDefinition.getTypes().get(i++).getType());
- assertEquals("org.apache.dubbo.metadata.tools.TestService", serviceDefinition.getTypes().get(i++).getType());
- assertEquals("java.lang.AutoCloseable", serviceDefinition.getTypes().get(i++).getType());
- assertEquals("java.io.Serializable", serviceDefinition.getTypes().get(i++).getType());
- assertEquals("java.util.EventListener", serviceDefinition.getTypes().get(i++).getType());
- // methods
- assertEquals(14, serviceDefinition.getMethods().size());
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/SimpleTypeDefinitionBuilderTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/SimpleTypeDefinitionBuilderTest.java
deleted file mode 100644
index 97edf89..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/builder/SimpleTypeDefinitionBuilderTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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.metadata.annotation.processing.builder;
-
-import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.annotation.processing.model.SimpleTypeModel;
-
-import org.junit.jupiter.api.Test;
-
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import java.util.Set;
-
-import static org.apache.dubbo.metadata.annotation.processing.builder.PrimitiveTypeDefinitionBuilderTest.buildAndAssertTypeDefinition;
-import static org.apache.dubbo.metadata.annotation.processing.util.FieldUtils.findField;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * {@link SimpleTypeDefinitionBuilder} Test
- *
- * @since 2.7.6
- */
-public class SimpleTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
-
- private SimpleTypeDefinitionBuilder builder;
-
- private VariableElement vField;
-
- private VariableElement zField;
-
- private VariableElement cField;
-
- private VariableElement bField;
-
- private VariableElement sField;
-
- private VariableElement iField;
-
- private VariableElement lField;
-
- private VariableElement fField;
-
- private VariableElement dField;
-
- private VariableElement strField;
-
- private VariableElement bdField;
-
- private VariableElement biField;
-
- private VariableElement dtField;
-
- private VariableElement invalidField;
-
-
- @Override
- protected void addCompiledClasses(Set<Class<?>> classesToBeCompiled) {
- classesToBeCompiled.add(SimpleTypeModel.class);
- }
-
- @Override
- protected void beforeEach() {
- builder = new SimpleTypeDefinitionBuilder();
- TypeElement testType = getType(SimpleTypeModel.class);
- vField = findField(testType, "v");
- zField = findField(testType, "z");
- cField = findField(testType, "c");
- bField = findField(testType, "b");
- sField = findField(testType, "s");
- iField = findField(testType, "i");
- lField = findField(testType, "l");
- fField = findField(testType, "f");
- dField = findField(testType, "d");
- strField = findField(testType, "str");
- bdField = findField(testType, "bd");
- biField = findField(testType, "bi");
- dtField = findField(testType, "dt");
- invalidField = findField(testType, "invalid");
-
- assertEquals("java.lang.Void", vField.asType().toString());
- assertEquals("java.lang.Boolean", zField.asType().toString());
- assertEquals("java.lang.Character", cField.asType().toString());
- assertEquals("java.lang.Byte", bField.asType().toString());
- assertEquals("java.lang.Short", sField.asType().toString());
- assertEquals("java.lang.Integer", iField.asType().toString());
- assertEquals("java.lang.Long", lField.asType().toString());
- assertEquals("java.lang.Float", fField.asType().toString());
- assertEquals("java.lang.Double", dField.asType().toString());
- assertEquals("java.lang.String", strField.asType().toString());
- assertEquals("java.math.BigDecimal", bdField.asType().toString());
- assertEquals("java.math.BigInteger", biField.asType().toString());
- assertEquals("java.util.Date", dtField.asType().toString());
- assertEquals("int", invalidField.asType().toString());
- }
-
- @Test
- public void testAccept() {
- assertTrue(builder.accept(processingEnv, vField.asType()));
- assertTrue(builder.accept(processingEnv, zField.asType()));
- assertTrue(builder.accept(processingEnv, cField.asType()));
- assertTrue(builder.accept(processingEnv, bField.asType()));
- assertTrue(builder.accept(processingEnv, sField.asType()));
- assertTrue(builder.accept(processingEnv, iField.asType()));
- assertTrue(builder.accept(processingEnv, lField.asType()));
- assertTrue(builder.accept(processingEnv, fField.asType()));
- assertTrue(builder.accept(processingEnv, dField.asType()));
- assertTrue(builder.accept(processingEnv, strField.asType()));
- assertTrue(builder.accept(processingEnv, bdField.asType()));
- assertTrue(builder.accept(processingEnv, biField.asType()));
- assertTrue(builder.accept(processingEnv, dtField.asType()));
- // false condition
- assertFalse(builder.accept(processingEnv, invalidField.asType()));
- }
-
- @Test
- public void testBuild() {
- buildAndAssertTypeDefinition(processingEnv, vField, builder);
- buildAndAssertTypeDefinition(processingEnv, zField, builder);
- buildAndAssertTypeDefinition(processingEnv, cField, builder);
- buildAndAssertTypeDefinition(processingEnv, sField, builder);
- buildAndAssertTypeDefinition(processingEnv, iField, builder);
- buildAndAssertTypeDefinition(processingEnv, lField, builder);
- buildAndAssertTypeDefinition(processingEnv, fField, builder);
- buildAndAssertTypeDefinition(processingEnv, dField, builder);
- buildAndAssertTypeDefinition(processingEnv, strField, builder);
- buildAndAssertTypeDefinition(processingEnv, bdField, builder);
- buildAndAssertTypeDefinition(processingEnv, biField, builder);
- buildAndAssertTypeDefinition(processingEnv, dtField, builder);
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/ArrayTypeModel.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/ArrayTypeModel.java
deleted file mode 100644
index 28bf4f3..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/ArrayTypeModel.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.metadata.annotation.processing.model;
-
-/**
- * Array Type Model
- *
- * @since 2.7.6
- */
-public class ArrayTypeModel {
-
- private int[] integers; // Primitive type array
-
- private String[] strings; // Simple type array
-
- private PrimitiveTypeModel[] primitiveTypeModels; // Complex type array
-
- private Model[] models; // Hierarchical Complex type array
-
- private Color[] colors; // Enum type array
-
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/CollectionTypeModel.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/CollectionTypeModel.java
deleted file mode 100644
index e90f1c8..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/CollectionTypeModel.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.metadata.annotation.processing.model;
-
-import java.util.Collection;
-import java.util.Deque;
-import java.util.List;
-import java.util.Queue;
-import java.util.Set;
-
-/**
- * {@link Collection} Type Model
- *
- * @since 2.7.6
- */
-public class CollectionTypeModel {
-
- private Collection<String> strings; // The composite element is simple type
-
- private List<Color> colors; // The composite element is Enum type
-
- private Queue<PrimitiveTypeModel> primitiveTypeModels; // The composite element is POJO type
-
- private Deque<Model> models; // The composite element is hierarchical POJO type
-
- private Set<Model[]> modelArrays; // The composite element is hierarchical POJO type
-
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/Color.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/Color.java
deleted file mode 100644
index 9fab9df..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/Color.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.metadata.annotation.processing.model;
-
-/**
- * Color enumeration
- *
- * @since 2.7.6
- */
-public enum Color {
-
- RED(1),
- YELLOW(2),
- BLUE(3);
-
- private final int value;
-
- Color(int value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return "Color{" +
- "value=" + value +
- "} " + super.toString();
- }
-
- public int getValue() {
- return value;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/MapTypeModel.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/MapTypeModel.java
deleted file mode 100644
index 087aa93..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/MapTypeModel.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.metadata.annotation.processing.model;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.NavigableMap;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-/**
- * {@link Map} Type model
- *
- * @since 2.7.6
- */
-public class MapTypeModel {
-
- private Map<String, String> strings; // The composite element is simple type
-
- private SortedMap<String, Color> colors; // The composite element is Enum type
-
- private NavigableMap<Color, PrimitiveTypeModel> primitiveTypeModels; // The composite element is POJO type
-
- private HashMap<String, Model> models; // The composite element is hierarchical POJO type
-
- private TreeMap<PrimitiveTypeModel, Model[]> modelArrays; // The composite element is hierarchical POJO type
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/Model.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/Model.java
deleted file mode 100644
index e3c72a5..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/Model.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.metadata.annotation.processing.model;
-
-import org.apache.dubbo.metadata.tools.Parent;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Model Object
- */
-public class Model extends Parent {
-
- private float f;
-
- private double d;
-
- private TimeUnit tu;
-
- private String str;
-
- private BigInteger bi;
-
- private BigDecimal bd;
-
- public float getF() {
- return f;
- }
-
- public void setF(float f) {
- this.f = f;
- }
-
- public double getD() {
- return d;
- }
-
- public void setD(double d) {
- this.d = d;
- }
-
- public TimeUnit getTu() {
- return tu;
- }
-
- public void setTu(TimeUnit tu) {
- this.tu = tu;
- }
-
- public String getStr() {
- return str;
- }
-
- public void setStr(String str) {
- this.str = str;
- }
-
- public BigInteger getBi() {
- return bi;
- }
-
- public void setBi(BigInteger bi) {
- this.bi = bi;
- }
-
- public BigDecimal getBd() {
- return bd;
- }
-
- public void setBd(BigDecimal bd) {
- this.bd = bd;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/PrimitiveTypeModel.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/PrimitiveTypeModel.java
deleted file mode 100644
index c013a74..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/PrimitiveTypeModel.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.metadata.annotation.processing.model;
-
-/**
- * Primitive Type model
- *
- * @since 2.7.6
- */
-public class PrimitiveTypeModel {
-
- private boolean z;
-
- private byte b;
-
- private char c;
-
- private short s;
-
- private int i;
-
- private long l;
-
- private float f;
-
- private double d;
-
- public boolean isZ() {
- return z;
- }
-
- public byte getB() {
- return b;
- }
-
- public char getC() {
- return c;
- }
-
- public short getS() {
- return s;
- }
-
- public int getI() {
- return i;
- }
-
- public long getL() {
- return l;
- }
-
- public float getF() {
- return f;
- }
-
- public double getD() {
- return d;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/SimpleTypeModel.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/SimpleTypeModel.java
deleted file mode 100644
index 4b3523a..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/model/SimpleTypeModel.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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.metadata.annotation.processing.model;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Date;
-
-/**
- * Simple Type model
- *
- * @since 2.7.6
- */
-public class SimpleTypeModel {
-
- private Void v;
-
- private Boolean z;
-
- private Character c;
-
- private Byte b;
-
- private Short s;
-
- private Integer i;
-
- private Long l;
-
- private Float f;
-
- private Double d;
-
- private String str;
-
- private BigDecimal bd;
-
- private BigInteger bi;
-
- private Date dt;
-
- private int invalid;
-
- public Void getV() {
- return v;
- }
-
- public void setV(Void v) {
- this.v = v;
- }
-
- public Boolean getZ() {
- return z;
- }
-
- public void setZ(Boolean z) {
- this.z = z;
- }
-
- public Character getC() {
- return c;
- }
-
- public void setC(Character c) {
- this.c = c;
- }
-
- public Byte getB() {
- return b;
- }
-
- public void setB(Byte b) {
- this.b = b;
- }
-
- public Short getS() {
- return s;
- }
-
- public void setS(Short s) {
- this.s = s;
- }
-
- public Integer getI() {
- return i;
- }
-
- public void setI(Integer i) {
- this.i = i;
- }
-
- public Long getL() {
- return l;
- }
-
- public void setL(Long l) {
- this.l = l;
- }
-
- public Float getF() {
- return f;
- }
-
- public void setF(Float f) {
- this.f = f;
- }
-
- public Double getD() {
- return d;
- }
-
- public void setD(Double d) {
- this.d = d;
- }
-
- public String getStr() {
- return str;
- }
-
- public void setStr(String str) {
- this.str = str;
- }
-
- public BigDecimal getBd() {
- return bd;
- }
-
- public void setBd(BigDecimal bd) {
- this.bd = bd;
- }
-
- public BigInteger getBi() {
- return bi;
- }
-
- public void setBi(BigInteger bi) {
- this.bi = bi;
- }
-
- public Date getDt() {
- return dt;
- }
-
- public void setDt(Date dt) {
- this.dt = dt;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/rest/AnnotatedMethodParameterProcessorTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/rest/AnnotatedMethodParameterProcessorTest.java
deleted file mode 100644
index 825906b..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/rest/AnnotatedMethodParameterProcessorTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.metadata.annotation.processing.rest;
-
-import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.rest.RestMethodMetadata;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
-/**
- * The abstract class for {@link AnnotatedMethodParameterProcessor}'s test cases
- *
- * @since 2.7.6
- */
-public abstract class AnnotatedMethodParameterProcessorTest extends AbstractAnnotationProcessingTest {
-
- protected AnnotatedMethodParameterProcessor processor;
-
- protected RestMethodMetadata restMethodMetadata;
-
- protected abstract AnnotatedMethodParameterProcessor createTestInstance();
-
- @BeforeEach
- public final void prepare() {
- this.processor = createTestInstance();
- this.restMethodMetadata = createRestMethodMetadata();
- }
-
- protected RestMethodMetadata createRestMethodMetadata() {
- return new RestMethodMetadata();
- }
-
- protected abstract String getExpectedAnnotationType();
-
- @Test
- public void testGetAnnotationType() {
- String expectedAnnotationType = getExpectedAnnotationType();
- assertNull(processor.getAnnotationType());
- assertEquals(expectedAnnotationType, processor.getAnnotationType());
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/AnnotationUtilsTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/AnnotationUtilsTest.java
deleted file mode 100644
index cbc3dc1..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/AnnotationUtilsTest.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * 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.metadata.annotation.processing.util;
-
-import org.apache.dubbo.config.annotation.Service;
-import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.rest.SpringRestService;
-import org.apache.dubbo.metadata.tools.TestService;
-import org.apache.dubbo.metadata.tools.TestServiceImpl;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.web.bind.annotation.GetMapping;
-
-import javax.annotation.processing.ProcessingEnvironment;
-import javax.lang.model.element.AnnotationMirror;
-import javax.lang.model.element.Element;
-import javax.lang.model.element.ExecutableElement;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.type.TypeMirror;
-import javax.ws.rs.Path;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import static org.apache.dubbo.metadata.annotation.processing.util.AnnotationUtils.findAnnotation;
-import static org.apache.dubbo.metadata.annotation.processing.util.AnnotationUtils.findMetaAnnotation;
-import static org.apache.dubbo.metadata.annotation.processing.util.AnnotationUtils.getAllAnnotations;
-import static org.apache.dubbo.metadata.annotation.processing.util.AnnotationUtils.getAnnotation;
-import static org.apache.dubbo.metadata.annotation.processing.util.AnnotationUtils.getAnnotations;
-import static org.apache.dubbo.metadata.annotation.processing.util.AnnotationUtils.getAttribute;
-import static org.apache.dubbo.metadata.annotation.processing.util.AnnotationUtils.getValue;
-import static org.apache.dubbo.metadata.annotation.processing.util.AnnotationUtils.isAnnotationPresent;
-import static org.apache.dubbo.metadata.annotation.processing.util.MethodUtils.findMethod;
-import static org.apache.dubbo.metadata.annotation.processing.util.MethodUtils.getAllDeclaredMethods;
-import static org.junit.jupiter.api.Assertions.assertArrayEquals;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * The {@link AnnotationUtils} Test
- *
- * @since 2.7.6
- */
-public class AnnotationUtilsTest extends AbstractAnnotationProcessingTest {
-
- private TypeElement testType;
-
- @Override
- protected void addCompiledClasses(Set<Class<?>> classesToBeCompiled) {
- }
-
- @Override
- protected void beforeEach() {
- testType = getType(TestServiceImpl.class);
- }
-
- @Test
- public void testGetAnnotation() {
- AnnotationMirror serviceAnnotation = getAnnotation(testType, Service.class);
- assertEquals("3.0.0", getAttribute(serviceAnnotation, "version"));
- assertEquals("test", getAttribute(serviceAnnotation, "group"));
- assertEquals("org.apache.dubbo.metadata.tools.TestService", getAttribute(serviceAnnotation, "interfaceName"));
-
- assertNull(getAnnotation(testType, (Class) null));
- assertNull(getAnnotation(testType, (String) null));
-
- assertNull(getAnnotation(testType.asType(), (Class) null));
- assertNull(getAnnotation(testType.asType(), (String) null));
-
- assertNull(getAnnotation((Element) null, (Class) null));
- assertNull(getAnnotation((Element) null, (String) null));
-
- assertNull(getAnnotation((TypeElement) null, (Class) null));
- assertNull(getAnnotation((TypeElement) null, (String) null));
- }
-
- @Test
- public void testGetAnnotations() {
- List<AnnotationMirror> annotations = getAnnotations(testType);
- Iterator<AnnotationMirror> iterator = annotations.iterator();
-
- assertEquals(2, annotations.size());
- assertEquals("com.alibaba.dubbo.config.annotation.Service", iterator.next().getAnnotationType().toString());
- assertEquals("org.apache.dubbo.config.annotation.Service", iterator.next().getAnnotationType().toString());
-
- annotations = getAnnotations(testType, Service.class);
- iterator = annotations.iterator();
- assertEquals(1, annotations.size());
- assertEquals("org.apache.dubbo.config.annotation.Service", iterator.next().getAnnotationType().toString());
-
- annotations = getAnnotations(testType.asType(), Service.class);
- iterator = annotations.iterator();
- assertEquals(1, annotations.size());
- assertEquals("org.apache.dubbo.config.annotation.Service", iterator.next().getAnnotationType().toString());
-
- annotations = getAnnotations(testType.asType(), Service.class.getTypeName());
- iterator = annotations.iterator();
- assertEquals(1, annotations.size());
- assertEquals("org.apache.dubbo.config.annotation.Service", iterator.next().getAnnotationType().toString());
-
- annotations = getAnnotations(testType, Override.class);
- assertEquals(0, annotations.size());
-
- annotations = getAnnotations(testType, com.alibaba.dubbo.config.annotation.Service.class);
- assertEquals(1, annotations.size());
-
- assertTrue(getAnnotations(null, (Class) null).isEmpty());
- assertTrue(getAnnotations(null, (String) null).isEmpty());
- assertTrue(getAnnotations(testType, (Class) null).isEmpty());
- assertTrue(getAnnotations(testType, (String) null).isEmpty());
-
- assertTrue(getAnnotations(null, Service.class).isEmpty());
- assertTrue(getAnnotations(null, Service.class.getTypeName()).isEmpty());
- }
-
- @Test
- public void testGetAllAnnotations() {
-
- List<AnnotationMirror> annotations = getAllAnnotations(testType);
- assertEquals(5, annotations.size());
-
- annotations = getAllAnnotations(testType.asType(), annotation -> true);
- assertEquals(5, annotations.size());
-
- annotations = getAllAnnotations(processingEnv, TestServiceImpl.class);
- assertEquals(5, annotations.size());
-
- annotations = getAllAnnotations(testType.asType(), Service.class);
- assertEquals(2, annotations.size());
-
- annotations = getAllAnnotations(testType, Override.class);
- assertEquals(0, annotations.size());
-
- annotations = getAllAnnotations(testType.asType(), com.alibaba.dubbo.config.annotation.Service.class);
- assertEquals(2, annotations.size());
-
- assertTrue(getAllAnnotations((Element) null, (Class) null).isEmpty());
- assertTrue(getAllAnnotations((TypeMirror) null, (String) null).isEmpty());
- assertTrue(getAllAnnotations((ProcessingEnvironment) null, (Class) null).isEmpty());
- assertTrue(getAllAnnotations((ProcessingEnvironment) null, (String) null).isEmpty());
-
- assertTrue(getAllAnnotations((Element) null).isEmpty());
- assertTrue(getAllAnnotations((TypeMirror) null).isEmpty());
- assertTrue(getAllAnnotations(processingEnv, (Class) null).isEmpty());
- assertTrue(getAllAnnotations(processingEnv, (String) null).isEmpty());
-
-
- assertTrue(getAllAnnotations(testType, (Class) null).isEmpty());
- assertTrue(getAllAnnotations(testType.asType(), (Class) null).isEmpty());
-
- assertTrue(getAllAnnotations(testType, (String) null).isEmpty());
- assertTrue(getAllAnnotations(testType.asType(), (String) null).isEmpty());
-
- assertTrue(getAllAnnotations((Element) null, Service.class).isEmpty());
- assertTrue(getAllAnnotations((TypeMirror) null, Service.class.getTypeName()).isEmpty());
- }
-
-
- @Test
- public void testFindAnnotation() {
-
- assertEquals("org.apache.dubbo.config.annotation.Service", findAnnotation(testType, Service.class).getAnnotationType().toString());
- assertEquals("com.alibaba.dubbo.config.annotation.Service", findAnnotation(testType, com.alibaba.dubbo.config.annotation.Service.class).getAnnotationType().toString());
- assertEquals("javax.ws.rs.Path", findAnnotation(testType, Path.class).getAnnotationType().toString());
- assertEquals("javax.ws.rs.Path", findAnnotation(testType.asType(), Path.class).getAnnotationType().toString());
- assertEquals("javax.ws.rs.Path", findAnnotation(testType.asType(), Path.class.getTypeName()).getAnnotationType().toString());
- assertNull(findAnnotation(testType, Override.class));
-
- assertNull(findAnnotation((Element) null, (Class) null));
- assertNull(findAnnotation((Element) null, (String) null));
- assertNull(findAnnotation((TypeMirror) null, (Class) null));
- assertNull(findAnnotation((TypeMirror) null, (String) null));
-
- assertNull(findAnnotation(testType, (Class) null));
- assertNull(findAnnotation(testType, (String) null));
- assertNull(findAnnotation(testType.asType(), (Class) null));
- assertNull(findAnnotation(testType.asType(), (String) null));
- }
-
- @Test
- public void testFindMetaAnnotation() {
- getAllDeclaredMethods(getType(TestService.class)).forEach(method -> {
- assertEquals("javax.ws.rs.HttpMethod", findMetaAnnotation(method, "javax.ws.rs.HttpMethod").getAnnotationType().toString());
- });
- }
-
- @Test
- public void testGetAttribute() {
- assertEquals("org.apache.dubbo.metadata.tools.TestService", getAttribute(findAnnotation(testType, Service.class), "interfaceName"));
- assertEquals("org.apache.dubbo.metadata.tools.TestService", getAttribute(findAnnotation(testType, Service.class).getElementValues(), "interfaceName"));
- assertEquals("/echo", getAttribute(findAnnotation(testType, Path.class), "value"));
-
- assertNull(getAttribute(findAnnotation(testType, Path.class), null));
- assertNull(getAttribute(findAnnotation(testType, (Class) null), null));
-
- ExecutableElement method = findMethod(getType(SpringRestService.class), "param", String.class);
-
- AnnotationMirror annotation = findAnnotation(method, GetMapping.class);
-
- assertArrayEquals(new String[]{"/param"}, (String[]) getAttribute(annotation, "value"));
- assertNull(getAttribute(annotation, "path"));
- }
-
- @Test
- public void testGetValue() {
- AnnotationMirror pathAnnotation = getAnnotation(getType(TestService.class), Path.class);
- assertEquals("/echo", getValue(pathAnnotation));
- }
-
- @Test
- public void testIsAnnotationPresent() {
- assertTrue(isAnnotationPresent(testType, "org.apache.dubbo.config.annotation.Service"));
- assertTrue(isAnnotationPresent(testType, "com.alibaba.dubbo.config.annotation.Service"));
- assertTrue(isAnnotationPresent(testType, "javax.ws.rs.Path"));
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/FieldUtilsTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/FieldUtilsTest.java
deleted file mode 100644
index 3afc647..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/FieldUtilsTest.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * 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.metadata.annotation.processing.util;
-
-import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.annotation.processing.model.Color;
-import org.apache.dubbo.metadata.annotation.processing.model.Model;
-import org.apache.dubbo.metadata.tools.TestServiceImpl;
-
-import org.junit.jupiter.api.Test;
-
-import javax.lang.model.element.Element;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import javax.lang.model.type.TypeMirror;
-import java.lang.reflect.Type;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import static javax.lang.model.element.Modifier.FINAL;
-import static javax.lang.model.element.Modifier.PRIVATE;
-import static javax.lang.model.element.Modifier.PUBLIC;
-import static javax.lang.model.element.Modifier.STATIC;
-import static org.apache.dubbo.metadata.annotation.processing.util.FieldUtils.findField;
-import static org.apache.dubbo.metadata.annotation.processing.util.FieldUtils.getAllDeclaredFields;
-import static org.apache.dubbo.metadata.annotation.processing.util.FieldUtils.getAllNonStaticFields;
-import static org.apache.dubbo.metadata.annotation.processing.util.FieldUtils.getDeclaredField;
-import static org.apache.dubbo.metadata.annotation.processing.util.FieldUtils.getDeclaredFields;
-import static org.apache.dubbo.metadata.annotation.processing.util.FieldUtils.getNonStaticFields;
-import static org.apache.dubbo.metadata.annotation.processing.util.FieldUtils.isEnumMemberField;
-import static org.apache.dubbo.metadata.annotation.processing.util.FieldUtils.isField;
-import static org.apache.dubbo.metadata.annotation.processing.util.FieldUtils.isNonStaticField;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * {@link FieldUtils} Test
- *
- * @since 2.7.6
- */
-public class FieldUtilsTest extends AbstractAnnotationProcessingTest {
-
- private TypeElement testType;
-
- @Override
- protected void addCompiledClasses(Set<Class<?>> classesToBeCompiled) {
- }
-
- @Override
- protected void beforeEach() {
- testType = getType(TestServiceImpl.class);
- }
-
- @Test
- public void testGetDeclaredFields() {
- TypeElement type = getType(Model.class);
- List<VariableElement> fields = getDeclaredFields(type);
- assertModelFields(fields);
-
- fields = getDeclaredFields(type.asType());
- assertModelFields(fields);
-
- assertTrue(getDeclaredFields((Element) null).isEmpty());
- assertTrue(getDeclaredFields((TypeMirror) null).isEmpty());
-
- fields = getDeclaredFields(type, f -> "f".equals(f.getSimpleName().toString()));
- assertEquals(1, fields.size());
- assertEquals("f", fields.get(0).getSimpleName().toString());
- }
-
- @Test
- public void testGetAllDeclaredFields() {
- TypeElement type = getType(Model.class);
-
- List<VariableElement> fields = getAllDeclaredFields(type);
-
- assertModelAllFields(fields);
-
- assertTrue(getAllDeclaredFields((Element) null).isEmpty());
- assertTrue(getAllDeclaredFields((TypeMirror) null).isEmpty());
-
- fields = getAllDeclaredFields(type, f -> "f".equals(f.getSimpleName().toString()));
- assertEquals(1, fields.size());
- assertEquals("f", fields.get(0).getSimpleName().toString());
- }
-
- @Test
- public void testGetDeclaredField() {
- TypeElement type = getType(Model.class);
- testGetDeclaredField(type, "f", float.class);
- testGetDeclaredField(type, "d", double.class);
- testGetDeclaredField(type, "tu", TimeUnit.class);
- testGetDeclaredField(type, "str", String.class);
- testGetDeclaredField(type, "bi", BigInteger.class);
- testGetDeclaredField(type, "bd", BigDecimal.class);
-
- assertNull(getDeclaredField(type, "b"));
- assertNull(getDeclaredField(type, "s"));
- assertNull(getDeclaredField(type, "i"));
- assertNull(getDeclaredField(type, "l"));
- assertNull(getDeclaredField(type, "z"));
-
- assertNull(getDeclaredField((Element) null, "z"));
- assertNull(getDeclaredField((TypeMirror) null, "z"));
- }
-
- @Test
- public void testFindField() {
- TypeElement type = getType(Model.class);
- testFindField(type, "f", float.class);
- testFindField(type, "d", double.class);
- testFindField(type, "tu", TimeUnit.class);
- testFindField(type, "str", String.class);
- testFindField(type, "bi", BigInteger.class);
- testFindField(type, "bd", BigDecimal.class);
- testFindField(type, "b", byte.class);
- testFindField(type, "s", short.class);
- testFindField(type, "i", int.class);
- testFindField(type, "l", long.class);
- testFindField(type, "z", boolean.class);
-
- assertNull(findField((Element) null, "f"));
- assertNull(findField((Element) null, null));
-
- assertNull(findField((TypeMirror) null, "f"));
- assertNull(findField((TypeMirror) null, null));
-
- assertNull(findField(type, null));
- assertNull(findField(type.asType(), null));
- }
-
- @Test
- public void testIsEnumField() {
- TypeElement type = getType(Color.class);
- VariableElement field = findField(type, "RED");
- assertTrue(isEnumMemberField(field));
-
- field = findField(type, "YELLOW");
- assertTrue(isEnumMemberField(field));
-
- field = findField(type, "BLUE");
- assertTrue(isEnumMemberField(field));
-
- type = getType(Model.class);
- field = findField(type, "f");
- assertFalse(isEnumMemberField(field));
-
- assertFalse(isEnumMemberField(null));
- }
-
- @Test
- public void testIsNonStaticField() {
- TypeElement type = getType(Model.class);
- assertTrue(isNonStaticField(findField(type, "f")));
-
- type = getType(Color.class);
- assertFalse(isNonStaticField(findField(type, "BLUE")));
- }
-
- @Test
- public void testIsField() {
- TypeElement type = getType(Model.class);
- assertTrue(isField(findField(type, "f")));
- assertTrue(isField(findField(type, "f"), PRIVATE));
-
- type = getType(Color.class);
- assertTrue(isField(findField(type, "BLUE"), PUBLIC, STATIC, FINAL));
-
-
- assertFalse(isField(null));
- assertFalse(isField(null, PUBLIC, STATIC, FINAL));
- }
-
- @Test
- public void testGetNonStaticFields() {
- TypeElement type = getType(Model.class);
-
- List<VariableElement> fields = getNonStaticFields(type);
- assertModelFields(fields);
-
- fields = getNonStaticFields(type.asType());
- assertModelFields(fields);
-
- assertTrue(getAllNonStaticFields((Element) null).isEmpty());
- assertTrue(getAllNonStaticFields((TypeMirror) null).isEmpty());
- }
-
- @Test
- public void testGetAllNonStaticFields() {
- TypeElement type = getType(Model.class);
-
- List<VariableElement> fields = getAllNonStaticFields(type);
- assertModelAllFields(fields);
-
- fields = getAllNonStaticFields(type.asType());
- assertModelAllFields(fields);
-
- assertTrue(getAllNonStaticFields((Element) null).isEmpty());
- assertTrue(getAllNonStaticFields((TypeMirror) null).isEmpty());
- }
-
- private void assertModelFields(List<VariableElement> fields) {
- assertEquals(6, fields.size());
- assertEquals("d", fields.get(1).getSimpleName().toString());
- assertEquals("tu", fields.get(2).getSimpleName().toString());
- assertEquals("str", fields.get(3).getSimpleName().toString());
- assertEquals("bi", fields.get(4).getSimpleName().toString());
- assertEquals("bd", fields.get(5).getSimpleName().toString());
- }
-
- private void assertModelAllFields(List<VariableElement> fields) {
- assertEquals(11, fields.size());
- assertEquals("f", fields.get(0).getSimpleName().toString());
- assertEquals("d", fields.get(1).getSimpleName().toString());
- assertEquals("tu", fields.get(2).getSimpleName().toString());
- assertEquals("str", fields.get(3).getSimpleName().toString());
- assertEquals("bi", fields.get(4).getSimpleName().toString());
- assertEquals("bd", fields.get(5).getSimpleName().toString());
- assertEquals("b", fields.get(6).getSimpleName().toString());
- assertEquals("s", fields.get(7).getSimpleName().toString());
- assertEquals("i", fields.get(8).getSimpleName().toString());
- assertEquals("l", fields.get(9).getSimpleName().toString());
- assertEquals("z", fields.get(10).getSimpleName().toString());
- }
-
- private void testGetDeclaredField(TypeElement type, String fieldName, Type fieldType) {
- VariableElement field = getDeclaredField(type, fieldName);
- assertField(field, fieldName, fieldType);
- }
-
- private void testFindField(TypeElement type, String fieldName, Type fieldType) {
- VariableElement field = findField(type, fieldName);
- assertField(field, fieldName, fieldType);
- }
-
- private void assertField(VariableElement field, String fieldName, Type fieldType) {
- assertEquals(fieldName, field.getSimpleName().toString());
- assertEquals(fieldType.getTypeName(), field.asType().toString());
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/LoggerUtilsTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/LoggerUtilsTest.java
deleted file mode 100644
index 4a06b21..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/LoggerUtilsTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.metadata.annotation.processing.util;
-
-import org.junit.jupiter.api.Test;
-
-import static org.apache.dubbo.metadata.annotation.processing.util.LoggerUtils.info;
-import static org.apache.dubbo.metadata.annotation.processing.util.LoggerUtils.warn;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-
-/**
- * {@link LoggerUtils} Test
- *
- * @since 2.7.6
- */
-public class LoggerUtilsTest {
-
- @Test
- public void testLogger() {
- assertNotNull(LoggerUtils.LOGGER);
- }
-
- @Test
- public void testInfo() {
- info("Hello,World");
- info("Hello,%s", "World");
- info("%s,%s", "Hello", "World");
- }
-
- @Test
- public void testWarn() {
- warn("Hello,World");
- warn("Hello,%s", "World");
- warn("%s,%s", "Hello", "World");
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/MemberUtilsTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/MemberUtilsTest.java
deleted file mode 100644
index e119f00..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/MemberUtilsTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.metadata.annotation.processing.util;
-
-import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.annotation.processing.model.Model;
-import org.apache.dubbo.metadata.tools.TestServiceImpl;
-
-import org.junit.jupiter.api.Test;
-
-import javax.lang.model.element.Element;
-import javax.lang.model.element.ExecutableElement;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import java.util.List;
-import java.util.Set;
-
-import static javax.lang.model.element.Modifier.PRIVATE;
-import static javax.lang.model.util.ElementFilter.fieldsIn;
-import static javax.lang.model.util.ElementFilter.methodsIn;
-import static org.apache.dubbo.metadata.annotation.processing.util.MemberUtils.getAllDeclaredMembers;
-import static org.apache.dubbo.metadata.annotation.processing.util.MemberUtils.getDeclaredMembers;
-import static org.apache.dubbo.metadata.annotation.processing.util.MemberUtils.hasModifiers;
-import static org.apache.dubbo.metadata.annotation.processing.util.MemberUtils.isPublicNonStatic;
-import static org.apache.dubbo.metadata.annotation.processing.util.MemberUtils.matchParameterTypes;
-import static org.apache.dubbo.metadata.annotation.processing.util.MethodUtils.findMethod;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * {@link MemberUtils} Test
- *
- * @since 2.7.6
- */
-public class MemberUtilsTest extends AbstractAnnotationProcessingTest {
-
- private TypeElement testType;
-
- @Override
- protected void addCompiledClasses(Set<Class<?>> classesToBeCompiled) {
- }
-
- @Override
- protected void beforeEach() {
- testType = getType(TestServiceImpl.class);
- }
-
- @Test
- public void testIsPublicNonStatic() {
- assertFalse(isPublicNonStatic(null));
- methodsIn(getDeclaredMembers(testType.asType())).forEach(method -> assertTrue(isPublicNonStatic(method)));
- }
-
- @Test
- public void testHasModifiers() {
- assertFalse(hasModifiers(null));
- List<? extends Element> members = getAllDeclaredMembers(testType.asType());
- List<VariableElement> fields = fieldsIn(members);
- assertTrue(hasModifiers(fields.get(0), PRIVATE));
- }
-
- @Test
- public void testDeclaredMembers() {
- TypeElement type = getType(Model.class);
- List<? extends Element> members = getDeclaredMembers(type.asType());
- List<VariableElement> fields = fieldsIn(members);
- assertEquals(19, members.size());
- assertEquals(6, fields.size());
- assertEquals("f", fields.get(0).getSimpleName().toString());
- assertEquals("d", fields.get(1).getSimpleName().toString());
- assertEquals("tu", fields.get(2).getSimpleName().toString());
- assertEquals("str", fields.get(3).getSimpleName().toString());
- assertEquals("bi", fields.get(4).getSimpleName().toString());
- assertEquals("bd", fields.get(5).getSimpleName().toString());
-
- members = getAllDeclaredMembers(type.asType());
- fields = fieldsIn(members);
- assertEquals(11, fields.size());
- assertEquals("f", fields.get(0).getSimpleName().toString());
- assertEquals("d", fields.get(1).getSimpleName().toString());
- assertEquals("tu", fields.get(2).getSimpleName().toString());
- assertEquals("str", fields.get(3).getSimpleName().toString());
- assertEquals("bi", fields.get(4).getSimpleName().toString());
- assertEquals("bd", fields.get(5).getSimpleName().toString());
- assertEquals("b", fields.get(6).getSimpleName().toString());
- assertEquals("s", fields.get(7).getSimpleName().toString());
- assertEquals("i", fields.get(8).getSimpleName().toString());
- assertEquals("l", fields.get(9).getSimpleName().toString());
- assertEquals("z", fields.get(10).getSimpleName().toString());
- }
-
- @Test
- public void testMatchParameterTypes() {
- ExecutableElement method = findMethod(testType, "echo", "java.lang.String");
- assertTrue(matchParameterTypes(method.getParameters(), "java.lang.String"));
- assertFalse(matchParameterTypes(method.getParameters(), "java.lang.Object"));
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/MethodUtilsTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/MethodUtilsTest.java
deleted file mode 100644
index 2e9c07c..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/MethodUtilsTest.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * 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.metadata.annotation.processing.util;
-
-import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.annotation.processing.model.Model;
-import org.apache.dubbo.metadata.tools.TestService;
-import org.apache.dubbo.metadata.tools.TestServiceImpl;
-
-import org.junit.jupiter.api.Test;
-
-import javax.lang.model.element.ExecutableElement;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.type.TypeMirror;
-import java.util.List;
-import java.util.Set;
-
-import static org.apache.dubbo.metadata.annotation.processing.util.MethodUtils.findMethod;
-import static org.apache.dubbo.metadata.annotation.processing.util.MethodUtils.getAllDeclaredMethods;
-import static org.apache.dubbo.metadata.annotation.processing.util.MethodUtils.getDeclaredMethods;
-import static org.apache.dubbo.metadata.annotation.processing.util.MethodUtils.getMethodName;
-import static org.apache.dubbo.metadata.annotation.processing.util.MethodUtils.getMethodParameterTypes;
-import static org.apache.dubbo.metadata.annotation.processing.util.MethodUtils.getOverrideMethod;
-import static org.apache.dubbo.metadata.annotation.processing.util.MethodUtils.getPublicNonStaticMethods;
-import static org.apache.dubbo.metadata.annotation.processing.util.MethodUtils.getReturnType;
-import static org.junit.jupiter.api.Assertions.assertArrayEquals;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * {@link MethodUtils} Test
- *
- * @since 2.7.6
- */
-public class MethodUtilsTest extends AbstractAnnotationProcessingTest {
-
- private TypeElement testType;
-
- @Override
- protected void addCompiledClasses(Set<Class<?>> classesToBeCompiled) {
- }
-
- @Override
- protected void beforeEach() {
- testType = getType(TestServiceImpl.class);
- }
-
- @Test
- public void testDeclaredMethods() {
- TypeElement type = getType(Model.class);
- List<ExecutableElement> methods = getDeclaredMethods(type);
- assertEquals(12, methods.size());
-
- methods = getAllDeclaredMethods(type);
- assertEquals(34, methods.size());
-
- assertTrue(getAllDeclaredMethods((TypeElement) null).isEmpty());
- assertTrue(getAllDeclaredMethods((TypeMirror) null).isEmpty());
- }
-
- private List<? extends ExecutableElement> doGetAllDeclaredMethods() {
- return getAllDeclaredMethods(testType, Object.class);
- }
-
- @Test
- public void testGetAllDeclaredMethods() {
- List<? extends ExecutableElement> methods = doGetAllDeclaredMethods();
- assertEquals(14, methods.size());
- }
-
- @Test
- public void testGetPublicNonStaticMethods() {
- List<? extends ExecutableElement> methods = getPublicNonStaticMethods(testType, Object.class);
- assertEquals(14, methods.size());
-
- methods = getPublicNonStaticMethods(testType.asType(), Object.class);
- assertEquals(14, methods.size());
- }
-
- @Test
- public void testIsMethod() {
- List<? extends ExecutableElement> methods = getPublicNonStaticMethods(testType, Object.class);
- assertEquals(14, methods.stream().map(MethodUtils::isMethod).count());
- }
-
- @Test
- public void testIsPublicNonStaticMethod() {
- List<? extends ExecutableElement> methods = getPublicNonStaticMethods(testType, Object.class);
- assertEquals(14, methods.stream().map(MethodUtils::isPublicNonStaticMethod).count());
- }
-
- @Test
- public void testFindMethod() {
- TypeElement type = getType(Model.class);
- // Test methods from java.lang.Object
- // Object#toString()
- String methodName = "toString";
- ExecutableElement method = findMethod(type.asType(), methodName);
- assertEquals(method.getSimpleName().toString(), methodName);
-
- // Object#hashCode()
- methodName = "hashCode";
- method = findMethod(type.asType(), methodName);
- assertEquals(method.getSimpleName().toString(), methodName);
-
- // Object#getClass()
- methodName = "getClass";
- method = findMethod(type.asType(), methodName);
- assertEquals(method.getSimpleName().toString(), methodName);
-
- // Object#finalize()
- methodName = "finalize";
- method = findMethod(type.asType(), methodName);
- assertEquals(method.getSimpleName().toString(), methodName);
-
- // Object#clone()
- methodName = "clone";
- method = findMethod(type.asType(), methodName);
- assertEquals(method.getSimpleName().toString(), methodName);
-
- // Object#notify()
- methodName = "notify";
- method = findMethod(type.asType(), methodName);
- assertEquals(method.getSimpleName().toString(), methodName);
-
- // Object#notifyAll()
- methodName = "notifyAll";
- method = findMethod(type.asType(), methodName);
- assertEquals(method.getSimpleName().toString(), methodName);
-
- // Object#wait(long)
- methodName = "wait";
- method = findMethod(type.asType(), methodName, long.class);
- assertEquals(method.getSimpleName().toString(), methodName);
-
- // Object#wait(long,int)
- methodName = "wait";
- method = findMethod(type.asType(), methodName, long.class, int.class);
- assertEquals(method.getSimpleName().toString(), methodName);
-
- // Object#equals(Object)
- methodName = "equals";
- method = findMethod(type.asType(), methodName, Object.class);
- assertEquals(method.getSimpleName().toString(), methodName);
- }
-
- @Test
- public void testGetOverrideMethod() {
- List<? extends ExecutableElement> methods = doGetAllDeclaredMethods();
-
- ExecutableElement overrideMethod = getOverrideMethod(processingEnv, testType, methods.get(0));
- assertNull(overrideMethod);
-
- ExecutableElement declaringMethod = findMethod(getType(TestService.class), "echo", "java.lang.String");
-
- overrideMethod = getOverrideMethod(processingEnv, testType, declaringMethod);
- assertEquals(methods.get(0), overrideMethod);
- }
-
- @Test
- public void testGetMethodName() {
- ExecutableElement method = findMethod(testType, "echo", "java.lang.String");
- assertEquals("echo", getMethodName(method));
- assertNull(getMethodName(null));
- }
-
- @Test
- public void testReturnType() {
- ExecutableElement method = findMethod(testType, "echo", "java.lang.String");
- assertEquals("java.lang.String", getReturnType(method));
- assertNull(getReturnType(null));
- }
-
- @Test
- public void testMatchParameterTypes() {
- ExecutableElement method = findMethod(testType, "echo", "java.lang.String");
- assertArrayEquals(new String[]{"java.lang.String"}, getMethodParameterTypes(method));
- assertTrue(getMethodParameterTypes(null).length == 0);
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/ServiceAnnotationUtilsTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/ServiceAnnotationUtilsTest.java
deleted file mode 100644
index 9d18ddf..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/ServiceAnnotationUtilsTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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.metadata.annotation.processing.util;
-
-import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.tools.DefaultTestService;
-import org.apache.dubbo.metadata.tools.GenericTestService;
-import org.apache.dubbo.metadata.tools.TestService;
-import org.apache.dubbo.metadata.tools.TestServiceImpl;
-
-import org.junit.jupiter.api.Test;
-
-import javax.lang.model.element.TypeElement;
-import java.util.HashSet;
-import java.util.Set;
-
-import static java.util.Arrays.asList;
-import static org.apache.dubbo.metadata.annotation.processing.util.ServiceAnnotationUtils.GROUP_ATTRIBUTE_NAME;
-import static org.apache.dubbo.metadata.annotation.processing.util.ServiceAnnotationUtils.INTERFACE_CLASS_ATTRIBUTE_NAME;
-import static org.apache.dubbo.metadata.annotation.processing.util.ServiceAnnotationUtils.INTERFACE_NAME_ATTRIBUTE_NAME;
-import static org.apache.dubbo.metadata.annotation.processing.util.ServiceAnnotationUtils.LEGACY_SERVICE_ANNOTATION_TYPE;
-import static org.apache.dubbo.metadata.annotation.processing.util.ServiceAnnotationUtils.SERVICE_ANNOTATION_TYPE;
-import static org.apache.dubbo.metadata.annotation.processing.util.ServiceAnnotationUtils.SUPPORTED_ANNOTATION_TYPES;
-import static org.apache.dubbo.metadata.annotation.processing.util.ServiceAnnotationUtils.VERSION_ATTRIBUTE_NAME;
-import static org.apache.dubbo.metadata.annotation.processing.util.ServiceAnnotationUtils.getAnnotation;
-import static org.apache.dubbo.metadata.annotation.processing.util.ServiceAnnotationUtils.getGroup;
-import static org.apache.dubbo.metadata.annotation.processing.util.ServiceAnnotationUtils.getVersion;
-import static org.apache.dubbo.metadata.annotation.processing.util.ServiceAnnotationUtils.isServiceAnnotationPresent;
-import static org.apache.dubbo.metadata.annotation.processing.util.ServiceAnnotationUtils.resolveServiceInterfaceName;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * {@link ServiceAnnotationUtils} Test
- *
- * @since 2.7.6
- */
-public class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest {
-
- @Override
- protected void addCompiledClasses(Set<Class<?>> classesToBeCompiled) {
-
- }
-
- @Override
- protected void beforeEach() {
-
- }
-
- @Test
- public void testConstants() {
- assertEquals("org.apache.dubbo.config.annotation.Service", SERVICE_ANNOTATION_TYPE);
- assertEquals("com.alibaba.dubbo.config.annotation.Service", LEGACY_SERVICE_ANNOTATION_TYPE);
- assertEquals("interfaceClass", INTERFACE_CLASS_ATTRIBUTE_NAME);
- assertEquals("interfaceName", INTERFACE_NAME_ATTRIBUTE_NAME);
- assertEquals("group", GROUP_ATTRIBUTE_NAME);
- assertEquals("version", VERSION_ATTRIBUTE_NAME);
- assertEquals(new HashSet(asList("org.apache.dubbo.config.annotation.Service", "com.alibaba.dubbo.config.annotation.Service")), SUPPORTED_ANNOTATION_TYPES);
- }
-
- @Test
- public void testIsServiceAnnotationPresent() {
-
- assertTrue(isServiceAnnotationPresent(getType(TestServiceImpl.class)));
- assertTrue(isServiceAnnotationPresent(getType(GenericTestService.class)));
- assertTrue(isServiceAnnotationPresent(getType(DefaultTestService.class)));
-
- assertFalse(isServiceAnnotationPresent(getType(TestService.class)));
- }
-
- @Test
- public void testGetAnnotation() {
- TypeElement type = getType(TestServiceImpl.class);
- assertEquals("org.apache.dubbo.config.annotation.Service", getAnnotation(type).getAnnotationType().toString());
-
- type = getType(GenericTestService.class);
- assertEquals("com.alibaba.dubbo.config.annotation.Service", getAnnotation(type).getAnnotationType().toString());
-
- type = getType(DefaultTestService.class);
- assertEquals("org.apache.dubbo.config.annotation.Service", getAnnotation(type).getAnnotationType().toString());
-
- assertThrows(IllegalArgumentException.class, () -> getAnnotation(getType(TestService.class)));
- }
-
- @Test
- public void testResolveServiceInterfaceName() {
- TypeElement type = getType(TestServiceImpl.class);
- assertEquals("org.apache.dubbo.metadata.tools.TestService", resolveServiceInterfaceName(type, getAnnotation(type)));
-
- type = getType(GenericTestService.class);
- assertEquals("org.apache.dubbo.metadata.tools.TestService", resolveServiceInterfaceName(type, getAnnotation(type)));
-
- type = getType(DefaultTestService.class);
- assertEquals("org.apache.dubbo.metadata.tools.TestService", resolveServiceInterfaceName(type, getAnnotation(type)));
- }
-
- @Test
- public void testGetVersion() {
- TypeElement type = getType(TestServiceImpl.class);
- assertEquals("3.0.0", getVersion(getAnnotation(type)));
-
- type = getType(GenericTestService.class);
- assertEquals("2.0.0", getVersion(getAnnotation(type)));
-
- type = getType(DefaultTestService.class);
- assertEquals("1.0.0", getVersion(getAnnotation(type)));
- }
-
- @Test
- public void testGetGroup() {
- TypeElement type = getType(TestServiceImpl.class);
- assertEquals("test",getGroup(getAnnotation(type)));
-
- type = getType(GenericTestService.class);
- assertEquals("generic", getGroup(getAnnotation(type)));
-
- type = getType(DefaultTestService.class);
- assertEquals("default", getGroup(getAnnotation(type)));
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/TypeUtilsTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/TypeUtilsTest.java
deleted file mode 100644
index 55d866e..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/annotation/processing/util/TypeUtilsTest.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * 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.metadata.annotation.processing.util;
-
-import org.apache.dubbo.metadata.annotation.processing.AbstractAnnotationProcessingTest;
-import org.apache.dubbo.metadata.annotation.processing.model.ArrayTypeModel;
-import org.apache.dubbo.metadata.annotation.processing.model.Color;
-import org.apache.dubbo.metadata.annotation.processing.model.Model;
-import org.apache.dubbo.metadata.annotation.processing.model.PrimitiveTypeModel;
-import org.apache.dubbo.metadata.tools.DefaultTestService;
-import org.apache.dubbo.metadata.tools.GenericTestService;
-import org.apache.dubbo.metadata.tools.TestServiceImpl;
-
-import org.junit.jupiter.api.Test;
-
-import javax.lang.model.element.Element;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import javax.lang.model.type.DeclaredType;
-import javax.lang.model.type.TypeKind;
-import javax.lang.model.type.TypeMirror;
-import java.io.File;
-import java.lang.reflect.Type;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import static java.util.Arrays.asList;
-import static org.apache.dubbo.metadata.annotation.processing.util.FieldUtils.findField;
-import static org.apache.dubbo.metadata.annotation.processing.util.FieldUtils.getDeclaredFields;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.getAllInterfaces;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.getAllSuperTypes;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.getHierarchicalTypes;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.getInterfaces;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.getResource;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.getResourceName;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.getSuperType;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.isAnnotationType;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.isArrayType;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.isClassType;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.isDeclaredType;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.isEnumType;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.isInterfaceType;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.isPrimitiveType;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.isSameType;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.isSimpleType;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.isTypeElement;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.listDeclaredTypes;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.listTypeElements;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.ofDeclaredType;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.ofDeclaredTypes;
-import static org.apache.dubbo.metadata.annotation.processing.util.TypeUtils.ofTypeElement;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * The {@link TypeUtils} Test
- *
- * @since 2.7.6
- */
-public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
-
- private TypeElement testType;
-
- @Override
- protected void addCompiledClasses(Set<Class<?>> classesToBeCompiled) {
- classesToBeCompiled.add(ArrayTypeModel.class);
- classesToBeCompiled.add(Color.class);
- }
-
- @Override
- protected void beforeEach() {
- testType = getType(TestServiceImpl.class);
- }
-
- @Test
- public void testIsSimpleType() {
-
- assertTrue(isSimpleType(getType(Void.class)));
- assertTrue(isSimpleType(getType(Boolean.class)));
- assertTrue(isSimpleType(getType(Character.class)));
- assertTrue(isSimpleType(getType(Byte.class)));
- assertTrue(isSimpleType(getType(Short.class)));
- assertTrue(isSimpleType(getType(Integer.class)));
- assertTrue(isSimpleType(getType(Long.class)));
- assertTrue(isSimpleType(getType(Float.class)));
- assertTrue(isSimpleType(getType(Double.class)));
- assertTrue(isSimpleType(getType(String.class)));
- assertTrue(isSimpleType(getType(BigDecimal.class)));
- assertTrue(isSimpleType(getType(BigInteger.class)));
- assertTrue(isSimpleType(getType(Date.class)));
- assertTrue(isSimpleType(getType(Object.class)));
-
- assertFalse(isSimpleType(getType(getClass())));
- assertFalse(isSimpleType((TypeElement) null));
- assertFalse(isSimpleType((TypeMirror) null));
- }
-
- @Test
- public void testIsSameType() {
- assertTrue(isSameType(getType(Void.class).asType(), "java.lang.Void"));
- assertFalse(isSameType(getType(String.class).asType(), "java.lang.Void"));
-
- assertFalse(isSameType(getType(Void.class).asType(), (Type) null));
- assertFalse(isSameType(null, (Type) null));
-
- assertFalse(isSameType(getType(Void.class).asType(), (String) null));
- assertFalse(isSameType(null, (String) null));
- }
-
- @Test
- public void testIsArrayType() {
- TypeElement type = getType(ArrayTypeModel.class);
- assertTrue(isArrayType(findField(type.asType(), "integers").asType()));
- assertTrue(isArrayType(findField(type.asType(), "strings").asType()));
- assertTrue(isArrayType(findField(type.asType(), "primitiveTypeModels").asType()));
- assertTrue(isArrayType(findField(type.asType(), "models").asType()));
- assertTrue(isArrayType(findField(type.asType(), "colors").asType()));
-
- assertFalse(isArrayType((Element) null));
- assertFalse(isArrayType((TypeMirror) null));
- }
-
- @Test
- public void testIsEnumType() {
- TypeElement type = getType(Color.class);
- assertTrue(isEnumType(type.asType()));
-
- type = getType(ArrayTypeModel.class);
- assertFalse(isEnumType(type.asType()));
-
- assertFalse(isEnumType((Element) null));
- assertFalse(isEnumType((TypeMirror) null));
- }
-
- @Test
- public void testIsClassType() {
- TypeElement type = getType(ArrayTypeModel.class);
- assertTrue(isClassType(type.asType()));
-
- type = getType(Model.class);
- assertTrue(isClassType(type.asType()));
-
- assertFalse(isClassType((Element) null));
- assertFalse(isClassType((TypeMirror) null));
- }
-
- @Test
- public void testIsPrimitiveType() {
- TypeElement type = getType(PrimitiveTypeModel.class);
- getDeclaredFields(type.asType())
- .stream()
- .map(VariableElement::asType)
- .forEach(t -> assertTrue(isPrimitiveType(t)));
-
- assertFalse(isPrimitiveType(getType(ArrayTypeModel.class)));
-
- assertFalse(isPrimitiveType((Element) null));
- assertFalse(isPrimitiveType((TypeMirror) null));
- }
-
- @Test
- public void testIsInterfaceType() {
- TypeElement type = getType(CharSequence.class);
- assertTrue(isInterfaceType(type));
- assertTrue(isInterfaceType(type.asType()));
-
- type = getType(Model.class);
- assertFalse(isInterfaceType(type));
- assertFalse(isInterfaceType(type.asType()));
-
- assertFalse(isInterfaceType((Element) null));
- assertFalse(isInterfaceType((TypeMirror) null));
- }
-
- @Test
- public void testIsAnnotationType() {
- TypeElement type = getType(Override.class);
-
- assertTrue(isAnnotationType(type));
- assertTrue(isAnnotationType(type.asType()));
-
- type = getType(Model.class);
- assertFalse(isAnnotationType(type));
- assertFalse(isAnnotationType(type.asType()));
-
- assertFalse(isAnnotationType((Element) null));
- assertFalse(isAnnotationType((TypeMirror) null));
- }
-
- @Test
- public void testGetHierarchicalTypes() {
- Set hierarchicalTypes = getHierarchicalTypes(testType.asType(), true, true, true);
- Iterator iterator = hierarchicalTypes.iterator();
- assertEquals(8, hierarchicalTypes.size());
- assertEquals("org.apache.dubbo.metadata.tools.TestServiceImpl", iterator.next().toString());
- assertEquals("org.apache.dubbo.metadata.tools.GenericTestService", iterator.next().toString());
- assertEquals("org.apache.dubbo.metadata.tools.DefaultTestService", iterator.next().toString());
- assertEquals("java.lang.Object", iterator.next().toString());
- assertEquals("org.apache.dubbo.metadata.tools.TestService", iterator.next().toString());
- assertEquals("java.lang.AutoCloseable", iterator.next().toString());
- assertEquals("java.io.Serializable", iterator.next().toString());
- assertEquals("java.util.EventListener", iterator.next().toString());
-
- hierarchicalTypes = getHierarchicalTypes(testType);
- iterator = hierarchicalTypes.iterator();
- assertEquals(8, hierarchicalTypes.size());
- assertEquals("org.apache.dubbo.metadata.tools.TestServiceImpl", iterator.next().toString());
- assertEquals("org.apache.dubbo.metadata.tools.GenericTestService", iterator.next().toString());
- assertEquals("org.apache.dubbo.metadata.tools.DefaultTestService", iterator.next().toString());
- assertEquals("java.lang.Object", iterator.next().toString());
- assertEquals("org.apache.dubbo.metadata.tools.TestService", iterator.next().toString());
- assertEquals("java.lang.AutoCloseable", iterator.next().toString());
- assertEquals("java.io.Serializable", iterator.next().toString());
- assertEquals("java.util.EventListener", iterator.next().toString());
-
- hierarchicalTypes = getHierarchicalTypes(testType.asType(), Object.class);
- iterator = hierarchicalTypes.iterator();
- assertEquals(7, hierarchicalTypes.size());
- assertEquals("org.apache.dubbo.metadata.tools.TestServiceImpl", iterator.next().toString());
- assertEquals("org.apache.dubbo.metadata.tools.GenericTestService", iterator.next().toString());
- assertEquals("org.apache.dubbo.metadata.tools.DefaultTestService", iterator.next().toString());
- assertEquals("org.apache.dubbo.metadata.tools.TestService", iterator.next().toString());
- assertEquals("java.lang.AutoCloseable", iterator.next().toString());
- assertEquals("java.io.Serializable", iterator.next().toString());
- assertEquals("java.util.EventListener", iterator.next().toString());
-
- hierarchicalTypes = getHierarchicalTypes(testType.asType(), true, true, false);
- iterator = hierarchicalTypes.iterator();
- assertEquals(4, hierarchicalTypes.size());
- assertEquals("org.apache.dubbo.metadata.tools.TestServiceImpl", iterator.next().toString());
- assertEquals("org.apache.dubbo.metadata.tools.GenericTestService", iterator.next().toString());
- assertEquals("org.apache.dubbo.metadata.tools.DefaultTestService", iterator.next().toString());
- assertEquals("java.lang.Object", iterator.next().toString());
-
- hierarchicalTypes = getHierarchicalTypes(testType.asType(), true, false, true);
- iterator = hierarchicalTypes.iterator();
- assertEquals(5, hierarchicalTypes.size());
- assertEquals("org.apache.dubbo.metadata.tools.TestServiceImpl", iterator.next().toString());
- assertEquals("org.apache.dubbo.metadata.tools.TestService", iterator.next().toString());
- assertEquals("java.lang.AutoCloseable", iterator.next().toString());
- assertEquals("java.io.Serializable", iterator.next().toString());
- assertEquals("java.util.EventListener", iterator.next().toString());
-
- hierarchicalTypes = getHierarchicalTypes(testType.asType(), false, false, true);
- iterator = hierarchicalTypes.iterator();
- assertEquals(4, hierarchicalTypes.size());
- assertEquals("org.apache.dubbo.metadata.tools.TestService", iterator.next().toString());
- assertEquals("java.lang.AutoCloseable", iterator.next().toString());
- assertEquals("java.io.Serializable", iterator.next().toString());
- assertEquals("java.util.EventListener", iterator.next().toString());
-
- hierarchicalTypes = getHierarchicalTypes(testType.asType(), true, false, false);
- iterator = hierarchicalTypes.iterator();
- assertEquals(1, hierarchicalTypes.size());
- assertEquals("org.apache.dubbo.metadata.tools.TestServiceImpl", iterator.next().toString());
-
- hierarchicalTypes = getHierarchicalTypes(testType.asType(), false, false, false);
- assertEquals(0, hierarchicalTypes.size());
-
- assertTrue(getHierarchicalTypes((TypeElement) null).isEmpty());
- assertTrue(getHierarchicalTypes((TypeMirror) null).isEmpty());
- }
-
-
- @Test
- public void testGetInterfaces() {
- TypeElement type = getType(Model.class);
- List<TypeMirror> interfaces = getInterfaces(type);
- assertTrue(interfaces.isEmpty());
-
- interfaces = getInterfaces(testType.asType());
-
- assertEquals(3, interfaces.size());
- assertEquals("org.apache.dubbo.metadata.tools.TestService", interfaces.get(0).toString());
- assertEquals("java.lang.AutoCloseable", interfaces.get(1).toString());
- assertEquals("java.io.Serializable", interfaces.get(2).toString());
-
- assertTrue(getInterfaces((TypeElement) null).isEmpty());
- assertTrue(getInterfaces((TypeMirror) null).isEmpty());
- }
-
- @Test
- public void testGetAllInterfaces() {
- Set<? extends TypeMirror> interfaces = getAllInterfaces(testType.asType());
- assertEquals(4, interfaces.size());
- Iterator<? extends TypeMirror> iterator = interfaces.iterator();
- assertEquals("org.apache.dubbo.metadata.tools.TestService", iterator.next().toString());
- assertEquals("java.lang.AutoCloseable", iterator.next().toString());
- assertEquals("java.io.Serializable", iterator.next().toString());
- assertEquals("java.util.EventListener", iterator.next().toString());
-
- Set<TypeElement> allInterfaces = getAllInterfaces(testType);
- assertEquals(4, interfaces.size());
-
- Iterator<TypeElement> allIterator = allInterfaces.iterator();
- assertEquals("org.apache.dubbo.metadata.tools.TestService", allIterator.next().toString());
- assertEquals("java.lang.AutoCloseable", allIterator.next().toString());
- assertEquals("java.io.Serializable", allIterator.next().toString());
- assertEquals("java.util.EventListener", allIterator.next().toString());
-
- assertTrue(getAllInterfaces((TypeElement) null).isEmpty());
- assertTrue(getAllInterfaces((TypeMirror) null).isEmpty());
- }
-
- @Test
- public void testGetType() {
- TypeElement element = TypeUtils.getType(processingEnv, String.class);
- assertEquals(element, TypeUtils.getType(processingEnv, element.asType()));
- assertEquals(element, TypeUtils.getType(processingEnv, "java.lang.String"));
-
- assertNull(TypeUtils.getType(processingEnv, (Type) null));
- assertNull(TypeUtils.getType(processingEnv, (TypeMirror) null));
- assertNull(TypeUtils.getType(processingEnv, (CharSequence) null));
- assertNull(TypeUtils.getType(null, (CharSequence) null));
- }
-
- @Test
- public void testGetSuperType() {
- TypeElement gtsTypeElement = getSuperType(testType);
- assertEquals(gtsTypeElement, getType(GenericTestService.class));
- TypeElement dtsTypeElement = getSuperType(gtsTypeElement);
- assertEquals(dtsTypeElement, getType(DefaultTestService.class));
-
- TypeMirror gtsType = getSuperType(testType.asType());
- assertEquals(gtsType, getType(GenericTestService.class).asType());
- TypeMirror dtsType = getSuperType(gtsType);
- assertEquals(dtsType, getType(DefaultTestService.class).asType());
-
- assertNull(getSuperType((TypeElement) null));
- assertNull(getSuperType((TypeMirror) null));
- }
-
- @Test
- public void testGetAllSuperTypes() {
- Set<?> allSuperTypes = getAllSuperTypes(testType);
- Iterator<?> iterator = allSuperTypes.iterator();
- assertEquals(3, allSuperTypes.size());
- assertEquals(iterator.next(), getType(GenericTestService.class));
- assertEquals(iterator.next(), getType(DefaultTestService.class));
- assertEquals(iterator.next(), getType(Object.class));
-
- allSuperTypes = getAllSuperTypes(testType);
- iterator = allSuperTypes.iterator();
- assertEquals(3, allSuperTypes.size());
- assertEquals(iterator.next(), getType(GenericTestService.class));
- assertEquals(iterator.next(), getType(DefaultTestService.class));
- assertEquals(iterator.next(), getType(Object.class));
-
- assertTrue(getAllSuperTypes((TypeElement) null).isEmpty());
- assertTrue(getAllSuperTypes((TypeMirror) null).isEmpty());
- }
-
- @Test
- public void testIsDeclaredType() {
- assertTrue(isDeclaredType(testType));
- assertTrue(isDeclaredType(testType.asType()));
- assertFalse(isDeclaredType((Element) null));
- assertFalse(isDeclaredType((TypeMirror) null));
- assertFalse(isDeclaredType(types.getNullType()));
- assertFalse(isDeclaredType(types.getPrimitiveType(TypeKind.BYTE)));
- assertFalse(isDeclaredType(types.getArrayType(types.getPrimitiveType(TypeKind.BYTE))));
- }
-
- @Test
- public void testOfDeclaredType() {
- assertEquals(testType.asType(), ofDeclaredType(testType));
- assertEquals(testType.asType(), ofDeclaredType(testType.asType()));
- assertEquals(ofDeclaredType(testType), ofDeclaredType(testType.asType()));
-
- assertNull(ofDeclaredType((Element) null));
- assertNull(ofDeclaredType((TypeMirror) null));
- }
-
- @Test
- public void testIsTypeElement() {
- assertTrue(isTypeElement(testType));
- assertTrue(isTypeElement(testType.asType()));
-
- assertFalse(isTypeElement((Element) null));
- assertFalse(isTypeElement((TypeMirror) null));
- }
-
- @Test
- public void testOfTypeElement() {
- assertEquals(testType, ofTypeElement(testType));
- assertEquals(testType, ofTypeElement(testType.asType()));
-
- assertNull(ofTypeElement((Element) null));
- assertNull(ofTypeElement((TypeMirror) null));
- }
-
- @Test
- public void testOfDeclaredTypes() {
- Set<DeclaredType> declaredTypes = ofDeclaredTypes(asList(getType(String.class), getType(TestServiceImpl.class), getType(Color.class)));
- assertTrue(declaredTypes.contains(getType(String.class).asType()));
- assertTrue(declaredTypes.contains(getType(TestServiceImpl.class).asType()));
- assertTrue(declaredTypes.contains(getType(Color.class).asType()));
-
- assertTrue(ofDeclaredTypes(null).isEmpty());
- }
-
- @Test
- public void testListDeclaredTypes() {
- List<DeclaredType> types = listDeclaredTypes(asList(testType, testType, testType));
- assertEquals(1, types.size());
- assertEquals(ofDeclaredType(testType), types.get(0));
-
- types = listDeclaredTypes(asList(new Element[]{null}));
- assertTrue(types.isEmpty());
- }
-
- @Test
- public void testListTypeElements() {
- List<TypeElement> typeElements = listTypeElements(asList(testType.asType(), ofDeclaredType(testType)));
- assertEquals(1, typeElements.size());
- assertEquals(testType, typeElements.get(0));
-
- typeElements = listTypeElements(asList(types.getPrimitiveType(TypeKind.BYTE), types.getNullType(), types.getNoType(TypeKind.NONE)));
- assertTrue(typeElements.isEmpty());
-
- typeElements = listTypeElements(asList(new TypeMirror[]{null}));
- assertTrue(typeElements.isEmpty());
-
- typeElements = listTypeElements(null);
- assertTrue(typeElements.isEmpty());
- }
-
- @Test
- public void testGetResource() throws URISyntaxException {
- URL resource = getResource(processingEnv, testType);
- assertNotNull(resource);
- assertTrue(new File(resource.toURI()).exists());
- assertEquals(resource, getResource(processingEnv, testType.asType()));
- assertEquals(resource, getResource(processingEnv, "org.apache.dubbo.metadata.tools.TestServiceImpl"));
-
- assertThrows(RuntimeException.class, () -> getResource(processingEnv, "NotFound"));
- }
-
- @Test
- public void testGetResourceName() {
- assertEquals("java/lang/String.class", getResourceName("java.lang.String"));
- assertNull(getResourceName(null));
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/rest/DefaultRestService.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/rest/DefaultRestService.java
deleted file mode 100644
index 2c22457..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/rest/DefaultRestService.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.metadata.rest;
-
-import org.apache.dubbo.config.annotation.Service;
-
-import java.util.Map;
-
-/**
- * The default implementation of {@link RestService}
- *
- * @since 2.7.6
- */
-@Service(version = "1.0.0", group = "default")
-public class DefaultRestService implements RestService {
-
- @Override
- public String param(String param) {
- return null;
- }
-
- @Override
- public String params(int a, String b) {
- return null;
- }
-
- @Override
- public String headers(String header, String header2, Integer param) {
- return null;
- }
-
- @Override
- public String pathVariables(String path1, String path2, String param) {
- return null;
- }
-
- @Override
- public String form(String form) {
- return null;
- }
-
- @Override
- public User requestBodyMap(Map<String, Object> data, String param) {
- return null;
- }
-
- @Override
- public Map<String, Object> requestBodyUser(User user) {
- return null;
- }
-
- public User user(User user) {
- return user;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/rest/RestService.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/rest/RestService.java
deleted file mode 100644
index 65d67ab..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/rest/RestService.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.metadata.rest;
-
-
-import java.util.Map;
-
-/**
- * An interface for REST service
- *
- * @since 2.7.6
- */
-public interface RestService {
-
- String param(String param);
-
- String params(int a, String b);
-
- String headers(String header, String header2, Integer param);
-
- String pathVariables(String path1, String path2, String param);
-
- String form(String form);
-
- User requestBodyMap(Map<String, Object> data, String param);
-
- Map<String, Object> requestBodyUser(User user);
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/rest/SpringRestService.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/rest/SpringRestService.java
deleted file mode 100644
index ed4a8a2..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/rest/SpringRestService.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.metadata.rest;
-
-import org.apache.dubbo.config.annotation.Service;
-
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Spring MVC {@link RestService}
- *
- * @since 2.7.6
- */
-@Service(version = "2.0.0", group = "spring")
-@RestController
-public class SpringRestService implements RestService {
-
- @Override
- @GetMapping(value = "/param")
- public String param(@RequestParam(defaultValue = "value-param") String param) {
- return param;
- }
-
- @Override
- @PostMapping("/params")
- public String params(@RequestParam(defaultValue = "value-a") int a, @RequestParam(defaultValue = "value-b") String b) {
- return a + b;
- }
-
- @Override
- @GetMapping("/headers")
- public String headers(@RequestHeader(name = "h", defaultValue = "value-h") String header,
- @RequestHeader(name = "h2", defaultValue = "value-h2") String header2,
- @RequestParam(value = "v", defaultValue = "1") Integer param) {
- String result = header + " , " + header2 + " , " + param;
- return result;
- }
-
- @Override
- @GetMapping("/path-variables/{p1}/{p2}")
- public String pathVariables(@PathVariable("p1") String path1,
- @PathVariable("p2") String path2, @RequestParam("v") String param) {
- String result = path1 + " , " + path2 + " , " + param;
- return result;
- }
-
- @Override
- @PostMapping("/form")
- public String form(@RequestParam("f") String form) {
- return String.valueOf(form);
- }
-
- @Override
- @PostMapping(value = "/request/body/map", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
- public User requestBodyMap(@RequestBody Map<String, Object> data,
- @RequestParam("param") String param) {
- User user = new User();
- user.setId(((Integer) data.get("id")).longValue());
- user.setName((String) data.get("name"));
- user.setAge((Integer) data.get("age"));
- return user;
- }
-
- @PostMapping(value = "/request/body/user", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
- @Override
- public Map<String, Object> requestBodyUser(@RequestBody User user) {
- Map<String, Object> map = new HashMap<>();
- map.put("id", user.getId());
- map.put("name", user.getName());
- map.put("age", user.getAge());
- return map;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/rest/StandardRestService.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/rest/StandardRestService.java
deleted file mode 100644
index f5d94b7..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/rest/StandardRestService.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.metadata.rest;
-
-import org.apache.dubbo.config.annotation.Service;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- * JAX-RS {@link RestService}
- */
-@Service(version = "3.0.0", protocol = {"dubbo", "rest"}, group = "standard")
-@Path("/")
-public class StandardRestService implements RestService {
-
- @Override
- @Path("param")
- @GET
- public String param(@QueryParam("param") String param) {
- return param;
- }
-
- @Override
- @Path("params")
- @POST
- public String params(@QueryParam("a") int a, @QueryParam("b") String b) {
- return a + b;
- }
-
- @Override
- @Path("headers")
- @GET
- public String headers(@HeaderParam("h") String header,
- @HeaderParam("h2") String header2, @QueryParam("v") Integer param) {
- String result = header + " , " + header2 + " , " + param;
- return result;
- }
-
- @Override
- @Path("path-variables/{p1}/{p2}")
- @GET
- public String pathVariables(@PathParam("p1") String path1,
- @PathParam("p2") String path2, @QueryParam("v") String param) {
- String result = path1 + " , " + path2 + " , " + param;
- return result;
- }
-
- // @CookieParam does not support : https://github.com/OpenFeign/feign/issues/913
- // @CookieValue also does not support
-
- @Override
- @Path("form")
- @POST
- public String form(@FormParam("f") String form) {
- return String.valueOf(form);
- }
-
- @Override
- @Path("request/body/map")
- @POST
- @Produces("application/json;charset=UTF-8")
- public User requestBodyMap(Map<String, Object> data,
- @QueryParam("param") String param) {
- User user = new User();
- user.setId(((Integer) data.get("id")).longValue());
- user.setName((String) data.get("name"));
- user.setAge((Integer) data.get("age"));
- return user;
- }
-
- @Path("request/body/user")
- @POST
- @Override
- @Consumes("application/json;charset=UTF-8")
- public Map<String, Object> requestBodyUser(User user) {
- Map<String, Object> map = new HashMap<>();
- map.put("id", user.getId());
- map.put("name", user.getName());
- map.put("age", user.getAge());
- return map;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/rest/User.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/rest/User.java
deleted file mode 100644
index 2b6c4a2..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/rest/User.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.metadata.rest;
-
-import java.io.Serializable;
-
-/**
- * User Entity
- *
- * @since 2.7.6
- */
-public class User implements Serializable {
-
- private Long id;
-
- private String name;
-
- private Integer age;
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Integer getAge() {
- return age;
- }
-
- public void setAge(Integer age) {
- this.age = age;
- }
-
- @Override
- public String toString() {
- return "User{" + "id=" + id + ", name='" + name + '\'' + ", age=" + age + '}';
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/Ancestor.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/Ancestor.java
deleted file mode 100644
index 52ccaf6..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/Ancestor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.metadata.tools;
-
-import java.io.Serializable;
-
-/**
- * Ancestor
- */
-public class Ancestor implements Serializable {
-
- private boolean z;
-
- public boolean isZ() {
- return z;
- }
-
- public void setZ(boolean z) {
- this.z = z;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/Compiler.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/Compiler.java
deleted file mode 100644
index e2f27dd..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/Compiler.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.metadata.tools;
-
-import javax.annotation.processing.Processor;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-import javax.tools.ToolProvider;
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import static java.util.Arrays.asList;
-
-/**
- * The Java Compiler
- */
-public class Compiler {
-
- private final File sourceDirectory;
-
- private final JavaCompiler javaCompiler;
-
- private final StandardJavaFileManager javaFileManager;
-
- private final Set<Processor> processors = new LinkedHashSet<>();
-
- public Compiler() throws IOException {
- this(defaultTargetDirectory());
- }
-
- public Compiler(File targetDirectory) throws IOException {
- this(defaultSourceDirectory(), targetDirectory);
- }
-
- public Compiler(File sourceDirectory, File targetDirectory) throws IOException {
- this.sourceDirectory = sourceDirectory;
- this.javaCompiler = ToolProvider.getSystemJavaCompiler();
- this.javaFileManager = javaCompiler.getStandardFileManager(null, null, null);
- this.javaFileManager.setLocation(StandardLocation.CLASS_OUTPUT, Collections.singleton(targetDirectory));
- this.javaFileManager.setLocation(StandardLocation.SOURCE_OUTPUT, Collections.singleton(targetDirectory));
- }
-
- private static File defaultSourceDirectory() {
- return new File(defaultRootDirectory(), "src/test/java");
- }
-
- private static File defaultRootDirectory() {
- return detectClassPath(Compiler.class).getParentFile().getParentFile();
- }
-
- private static File defaultTargetDirectory() {
- File dir = new File(defaultRootDirectory(), "target/generated-classes");
- dir.mkdirs();
- return dir;
- }
-
- private static File detectClassPath(Class<?> targetClass) {
- URL classFileURL = targetClass.getProtectionDomain().getCodeSource().getLocation();
- if ("file".equals(classFileURL.getProtocol())) {
- return new File(classFileURL.getPath());
- } else {
- throw new RuntimeException("No support");
- }
- }
-
- public Compiler processors(Processor... processors) {
- this.processors.addAll(asList(processors));
- return this;
- }
-
- private Iterable<? extends JavaFileObject> getJavaFileObjects(Class<?>... sourceClasses) {
- int size = sourceClasses == null ? 0 : sourceClasses.length;
- File[] javaSourceFiles = new File[size];
- for (int i = 0; i < size; i++) {
- File javaSourceFile = javaSourceFile(sourceClasses[i].getName());
- javaSourceFiles[i] = javaSourceFile;
- }
- return javaFileManager.getJavaFileObjects(javaSourceFiles);
- }
-
- private File javaSourceFile(String sourceClassName) {
- String javaSourceFilePath = sourceClassName.replace('.', '/').concat(".java");
- return new File(sourceDirectory, javaSourceFilePath);
- }
-
- public boolean compile(Class<?>... sourceClasses) {
- JavaCompiler.CompilationTask task = javaCompiler.getTask(null, this.javaFileManager, null,
- asList("-parameters", "-Xlint:unchecked", "-nowarn", "-Xlint:deprecation"),
-// null,
- null, getJavaFileObjects(sourceClasses));
- if (!processors.isEmpty()) {
- task.setProcessors(processors);
- }
- return task.call();
- }
-
- public JavaCompiler getJavaCompiler() {
- return javaCompiler;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/CompilerTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/CompilerTest.java
deleted file mode 100644
index e633e0f..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/CompilerTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.metadata.tools;
-
-import org.junit.jupiter.api.Test;
-
-import java.io.IOException;
-
-/**
- * The Compiler test case
- */
-public class CompilerTest {
-
- @Test
- public void testCompile() throws IOException {
- Compiler compiler = new Compiler();
- compiler.compile(
- TestServiceImpl.class,
- DefaultTestService.class,
- GenericTestService.class);
- }
-}
-
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/DefaultRestServiceTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/DefaultRestServiceTest.java
deleted file mode 100644
index 6921bbd..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/DefaultRestServiceTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.metadata.tools;
-
-import org.apache.dubbo.metadata.rest.DefaultRestService;
-import org.apache.dubbo.metadata.rest.RestService;
-import org.apache.dubbo.metadata.rest.SpringRestService;
-import org.apache.dubbo.metadata.rest.StandardRestService;
-import org.apache.dubbo.metadata.rest.User;
-
-import org.junit.jupiter.api.Test;
-
-import java.io.IOException;
-
-/**
- * The test case for {@link DefaultRestService}
- *
- * @since 2.7.6
- */
-public class DefaultRestServiceTest {
-
- @Test
- public void test() throws IOException {
- Compiler compiler = new Compiler();
- compiler.compile(User.class,
- RestService.class,
- DefaultRestService.class,
- SpringRestService.class,
- StandardRestService.class);
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/DefaultTestService.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/DefaultTestService.java
deleted file mode 100644
index 85bce69..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/DefaultTestService.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.metadata.tools;
-
-
-import org.apache.dubbo.config.annotation.Service;
-import org.apache.dubbo.metadata.annotation.processing.model.Model;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * {@link TestService} Implementation
- *
- * @since 2.7.6
- */
-@Service(
- interfaceName = "org.apache.dubbo.metadata.tools.TestService",
- version = "1.0.0",
- group = "default"
-)
-public class DefaultTestService implements TestService {
-
- private String name;
-
- @Override
- public String echo(String message) {
- return "[ECHO] " + message;
- }
-
- @Override
- public Model model(Model model) {
- return model;
- }
-
- @Override
- public String testPrimitive(boolean z, int i) {
- return null;
- }
-
- @Override
- public Model testEnum(TimeUnit timeUnit) {
- return null;
- }
-
- @Override
- public String testArray(String[] strArray, int[] intArray, Model[] modelArray) {
- return null;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/GenericTestService.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/GenericTestService.java
deleted file mode 100644
index 83cf19f..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/GenericTestService.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.metadata.tools;
-
-
-import com.alibaba.dubbo.config.annotation.Service;
-
-import java.util.EventListener;
-
-/**
- * {@link TestService} Implementation
- *
- * @since 2.7.6
- */
-@Service(
- version = "2.0.0",
- group = "generic"
-)
-public class GenericTestService extends DefaultTestService implements TestService, EventListener {
- @Override
- public String echo(String message) {
- return "[ECHO] " + message;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/Parent.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/Parent.java
deleted file mode 100644
index 4273a0f..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/Parent.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.metadata.tools;
-
-/**
- * Parent
- */
-public class Parent extends Ancestor {
-
- private byte b;
-
- private short s;
-
- private int i;
-
- private long l;
-
- public byte getB() {
- return b;
- }
-
- public void setB(byte b) {
- this.b = b;
- }
-
- public short getS() {
- return s;
- }
-
- public void setS(short s) {
- this.s = s;
- }
-
- public int getI() {
- return i;
- }
-
- public void setI(int i) {
- this.i = i;
- }
-
- public long getL() {
- return l;
- }
-
- public void setL(long l) {
- this.l = l;
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/RestServiceTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/RestServiceTest.java
deleted file mode 100644
index fcb444e..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/RestServiceTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.metadata.tools;
-
-import org.apache.dubbo.metadata.rest.RestService;
-import org.apache.dubbo.metadata.rest.SpringRestService;
-import org.apache.dubbo.metadata.rest.StandardRestService;
-import org.apache.dubbo.metadata.rest.User;
-
-import org.junit.jupiter.api.Test;
-
-import java.io.IOException;
-
-/**
- * {@link RestService} Test
- *
- * @since 2.7.6
- */
-public class RestServiceTest {
-
- @Test
- public void test() throws IOException {
- Compiler compiler = new Compiler();
- compiler.compile(User.class, RestService.class,
- StandardRestService.class,
- SpringRestService.class);
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/SpringRestServiceTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/SpringRestServiceTest.java
deleted file mode 100644
index f2ebe1d..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/SpringRestServiceTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.metadata.tools;
-
-import org.apache.dubbo.metadata.rest.RestService;
-import org.apache.dubbo.metadata.rest.SpringRestService;
-import org.apache.dubbo.metadata.rest.User;
-
-import org.junit.jupiter.api.Test;
-
-import java.io.IOException;
-
-/**
- * {@link SpringRestService} Test
- *
- * @since 2.7.6
- */
-public class SpringRestServiceTest {
-
- @Test
- public void test() throws IOException {
- Compiler compiler = new Compiler();
- compiler.compile(User.class, RestService.class, SpringRestService.class);
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/StandardRestServiceTest.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/StandardRestServiceTest.java
deleted file mode 100644
index bba4d54..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/StandardRestServiceTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.metadata.tools;
-
-import org.apache.dubbo.metadata.rest.RestService;
-import org.apache.dubbo.metadata.rest.StandardRestService;
-import org.apache.dubbo.metadata.rest.User;
-
-import org.junit.jupiter.api.Test;
-
-import java.io.IOException;
-
-/**
- * The test case for {@link StandardRestService}
- *
- * @since 2.7.6
- */
-public class StandardRestServiceTest {
-
- @Test
- public void test() throws IOException {
- Compiler compiler = new Compiler();
- compiler.compile(User.class, RestService.class, StandardRestService.class);
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/TestProcessor.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/TestProcessor.java
deleted file mode 100644
index cb8ae82..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/TestProcessor.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.metadata.tools;
-
-import javax.annotation.processing.AbstractProcessor;
-import javax.annotation.processing.ProcessingEnvironment;
-import javax.annotation.processing.Processor;
-import javax.annotation.processing.RoundEnvironment;
-import javax.annotation.processing.SupportedAnnotationTypes;
-import javax.lang.model.SourceVersion;
-import javax.lang.model.element.TypeElement;
-import java.util.Set;
-
-import static javax.lang.model.SourceVersion.latestSupported;
-
-/**
- * {@link Processor} for test
- *
- * @since 2.7.6
- */
-@SupportedAnnotationTypes("*")
-public class TestProcessor extends AbstractProcessor {
-
- @Override
- public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
- return false;
- }
-
- public ProcessingEnvironment getProcessingEnvironment() {
- return super.processingEnv;
- }
-
- public SourceVersion getSupportedSourceVersion(){
- return latestSupported();
- }
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/TestService.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/TestService.java
deleted file mode 100644
index 83c0ef6..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/TestService.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.metadata.tools;
-
-import org.apache.dubbo.metadata.annotation.processing.model.Model;
-
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Test Service
- *
- * @since 2.7.6
- */
-@Path("/echo")
-public interface TestService {
-
- @GET
- <T> String echo(@PathParam("message") @DefaultValue("mercyblitz") String message);
-
- @POST
- Model model(@PathParam("model") Model model);
-
- // Test primitive
- @PUT
- String testPrimitive(boolean z, int i);
-
- // Test enumeration
- @PUT
- Model testEnum(TimeUnit timeUnit);
-
- // Test Array
- @GET
- String testArray(String[] strArray, int[] intArray, Model[] modelArray);
-}
diff --git a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/TestServiceImpl.java b/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/TestServiceImpl.java
deleted file mode 100644
index 713e8e7..0000000
--- a/dubbo-metadata/dubbo-metadata-processor/src/test/java/org/apache/dubbo/metadata/tools/TestServiceImpl.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.metadata.tools;
-
-
-import org.apache.dubbo.config.annotation.Service;
-
-import java.io.Serializable;
-
-/**
- * {@link TestService} Implementation
- *
- * @since 2.7.6
- */
-@com.alibaba.dubbo.config.annotation.Service(
- interfaceName = "org.apache.dubbo.metadata.tools.TestService",
- interfaceClass = TestService.class,
- version = "3.0.0",
- group = "test"
-)
-@Service(
- interfaceName = "org.apache.dubbo.metadata.tools.TestService",
- interfaceClass = TestService.class,
- version = "3.0.0",
- group = "test"
-)
-public class TestServiceImpl extends GenericTestService implements TestService, AutoCloseable, Serializable {
-
- @Override
- public String echo(String message) {
- return "[ECHO] " + message;
- }
-
- @Override
- public void close() throws Exception {
- }
-}