From 5eb9b731568dfc99357aaabffa947d43b8bea0af Mon Sep 17 00:00:00 2001 From: Albumen Kevin Date: Tue, 22 Nov 2022 11:50:11 +0800 Subject: [PATCH 1/3] Fix shallow clone for sonarcloud (#10985) --- .github/workflows/build-and-test-pr.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-and-test-pr.yml b/.github/workflows/build-and-test-pr.yml index 3f013769b4..1018219c67 100644 --- a/.github/workflows/build-and-test-pr.yml +++ b/.github/workflows/build-and-test-pr.yml @@ -156,6 +156,8 @@ jobs: CURRENT_ROLE: ${{ matrix.case-role }} steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: "Set up JDK ${{ matrix.jdk }}" uses: actions/setup-java@v3 with: From 237042cbb518ec8647e430dd7db4967f063b171a Mon Sep 17 00:00:00 2001 From: Albumen Kevin Date: Tue, 22 Nov 2022 14:04:08 +0800 Subject: [PATCH 2/3] Remove public modifier in dubbo-compatiable (#10983) --- .../org/apache/dubbo/cache/CacheTest.java | 4 +- .../dubbo/common/extension/ExtensionTest.java | 4 +- .../dubbo/config/ApplicationConfigTest.java | 34 ++++++++-------- .../dubbo/config/ArgumentConfigTest.java | 10 ++--- .../org/apache/dubbo/config/ConfigTest.java | 4 +- .../dubbo/config/ConsumerConfigTest.java | 8 ++-- .../apache/dubbo/config/MethodConfigTest.java | 28 ++++++------- .../apache/dubbo/config/ModuleConfigTest.java | 18 ++++----- .../dubbo/config/ProtocolConfigTest.java | 32 +++++++-------- .../dubbo/config/ProviderConfigTest.java | 40 +++++++++---------- .../dubbo/config/ReferenceConfigTest.java | 4 +- .../dubbo/config/RegistryConfigTest.java | 40 +++++++++---------- .../apache/dubbo/echo/EchoServiceTest.java | 4 +- .../org/apache/dubbo/filter/FilterTest.java | 6 +-- .../dubbo/generic/GenericServiceTest.java | 12 +++--- .../org/apache/dubbo/rpc/RpcContextTest.java | 6 +-- .../apache/dubbo/rpc/cluster/RouterTest.java | 4 +- .../serialization/SerializationTest.java | 12 +++--- .../org/apache/dubbo/dependency/FileTest.java | 14 +++---- 19 files changed, 142 insertions(+), 142 deletions(-) diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/cache/CacheTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/cache/CacheTest.java index 5f5b7ad4de..a63ee4ddd0 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/cache/CacheTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/cache/CacheTest.java @@ -29,10 +29,10 @@ import org.junit.jupiter.api.Test; import java.util.Map; -public class CacheTest { +class CacheTest { @Test - public void testCacheFactory() { + void testCacheFactory() { URL url = URL.valueOf("test://test:11/test?cache=jacache&.cache.write.expire=1"); CacheFactory cacheFactory = new MyCacheFactory(); Invocation invocation = new NullInvocation(); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/ExtensionTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/ExtensionTest.java index b126d6a784..f6d1b923ee 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/ExtensionTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/common/extension/ExtensionTest.java @@ -22,10 +22,10 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.fail; -public class ExtensionTest { +class ExtensionTest { @Test - public void testExtensionFactory() { + void testExtensionFactory() { try { ExtensionInjector myfactory = ExtensionLoader.getExtensionLoader(ExtensionInjector.class).getExtension("myfactory"); Assertions.assertTrue(myfactory instanceof ExtensionInjector); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ApplicationConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ApplicationConfigTest.java index 2a2d5b14a6..bfa8cfd72b 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ApplicationConfigTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ApplicationConfigTest.java @@ -39,9 +39,9 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.sameInstance; import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -public class ApplicationConfigTest { +class ApplicationConfigTest { @Test - public void testName() throws Exception { + void testName() throws Exception { ApplicationConfig application = new ApplicationConfig(); application.setName("app"); assertThat(application.getName(), equalTo("app")); @@ -53,7 +53,7 @@ public class ApplicationConfigTest { } @Test - public void testVersion() throws Exception { + void testVersion() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setVersion("1.0.0"); assertThat(application.getVersion(), equalTo("1.0.0")); @@ -63,28 +63,28 @@ public class ApplicationConfigTest { } @Test - public void testOwner() throws Exception { + void testOwner() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setOwner("owner"); assertThat(application.getOwner(), equalTo("owner")); } @Test - public void testOrganization() throws Exception { + void testOrganization() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setOrganization("org"); assertThat(application.getOrganization(), equalTo("org")); } @Test - public void testArchitecture() throws Exception { + void testArchitecture() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setArchitecture("arch"); assertThat(application.getArchitecture(), equalTo("arch")); } @Test - public void testEnvironment1() throws Exception { + void testEnvironment1() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setEnvironment("develop"); assertThat(application.getEnvironment(), equalTo("develop")); @@ -95,7 +95,7 @@ public class ApplicationConfigTest { } @Test - public void testEnvironment2() throws Exception { + void testEnvironment2() throws Exception { Assertions.assertThrows(IllegalStateException.class, () -> { ApplicationConfig application = new ApplicationConfig("app"); application.setEnvironment("illegal-env"); @@ -103,7 +103,7 @@ public class ApplicationConfigTest { } @Test - public void testRegistry() throws Exception { + void testRegistry() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); RegistryConfig registry = new RegistryConfig(); application.setRegistry(registry); @@ -114,7 +114,7 @@ public class ApplicationConfigTest { } @Test - public void testMonitor() throws Exception { + void testMonitor() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setMonitor(new MonitorConfig("monitor-addr")); assertThat(application.getMonitor().getAddress(), equalTo("monitor-addr")); @@ -123,21 +123,21 @@ public class ApplicationConfigTest { } @Test - public void testLogger() throws Exception { + void testLogger() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setLogger("log4j"); assertThat(application.getLogger(), equalTo("log4j")); } @Test - public void testDefault() throws Exception { + void testDefault() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setDefault(true); assertThat(application.isDefault(), is(true)); } @Test - public void testDumpDirectory() throws Exception { + void testDumpDirectory() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setDumpDirectory("/dump"); assertThat(application.getDumpDirectory(), equalTo("/dump")); @@ -147,7 +147,7 @@ public class ApplicationConfigTest { } @Test - public void testQosEnable() throws Exception { + void testQosEnable() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setQosEnable(true); assertThat(application.getQosEnable(), is(true)); @@ -157,14 +157,14 @@ public class ApplicationConfigTest { } @Test - public void testQosPort() throws Exception { + void testQosPort() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setQosPort(8080); assertThat(application.getQosPort(), equalTo(8080)); } @Test - public void testQosAcceptForeignIp() throws Exception { + void testQosAcceptForeignIp() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setQosAcceptForeignIp(true); assertThat(application.getQosAcceptForeignIp(), is(true)); @@ -174,7 +174,7 @@ public class ApplicationConfigTest { } @Test - public void testParameters() throws Exception { + void testParameters() throws Exception { ApplicationConfig application = new ApplicationConfig("app"); application.setQosAcceptForeignIp(true); Map parameters = new HashMap(); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ArgumentConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ArgumentConfigTest.java index 6125d5c2d6..4631770320 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ArgumentConfigTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ArgumentConfigTest.java @@ -28,30 +28,30 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.is; -public class ArgumentConfigTest { +class ArgumentConfigTest { @Test - public void testIndex() throws Exception { + void testIndex() throws Exception { ArgumentConfig argument = new ArgumentConfig(); argument.setIndex(1); assertThat(argument.getIndex(), is(1)); } @Test - public void testType() throws Exception { + void testType() throws Exception { ArgumentConfig argument = new ArgumentConfig(); argument.setType("int"); assertThat(argument.getType(), equalTo("int")); } @Test - public void testCallback() throws Exception { + void testCallback() throws Exception { ArgumentConfig argument = new ArgumentConfig(); argument.setCallback(true); assertThat(argument.isCallback(), is(true)); } @Test - public void testArguments() throws Exception { + void testArguments() throws Exception { ArgumentConfig argument = new ArgumentConfig(); argument.setIndex(1); argument.setType("int"); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ConfigTest.java index fe3ee4d1e3..2470a2da24 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ConfigTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ConfigTest.java @@ -28,7 +28,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class ConfigTest { +class ConfigTest { private com.alibaba.dubbo.config.ApplicationConfig applicationConfig = new com.alibaba.dubbo.config.ApplicationConfig("first-dubbo-test"); private com.alibaba.dubbo.config.RegistryConfig registryConfig = new com.alibaba.dubbo.config.RegistryConfig("multicast://224.5.6.7:1234"); @@ -45,7 +45,7 @@ public class ConfigTest { } @Test - public void testConfig() { + void testConfig() { com.alibaba.dubbo.config.ServiceConfig service = new ServiceConfig<>(); service.setApplication(applicationConfig); service.setRegistry(registryConfig); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ConsumerConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ConsumerConfigTest.java index 96282d2f15..5dda5ae966 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ConsumerConfigTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ConsumerConfigTest.java @@ -24,9 +24,9 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; -public class ConsumerConfigTest { +class ConsumerConfigTest { @Test - public void testTimeout() throws Exception { + void testTimeout() throws Exception { try { System.clearProperty("sun.rmi.transport.tcp.responseTimeout"); ConsumerConfig consumer = new ConsumerConfig(); @@ -39,14 +39,14 @@ public class ConsumerConfigTest { } @Test - public void testDefault() throws Exception { + void testDefault() throws Exception { ConsumerConfig consumer = new ConsumerConfig(); consumer.setDefault(true); assertThat(consumer.isDefault(), is(true)); } @Test - public void testClient() throws Exception { + void testClient() throws Exception { ConsumerConfig consumer = new ConsumerConfig(); consumer.setClient("client"); assertThat(consumer.getClient(), equalTo("client")); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/MethodConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/MethodConfigTest.java index 94156a5de7..22e04b3a81 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/config/MethodConfigTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/MethodConfigTest.java @@ -44,9 +44,9 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; import static org.junit.jupiter.api.Assertions.assertEquals; -public class MethodConfigTest { +class MethodConfigTest { @Test - public void testName() throws Exception { + void testName() throws Exception { MethodConfig method = new MethodConfig(); method.setName("hello"); assertThat(method.getName(), equalTo("hello")); @@ -56,42 +56,42 @@ public class MethodConfigTest { } @Test - public void testStat() throws Exception { + void testStat() throws Exception { MethodConfig method = new MethodConfig(); method.setStat(10); assertThat(method.getStat(), equalTo(10)); } @Test - public void testRetry() throws Exception { + void testRetry() throws Exception { MethodConfig method = new MethodConfig(); method.setRetry(true); assertThat(method.isRetry(), is(true)); } @Test - public void testReliable() throws Exception { + void testReliable() throws Exception { MethodConfig method = new MethodConfig(); method.setReliable(true); assertThat(method.isReliable(), is(true)); } @Test - public void testExecutes() throws Exception { + void testExecutes() throws Exception { MethodConfig method = new MethodConfig(); method.setExecutes(10); assertThat(method.getExecutes(), equalTo(10)); } @Test - public void testDeprecated() throws Exception { + void testDeprecated() throws Exception { MethodConfig method = new MethodConfig(); method.setDeprecated(true); assertThat(method.getDeprecated(), is(true)); } @Test - public void testArguments() throws Exception { + void testArguments() throws Exception { MethodConfig method = new MethodConfig(); ArgumentConfig argument = new ArgumentConfig(); method.setArguments(Collections.singletonList(argument)); @@ -100,14 +100,14 @@ public class MethodConfigTest { } @Test - public void testSticky() throws Exception { + void testSticky() throws Exception { MethodConfig method = new MethodConfig(); method.setSticky(true); assertThat(method.getSticky(), is(true)); } @Test - public void testConvertMethodConfig2AsyncInfo() throws Exception{ + void testConvertMethodConfig2AsyncInfo() throws Exception{ org.apache.dubbo.config.MethodConfig methodConfig = new org.apache.dubbo.config.MethodConfig(); methodConfig.setOninvokeMethod("setName"); methodConfig.setOninvoke(new Person()); @@ -131,7 +131,7 @@ public class MethodConfigTest { } @Test - public void testOnreturnMethod() throws Exception { + void testOnreturnMethod() throws Exception { MethodConfig method = new MethodConfig(); method.setOnreturnMethod("on-return-method"); assertThat(method.getOnreturnMethod(), equalTo("on-return-method")); @@ -157,7 +157,7 @@ public class MethodConfigTest { } @Test - public void testOnthrowMethod() throws Exception { + void testOnthrowMethod() throws Exception { MethodConfig method = new MethodConfig(); method.setOnthrowMethod("on-throw-method"); assertThat(method.getOnthrowMethod(), equalTo("on-throw-method")); @@ -183,7 +183,7 @@ public class MethodConfigTest { } @Test - public void testOninvokeMethod() throws Exception { + void testOninvokeMethod() throws Exception { MethodConfig method = new MethodConfig(); method.setOninvokeMethod("on-invoke-method"); assertThat(method.getOninvokeMethod(), equalTo("on-invoke-method")); @@ -196,7 +196,7 @@ public class MethodConfigTest { } @Test - public void testReturn() throws Exception { + void testReturn() throws Exception { MethodConfig method = new MethodConfig(); method.setReturn(true); assertThat(method.isReturn(), is(true)); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ModuleConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ModuleConfigTest.java index 96082f0dee..1075f15b9f 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ModuleConfigTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ModuleConfigTest.java @@ -33,10 +33,10 @@ import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.sameInstance; -public class ModuleConfigTest { +class ModuleConfigTest { @Test - public void testName2() throws Exception { + void testName2() throws Exception { ModuleConfig module = new ModuleConfig(); module.setName("module-name"); assertThat(module.getName(), equalTo("module-name")); @@ -47,7 +47,7 @@ public class ModuleConfigTest { } @Test - public void testVersion() throws Exception { + void testVersion() throws Exception { ModuleConfig module = new ModuleConfig(); module.setName("module-name"); module.setVersion("1.0.0"); @@ -58,21 +58,21 @@ public class ModuleConfigTest { } @Test - public void testOwner() throws Exception { + void testOwner() throws Exception { ModuleConfig module = new ModuleConfig(); module.setOwner("owner"); assertThat(module.getOwner(), equalTo("owner")); } @Test - public void testOrganization() throws Exception { + void testOrganization() throws Exception { ModuleConfig module = new ModuleConfig(); module.setOrganization("org"); assertThat(module.getOrganization(), equalTo("org")); } @Test - public void testRegistry() throws Exception { + void testRegistry() throws Exception { ModuleConfig module = new ModuleConfig(); RegistryConfig registry = new RegistryConfig(); module.setRegistry(registry); @@ -80,7 +80,7 @@ public class ModuleConfigTest { } @Test - public void testRegistries() throws Exception { + void testRegistries() throws Exception { ModuleConfig module = new ModuleConfig(); RegistryConfig registry = new RegistryConfig(); module.setRegistries(Collections.singletonList(registry)); @@ -89,7 +89,7 @@ public class ModuleConfigTest { } @Test - public void testMonitor() throws Exception { + void testMonitor() throws Exception { ModuleConfig module = new ModuleConfig(); module.setMonitor("monitor-addr1"); assertThat(module.getMonitor().getAddress(), equalTo("monitor-addr1")); @@ -98,7 +98,7 @@ public class ModuleConfigTest { } @Test - public void testDefault() throws Exception { + void testDefault() throws Exception { ModuleConfig module = new ModuleConfig(); module.setDefault(true); assertThat(module.isDefault(), is(true)); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ProtocolConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ProtocolConfigTest.java index edec18cac0..983d2bb43f 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ProtocolConfigTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ProtocolConfigTest.java @@ -29,10 +29,10 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.is; -public class ProtocolConfigTest { +class ProtocolConfigTest { @Test - public void testName() throws Exception { + void testName() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setName("name"); Map parameters = new HashMap(); @@ -43,7 +43,7 @@ public class ProtocolConfigTest { } @Test - public void testHost() throws Exception { + void testHost() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setHost("host"); Map parameters = new HashMap(); @@ -53,7 +53,7 @@ public class ProtocolConfigTest { } @Test - public void testPort() throws Exception { + void testPort() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setPort(8080); Map parameters = new HashMap(); @@ -63,7 +63,7 @@ public class ProtocolConfigTest { } @Test - public void testPath() throws Exception { + void testPath() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setContextpath("context-path"); Map parameters = new HashMap(); @@ -77,77 +77,77 @@ public class ProtocolConfigTest { } @Test - public void testThreads() throws Exception { + void testThreads() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setThreads(10); assertThat(protocol.getThreads(), is(10)); } @Test - public void testIothreads() throws Exception { + void testIothreads() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setIothreads(10); assertThat(protocol.getIothreads(), is(10)); } @Test - public void testQueues() throws Exception { + void testQueues() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setQueues(10); assertThat(protocol.getQueues(), is(10)); } @Test - public void testAccepts() throws Exception { + void testAccepts() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setAccepts(10); assertThat(protocol.getAccepts(), is(10)); } @Test - public void testAccesslog() throws Exception { + void testAccesslog() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setAccesslog("access.log"); assertThat(protocol.getAccesslog(), equalTo("access.log")); } @Test - public void testRegister() throws Exception { + void testRegister() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setRegister(true); assertThat(protocol.isRegister(), is(true)); } @Test - public void testParameters() throws Exception { + void testParameters() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setParameters(Collections.singletonMap("k1", "v1")); assertThat(protocol.getParameters(), hasEntry("k1", "v1")); } @Test - public void testDefault() throws Exception { + void testDefault() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setDefault(true); assertThat(protocol.isDefault(), is(true)); } @Test - public void testKeepAlive() throws Exception { + void testKeepAlive() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setKeepAlive(true); assertThat(protocol.getKeepAlive(), is(true)); } @Test - public void testOptimizer() throws Exception { + void testOptimizer() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setOptimizer("optimizer"); assertThat(protocol.getOptimizer(), equalTo("optimizer")); } @Test - public void testExtension() throws Exception { + void testExtension() throws Exception { ProtocolConfig protocol = new ProtocolConfig(); protocol.setExtension("extension"); assertThat(protocol.getExtension(), equalTo("extension")); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ProviderConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ProviderConfigTest.java index fd5fa2dcf3..ccbffaebd3 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ProviderConfigTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ProviderConfigTest.java @@ -30,16 +30,16 @@ import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; -public class ProviderConfigTest { +class ProviderConfigTest { @Test - public void testProtocol() throws Exception { + void testProtocol() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setProtocol("protocol"); assertThat(provider.getProtocol().getName(), equalTo("protocol")); } @Test - public void testDefault() throws Exception { + void testDefault() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setDefault(true); Map parameters = new HashMap(); @@ -49,7 +49,7 @@ public class ProviderConfigTest { } @Test - public void testHost() throws Exception { + void testHost() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setHost("demo-host"); Map parameters = new HashMap(); @@ -59,7 +59,7 @@ public class ProviderConfigTest { } @Test - public void testPort() throws Exception { + void testPort() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setPort(8080); Map parameters = new HashMap(); @@ -69,7 +69,7 @@ public class ProviderConfigTest { } @Test - public void testPath() throws Exception { + void testPath() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setPath("/path"); Map parameters = new HashMap(); @@ -80,7 +80,7 @@ public class ProviderConfigTest { } @Test - public void testContextPath() throws Exception { + void testContextPath() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setContextpath("/context-path"); Map parameters = new HashMap(); @@ -91,70 +91,70 @@ public class ProviderConfigTest { @Test - public void testThreads() throws Exception { + void testThreads() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setThreads(10); assertThat(provider.getThreads(), is(10)); } @Test - public void testIothreads() throws Exception { + void testIothreads() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setIothreads(10); assertThat(provider.getIothreads(), is(10)); } @Test - public void testQueues() throws Exception { + void testQueues() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setQueues(10); assertThat(provider.getQueues(), is(10)); } @Test - public void testAccepts() throws Exception { + void testAccepts() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setAccepts(10); assertThat(provider.getAccepts(), is(10)); } @Test - public void testCharset() throws Exception { + void testCharset() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setCharset("utf-8"); assertThat(provider.getCharset(), equalTo("utf-8")); } @Test - public void testPayload() throws Exception { + void testPayload() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setPayload(10); assertThat(provider.getPayload(), is(10)); } @Test - public void testBuffer() throws Exception { + void testBuffer() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setBuffer(10); assertThat(provider.getBuffer(), is(10)); } @Test - public void testServer() throws Exception { + void testServer() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setServer("demo-server"); assertThat(provider.getServer(), equalTo("demo-server")); } @Test - public void testClient() throws Exception { + void testClient() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setClient("client"); assertThat(provider.getClient(), equalTo("client")); } @Test - public void testPrompt() throws Exception { + void testPrompt() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setPrompt("#"); Map parameters = new HashMap(); @@ -164,21 +164,21 @@ public class ProviderConfigTest { } @Test - public void testDispatcher() throws Exception { + void testDispatcher() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setDispatcher("mockdispatcher"); assertThat(provider.getDispatcher(), equalTo("mockdispatcher")); } @Test - public void testNetworker() throws Exception { + void testNetworker() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setNetworker("networker"); assertThat(provider.getNetworker(), equalTo("networker")); } @Test - public void testWait() throws Exception { + void testWait() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setWait(10); assertThat(provider.getWait(), equalTo(10)); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java index d4a55ab4f8..7eacd6acce 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/ReferenceConfigTest.java @@ -30,7 +30,7 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class ReferenceConfigTest { +class ReferenceConfigTest { private ApplicationConfig application = new ApplicationConfig(); private RegistryConfig registry = new RegistryConfig(); private ProtocolConfig protocol = new ProtocolConfig(); @@ -46,7 +46,7 @@ public class ReferenceConfigTest { } @Test - public void testInjvm() throws Exception { + void testInjvm() throws Exception { application.setName("test-protocol-random-port"); registry.setAddress("multicast://224.5.6.7:1234"); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java index 30452f334f..dd42978cfb 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java @@ -32,16 +32,16 @@ import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.not; -public class RegistryConfigTest { +class RegistryConfigTest { @Test - public void testProtocol() throws Exception { + void testProtocol() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setProtocol("protocol"); assertThat(registry.getProtocol(), equalTo(registry.getProtocol())); } @Test - public void testAddress() throws Exception { + void testAddress() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setAddress("localhost"); assertThat(registry.getAddress(), equalTo("localhost")); @@ -51,21 +51,21 @@ public class RegistryConfigTest { } @Test - public void testUsername() throws Exception { + void testUsername() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setUsername("username"); assertThat(registry.getUsername(), equalTo("username")); } @Test - public void testPassword() throws Exception { + void testPassword() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setPassword("password"); assertThat(registry.getPassword(), equalTo("password")); } @Test - public void testWait() throws Exception { + void testWait() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setWait(10); assertThat(registry.getWait(), is(10)); @@ -73,91 +73,91 @@ public class RegistryConfigTest { } @Test - public void testCheck() throws Exception { + void testCheck() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setCheck(true); assertThat(registry.isCheck(), is(true)); } @Test - public void testFile() throws Exception { + void testFile() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setFile("file"); assertThat(registry.getFile(), equalTo("file")); } @Test - public void testTransporter() throws Exception { + void testTransporter() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setTransporter("transporter"); assertThat(registry.getTransporter(), equalTo("transporter")); } @Test - public void testClient() throws Exception { + void testClient() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setClient("client"); assertThat(registry.getClient(), equalTo("client")); } @Test - public void testTimeout() throws Exception { + void testTimeout() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setTimeout(10); assertThat(registry.getTimeout(), is(10)); } @Test - public void testSession() throws Exception { + void testSession() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setSession(10); assertThat(registry.getSession(), is(10)); } @Test - public void testDynamic() throws Exception { + void testDynamic() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setDynamic(true); assertThat(registry.isDynamic(), is(true)); } @Test - public void testRegister() throws Exception { + void testRegister() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setRegister(true); assertThat(registry.isRegister(), is(true)); } @Test - public void testSubscribe() throws Exception { + void testSubscribe() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setSubscribe(true); assertThat(registry.isSubscribe(), is(true)); } @Test - public void testCluster() throws Exception { + void testCluster() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setCluster("cluster"); assertThat(registry.getCluster(), equalTo("cluster")); } @Test - public void testGroup() throws Exception { + void testGroup() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setGroup("group"); assertThat(registry.getGroup(), equalTo("group")); } @Test - public void testVersion() throws Exception { + void testVersion() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setVersion("1.0.0"); assertThat(registry.getVersion(), equalTo("1.0.0")); } @Test - public void testParameters() throws Exception { + void testParameters() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setParameters(Collections.singletonMap("k1", "v1")); assertThat(registry.getParameters(), hasEntry("k1", "v1")); @@ -167,7 +167,7 @@ public class RegistryConfigTest { } @Test - public void testDefault() throws Exception { + void testDefault() throws Exception { RegistryConfig registry = new RegistryConfig(); registry.setDefault(true); assertThat(registry.isDefault(), is(true)); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/echo/EchoServiceTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/echo/EchoServiceTest.java index b650b40bda..74ad8d6cc6 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/echo/EchoServiceTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/echo/EchoServiceTest.java @@ -30,10 +30,10 @@ import org.apache.dubbo.service.DemoServiceImpl; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class EchoServiceTest { +class EchoServiceTest { @Test - public void testEcho() { + void testEcho() { DemoService server = new DemoServiceImpl(); ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/filter/FilterTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/filter/FilterTest.java index 5463b58c8c..e50d67d650 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/filter/FilterTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/filter/FilterTest.java @@ -29,12 +29,12 @@ import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.fail; -public class FilterTest { +class FilterTest { Filter myFilter = new MyFilter(); @Test - public void testInvokeException() { + void testInvokeException() { try { Invoker invoker = new LegacyInvoker(null); Invocation invocation = new LegacyInvocation("aa"); @@ -46,7 +46,7 @@ public class FilterTest { } @Test - public void testDefault() { + void testDefault() { Invoker invoker = new LegacyInvoker(null); Invocation invocation = new LegacyInvocation("bbb"); Result res = myFilter.invoke(invoker, invocation); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/generic/GenericServiceTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/generic/GenericServiceTest.java index a89b563ab9..1deca6f2e3 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/generic/GenericServiceTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/generic/GenericServiceTest.java @@ -46,7 +46,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -public class GenericServiceTest { +class GenericServiceTest { @BeforeEach public void beforeEach() { @@ -54,7 +54,7 @@ public class GenericServiceTest { } @Test - public void testGeneric() { + void testGeneric() { DemoService server = new DemoServiceImpl(); ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); @@ -74,7 +74,7 @@ public class GenericServiceTest { } @Test - public void testGeneric2() { + void testGeneric2() { DemoService server = new DemoServiceImpl(); ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); @@ -97,7 +97,7 @@ public class GenericServiceTest { } @Test - public void testGenericCompatible() { + void testGenericCompatible() { DubboBootstrap.getInstance() .application("test-app") .initialize(); @@ -124,7 +124,7 @@ public class GenericServiceTest { } @Test - public void testGenericComplexCompute4FullServiceMetadata() { + void testGenericComplexCompute4FullServiceMetadata() { DemoService server = new DemoServiceImpl(); ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); @@ -162,7 +162,7 @@ public class GenericServiceTest { } @Test - public void testGenericFindComplexObject4FullServiceMetadata() { + void testGenericFindComplexObject4FullServiceMetadata() { DemoService server = new DemoServiceImpl(); ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); Protocol protocol = ExtensionLoader.getExtensionLoader(Protocol.class).getAdaptiveExtension(); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/rpc/RpcContextTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/rpc/RpcContextTest.java index d3b521ec94..20c311104e 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/rpc/RpcContextTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/rpc/RpcContextTest.java @@ -25,10 +25,10 @@ import java.util.concurrent.Future; import static org.junit.jupiter.api.Assertions.assertEquals; -public class RpcContextTest { +class RpcContextTest { @Test - public void testSetFuture() { + void testSetFuture() { CompletableFuture completableFuture = new CompletableFuture(); RpcContext.getContext().setFuture(completableFuture); @@ -37,7 +37,7 @@ public class RpcContextTest { } @Test - public void testSetFutureAlibaba() { + void testSetFutureAlibaba() { CompletableFuture completableFuture = new CompletableFuture(); RpcContext.getContext().setFuture(completableFuture); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/rpc/cluster/RouterTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/rpc/cluster/RouterTest.java index 5288c53a23..056bd106fd 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/rpc/cluster/RouterTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/rpc/cluster/RouterTest.java @@ -27,7 +27,7 @@ import java.util.List; /** * */ -public class RouterTest { +class RouterTest { private static List routers = new ArrayList<>(); @@ -42,7 +42,7 @@ public class RouterTest { } @Test - public void testCompareTo () { + void testCompareTo () { try { Collections.sort(routers); Assertions.assertTrue(true); diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/SerializationTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/SerializationTest.java index e53b6a5eb0..9dcfa9114c 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/SerializationTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/serialization/SerializationTest.java @@ -35,7 +35,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; import static org.mockito.Mockito.mock; -public class SerializationTest { +class SerializationTest { private MySerialization mySerialization; @@ -53,29 +53,29 @@ public class SerializationTest { } @Test - public void testContentType() { + void testContentType() { assertThat(mySerialization.getContentType(), is("x-application/my")); } @Test - public void testContentTypeId() { + void testContentTypeId() { assertThat(mySerialization.getContentTypeId(), is((byte) 101)); } @Test - public void testObjectOutput() throws IOException { + void testObjectOutput() throws IOException { ObjectOutput objectOutput = mySerialization.serialize(null, mock(OutputStream.class)); assertThat(objectOutput, Matchers.instanceOf(MyObjectOutput.class)); } @Test - public void testObjectInput() throws IOException { + void testObjectInput() throws IOException { ObjectInput objectInput = mySerialization.deserialize(null, mock(InputStream.class)); assertThat(objectInput, Matchers.instanceOf(MyObjectInput.class)); } @Test - public void testWriteUTF() throws IOException { + void testWriteUTF() throws IOException { myObjectOutput.writeUTF("Pace"); myObjectOutput.writeUTF("和平"); myObjectOutput.writeUTF(" Мир"); diff --git a/dubbo-test/dubbo-test-modules/src/test/java/org/apache/dubbo/dependency/FileTest.java b/dubbo-test/dubbo-test-modules/src/test/java/org/apache/dubbo/dependency/FileTest.java index 1973d98340..e7f7ba606b 100644 --- a/dubbo-test/dubbo-test-modules/src/test/java/org/apache/dubbo/dependency/FileTest.java +++ b/dubbo-test/dubbo-test-modules/src/test/java/org/apache/dubbo/dependency/FileTest.java @@ -36,7 +36,7 @@ import java.util.Objects; import java.util.regex.Pattern; import java.util.stream.Collectors; -public class FileTest { +class FileTest { private final static List ignoredModules = new LinkedList<>(); private final static List ignoredModulesInDubboAll = new LinkedList<>(); @@ -59,7 +59,7 @@ public class FileTest { } @Test - public void checkDubboBom() throws DocumentException { + void checkDubboBom() throws DocumentException { File baseFile = getBaseFile(); List poms = new LinkedList<>(); @@ -98,7 +98,7 @@ public class FileTest { } @Test - public void checkDubboDependenciesAll() throws DocumentException { + void checkDubboDependenciesAll() throws DocumentException { File baseFile = getBaseFile(); List poms = new LinkedList<>(); @@ -137,7 +137,7 @@ public class FileTest { } @Test - public void checkDubboAllDependencies() throws DocumentException { + void checkDubboAllDependencies() throws DocumentException { File baseFile = getBaseFile(); List poms = new LinkedList<>(); @@ -214,7 +214,7 @@ public class FileTest { } @Test - public void checkDubboAllShade() throws DocumentException { + void checkDubboAllShade() throws DocumentException { File baseFile = getBaseFile(); List poms = new LinkedList<>(); @@ -304,7 +304,7 @@ public class FileTest { } @Test - public void checkDubboAllTransform() throws DocumentException { + void checkDubboAllTransform() throws DocumentException { File baseFile = getBaseFile(); List spis = new LinkedList<>(); readSPI(baseFile, spis); @@ -343,7 +343,7 @@ public class FileTest { } @Test - public void checkSpiFiles() { + void checkSpiFiles() { File baseFile = getBaseFile(); List spis = new LinkedList<>(); readSPI(baseFile, spis); From fdb4b21f9a8ada06c54467a3089653c592209601 Mon Sep 17 00:00:00 2001 From: Albumen Kevin Date: Tue, 22 Nov 2022 14:04:32 +0800 Subject: [PATCH 3/3] Refactor some test cases to remove public modifier (#10984) --- .../beanutil/JavaBeanSerializeUtilTest.java | 92 ++++++++++++++++++- .../dubbo/common/utils/PojoUtilsTest.java | 2 +- .../dubbo/config/spring/ConfigTest.java | 2 +- .../schema/DubboNamespaceHandlerTest.java | 5 +- .../codec/CodecAdapterTest.java | 4 +- .../codec/DeprecatedExchangeCodec.java | 2 +- .../codec/DeprecatedTelnetCodec.java | 2 +- .../remoting/codec/ExchangeCodecTest.java | 2 +- 8 files changed, 97 insertions(+), 14 deletions(-) rename dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/{transport => }/codec/CodecAdapterTest.java (90%) rename dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/{transport => }/codec/DeprecatedExchangeCodec.java (99%) rename dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/{transport => }/codec/DeprecatedTelnetCodec.java (99%) diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtilTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtilTest.java index 9231a32c10..64fcf7ade4 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtilTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtilTest.java @@ -16,7 +16,6 @@ */ package org.apache.dubbo.common.beanutil; -import org.apache.dubbo.common.utils.PojoUtilsTest; import org.apache.dubbo.rpc.model.person.BigPerson; import org.apache.dubbo.rpc.model.person.FullAddress; import org.apache.dubbo.rpc.model.person.PersonInfo; @@ -300,12 +299,12 @@ class JavaBeanSerializeUtilTest { @Test void test_Circular_Reference() { - PojoUtilsTest.Parent parent = new PojoUtilsTest.Parent(); + Parent parent = new Parent(); parent.setAge(Integer.MAX_VALUE); parent.setEmail("a@b"); parent.setName("zhangsan"); - PojoUtilsTest.Child child = new PojoUtilsTest.Child(); + Child child = new Child(); child.setAge(100); child.setName("lisi"); child.setParent(parent); @@ -324,6 +323,91 @@ class JavaBeanSerializeUtilTest { assertEqualsPrimitive(child.getAge(), childDescriptor.getProperty("age")); } + public static class Parent { + public String gender; + public String email; + String name; + int age; + Child child; + private String securityEmail; + + public static Parent getNewParent() { + return new Parent(); + } + + public String getEmail() { + return this.securityEmail; + } + + public void setEmail(String email) { + this.securityEmail = email; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public Child getChild() { + return child; + } + + public void setChild(Child child) { + this.child = child; + } + } + + public static class Child { + public String gender; + public int age; + String toy; + Parent parent; + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public String getToy() { + return toy; + } + + public void setToy(String toy) { + this.toy = toy; + } + + public Parent getParent() { + return parent; + } + + public void setParent(Parent parent) { + this.parent = parent; + } + } + @Test void testBeanSerialize() { Bean bean = new Bean(); @@ -544,4 +628,4 @@ class JavaBeanSerializeUtilTest { bigPerson.setInfoProfile(pi); return bigPerson; } -} \ No newline at end of file +} diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/PojoUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/PojoUtilsTest.java index e4b8b15c9c..2c7a0b8032 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/PojoUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/PojoUtilsTest.java @@ -55,7 +55,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; -public class PojoUtilsTest { +class PojoUtilsTest { BigPerson bigPerson; diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ConfigTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ConfigTest.java index 938504aaf4..8eadd48674 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ConfigTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ConfigTest.java @@ -79,7 +79,7 @@ import static org.junit.jupiter.api.Assertions.fail; /** * ConfigTest */ -public class ConfigTest { +class ConfigTest { private static String resourcePath = ConfigTest.class.getPackage().getName().replace('.', '/'); diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/DubboNamespaceHandlerTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/DubboNamespaceHandlerTest.java index fdd8795028..348383715a 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/DubboNamespaceHandlerTest.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/schema/DubboNamespaceHandlerTest.java @@ -27,7 +27,6 @@ import org.apache.dubbo.config.ServiceConfigBase; import org.apache.dubbo.config.bootstrap.DubboBootstrap; import org.apache.dubbo.config.context.ConfigManager; import org.apache.dubbo.config.context.ModuleConfigManager; -import org.apache.dubbo.config.spring.ConfigTest; import org.apache.dubbo.config.spring.ServiceBean; import org.apache.dubbo.config.spring.api.DemoService; import org.apache.dubbo.config.spring.impl.DemoServiceImpl; @@ -58,7 +57,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; class DubboNamespaceHandlerTest { - private static String resourcePath = ConfigTest.class.getPackage().getName().replace('.', '/'); + private static String resourcePath = "org.apache.dubbo.config.spring".replace('.', '/'); @BeforeEach public void setUp() { @@ -301,4 +300,4 @@ class DubboNamespaceHandlerTest { assertEquals(metricsBean.getPrometheus().getPushgateway().getPassword(), "password"); assertEquals(metricsBean.getPrometheus().getPushgateway().getJob(), "job"); } -} \ No newline at end of file +} diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/CodecAdapterTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/CodecAdapterTest.java similarity index 90% rename from dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/CodecAdapterTest.java rename to dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/CodecAdapterTest.java index 928e95e147..60214b2c6f 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/CodecAdapterTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/CodecAdapterTest.java @@ -14,9 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.remoting.transport.codec; +package org.apache.dubbo.remoting.codec; -import org.apache.dubbo.remoting.codec.ExchangeCodecTest; +import org.apache.dubbo.remoting.transport.codec.CodecAdapter; import org.junit.jupiter.api.BeforeEach; diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/DeprecatedExchangeCodec.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/DeprecatedExchangeCodec.java similarity index 99% rename from dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/DeprecatedExchangeCodec.java rename to dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/DeprecatedExchangeCodec.java index 552222db98..5b0425e9d6 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/DeprecatedExchangeCodec.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/DeprecatedExchangeCodec.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.remoting.transport.codec; +package org.apache.dubbo.remoting.codec; import org.apache.dubbo.common.Version; import org.apache.dubbo.common.io.Bytes; diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/DeprecatedTelnetCodec.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/DeprecatedTelnetCodec.java similarity index 99% rename from dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/DeprecatedTelnetCodec.java rename to dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/DeprecatedTelnetCodec.java index 0522565081..7a82e64ddd 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/transport/codec/DeprecatedTelnetCodec.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/DeprecatedTelnetCodec.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.dubbo.remoting.transport.codec; +package org.apache.dubbo.remoting.codec; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.logger.Logger; diff --git a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java index 4342eb468d..bc40fae681 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java +++ b/dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/codec/ExchangeCodecTest.java @@ -61,7 +61,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.READONLY_EVENT; * 4-11 id (long) * 12 -15 datalength */ -public class ExchangeCodecTest extends TelnetCodecTest { +class ExchangeCodecTest extends TelnetCodecTest { // magic header. private static final short MAGIC = (short) 0xdabb; private static final byte MAGIC_HIGH = (byte) Bytes.short2bytes(MAGIC)[0];