Merge branch 'apache-3.1' into 3.1.3-release

This commit is contained in:
Albumen Kevin 2022-11-22 15:03:06 +08:00
commit 8b2cd33765
28 changed files with 241 additions and 156 deletions

View File

@ -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:

View File

@ -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;
}
}
}

View File

@ -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;

View File

@ -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();

View File

@ -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);

View File

@ -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<String, String> parameters = new HashMap<String, String>();

View File

@ -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");

View File

@ -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<DemoService> service = new ServiceConfig<>();
service.setApplication(applicationConfig);
service.setRegistry(registryConfig);

View File

@ -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"));

View File

@ -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));

View File

@ -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));

View File

@ -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<String, String> parameters = new HashMap<String, String>();
@ -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<String, String> parameters = new HashMap<String, String>();
@ -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<String, String> parameters = new HashMap<String, String>();
@ -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<String, String> parameters = new HashMap<String, String>();
@ -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"));

View File

@ -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<String, String> parameters = new HashMap<String, String>();
@ -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<String, String> parameters = new HashMap<String, String>();
@ -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<String, String> parameters = new HashMap<String, String>();
@ -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<String, String> parameters = new HashMap<String, String>();
@ -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<String, String> parameters = new HashMap<String, String>();
@ -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<String, String> parameters = new HashMap<String, String>();
@ -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));

View File

@ -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");

View File

@ -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));

View File

@ -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();

View File

@ -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<FilterTest> invoker = new LegacyInvoker<FilterTest>(null);
Invocation invocation = new LegacyInvocation("aa");
@ -46,7 +46,7 @@ public class FilterTest {
}
@Test
public void testDefault() {
void testDefault() {
Invoker<FilterTest> invoker = new LegacyInvoker<FilterTest>(null);
Invocation invocation = new LegacyInvocation("bbb");
Result res = myFilter.invoke(invoker, invocation);

View File

@ -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();

View File

@ -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);

View File

@ -27,7 +27,7 @@ import java.util.List;
/**
*
*/
public class RouterTest {
class RouterTest {
private static List<Router> routers = new ArrayList<>();
@ -42,7 +42,7 @@ public class RouterTest {
}
@Test
public void testCompareTo () {
void testCompareTo () {
try {
Collections.sort(routers);
Assertions.assertTrue(true);

View File

@ -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.<ObjectOutput>instanceOf(MyObjectOutput.class));
}
@Test
public void testObjectInput() throws IOException {
void testObjectInput() throws IOException {
ObjectInput objectInput = mySerialization.deserialize(null, mock(InputStream.class));
assertThat(objectInput, Matchers.<ObjectInput>instanceOf(MyObjectInput.class));
}
@Test
public void testWriteUTF() throws IOException {
void testWriteUTF() throws IOException {
myObjectOutput.writeUTF("Pace");
myObjectOutput.writeUTF("和平");
myObjectOutput.writeUTF(" Мир");

View File

@ -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('.', '/');

View File

@ -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");
}
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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];

View File

@ -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<Pattern> ignoredModules = new LinkedList<>();
private final static List<Pattern> ignoredModulesInDubboAll = new LinkedList<>();
@ -59,7 +59,7 @@ public class FileTest {
}
@Test
public void checkDubboBom() throws DocumentException {
void checkDubboBom() throws DocumentException {
File baseFile = getBaseFile();
List<File> poms = new LinkedList<>();
@ -98,7 +98,7 @@ public class FileTest {
}
@Test
public void checkDubboDependenciesAll() throws DocumentException {
void checkDubboDependenciesAll() throws DocumentException {
File baseFile = getBaseFile();
List<File> poms = new LinkedList<>();
@ -137,7 +137,7 @@ public class FileTest {
}
@Test
public void checkDubboAllDependencies() throws DocumentException {
void checkDubboAllDependencies() throws DocumentException {
File baseFile = getBaseFile();
List<File> poms = new LinkedList<>();
@ -214,7 +214,7 @@ public class FileTest {
}
@Test
public void checkDubboAllShade() throws DocumentException {
void checkDubboAllShade() throws DocumentException {
File baseFile = getBaseFile();
List<File> poms = new LinkedList<>();
@ -304,7 +304,7 @@ public class FileTest {
}
@Test
public void checkDubboAllTransform() throws DocumentException {
void checkDubboAllTransform() throws DocumentException {
File baseFile = getBaseFile();
List<String> spis = new LinkedList<>();
readSPI(baseFile, spis);
@ -343,7 +343,7 @@ public class FileTest {
}
@Test
public void checkSpiFiles() {
void checkSpiFiles() {
File baseFile = getBaseFile();
List<String> spis = new LinkedList<>();
readSPI(baseFile, spis);