Remove public modifier in metadata and registry (#10980)
This commit is contained in:
parent
38e47c2e54
commit
1fbeed8e55
|
|
@ -71,7 +71,7 @@ class AbstractServiceNameMappingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetAndListener() {
|
||||
void testGetAndListener() {
|
||||
URL registryURL = URL.valueOf("registry://127.0.0.1:7777/test");
|
||||
registryURL = registryURL.addParameter(SUBSCRIBED_SERVICE_NAMES_KEY, "registry-app1");
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
/**
|
||||
* Some construction and filter cases are covered in InMemoryMetadataServiceTest
|
||||
*/
|
||||
public class MetadataInfoTest {
|
||||
class MetadataInfoTest {
|
||||
private static URL url = URL.valueOf("dubbo://30.225.21.30:20880/org.apache.dubbo.registry.service.DemoService2?" +
|
||||
"REGISTRY_CLUSTER=registry1&anyhost=true&application=demo-provider2&delay=5000&deprecated=false&dubbo=2.0.2" +
|
||||
"&dynamic=true&generic=false&group=greeting&interface=org.apache.dubbo.registry.service.DemoService2" +
|
||||
|
|
@ -67,7 +67,7 @@ public class MetadataInfoTest {
|
|||
"&side=provider&timeout=5000×tamp=1629970068002&version=1.0.0¶ms-filter=-customized,excluded");
|
||||
|
||||
@Test
|
||||
public void testEmptyRevision() {
|
||||
void testEmptyRevision() {
|
||||
MetadataInfo metadataInfo = new MetadataInfo("demo");
|
||||
metadataInfo.setApp("demo");
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ public class MetadataInfoTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testParamsFilterIncluded() {
|
||||
void testParamsFilterIncluded() {
|
||||
MetadataInfo metadataInfo = new MetadataInfo("demo");
|
||||
|
||||
// export normal url again
|
||||
|
|
@ -93,7 +93,7 @@ public class MetadataInfoTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testParamsFilterExcluded() {
|
||||
void testParamsFilterExcluded() {
|
||||
MetadataInfo metadataInfo = new MetadataInfo("demo");
|
||||
|
||||
// export normal url again
|
||||
|
|
@ -111,7 +111,7 @@ public class MetadataInfoTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testEqualsAndRevision() {
|
||||
void testEqualsAndRevision() {
|
||||
// same metadata
|
||||
MetadataInfo metadataInfo = new MetadataInfo("demo");
|
||||
metadataInfo.addService(url);
|
||||
|
|
@ -144,7 +144,7 @@ public class MetadataInfoTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testChanged() {
|
||||
void testChanged() {
|
||||
MetadataInfo metadataInfo = new MetadataInfo("demo");
|
||||
metadataInfo.addService(url);
|
||||
metadataInfo.addService(url2);
|
||||
|
|
@ -156,7 +156,7 @@ public class MetadataInfoTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testJsonFormat() {
|
||||
void testJsonFormat() {
|
||||
MetadataInfo metadataInfo = new MetadataInfo("demo");
|
||||
|
||||
// export normal url again
|
||||
|
|
@ -172,7 +172,7 @@ public class MetadataInfoTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testJdkSerialize() throws IOException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
|
||||
void testJdkSerialize() throws IOException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
|
||||
MetadataInfo metadataInfo = new MetadataInfo("demo");
|
||||
|
|
@ -195,7 +195,7 @@ public class MetadataInfoTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCal() {
|
||||
void testCal() {
|
||||
MetadataInfo metadataInfo = new MetadataInfo("demo");
|
||||
|
||||
// export normal url again
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
|||
|
||||
*/
|
||||
/**
|
||||
* {@link ServiceNameMapping} Test
|
||||
* {@link org.apache.dubbo.metadata.ServiceNameMapping} Test
|
||||
*
|
||||
* @since 2.7.8
|
||||
*//*
|
||||
|
||||
public class ServiceNameMappingTest {
|
||||
class ServiceNameMappingTest {
|
||||
|
||||
private static final URL BASE_URL = URL.valueOf("dubbo://127.0.0.1:20880");
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ public class ServiceNameMappingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDeprecatedMethods() {
|
||||
void testDeprecatedMethods() {
|
||||
assertThrows(UnsupportedOperationException.class, () -> {
|
||||
serviceNameMapping.map(null, null, null, null);
|
||||
});
|
||||
|
|
@ -94,7 +94,7 @@ public class ServiceNameMappingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testMap() {
|
||||
void testMap() {
|
||||
String serviceInterface = ServiceNameMapping.class.getName();
|
||||
String key = applicationName;
|
||||
String group = buildGroup(serviceInterface, null, null, null);
|
||||
|
|
@ -104,7 +104,7 @@ public class ServiceNameMappingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGet() {
|
||||
void testGet() {
|
||||
String serviceInterface = ServiceNameMapping.class.getName();
|
||||
URL url = BASE_URL.setServiceInterface(serviceInterface);
|
||||
serviceNameMapping.map(url);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import org.junit.jupiter.api.Assertions;
|
|||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -68,7 +67,7 @@ class MetadataReportInstanceTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
Assertions.assertNull(metadataReportInstance.getMetadataReport(registryId), "the metadata report was not initialized.");
|
||||
assertThat(metadataReportInstance.getMetadataReports(true), Matchers.anEmptyMap());
|
||||
|
||||
|
|
|
|||
|
|
@ -25,13 +25,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
*
|
||||
* @since 2.7.8
|
||||
*/
|
||||
public class KeyTypeEnumTest {
|
||||
class KeyTypeEnumTest {
|
||||
|
||||
/**
|
||||
* {@link KeyTypeEnum#build(String, String...)}
|
||||
*/
|
||||
@Test
|
||||
public void testBuild() {
|
||||
void testBuild() {
|
||||
assertEquals("/A/B/C", KeyTypeEnum.PATH.build("/A", "/B", "C"));
|
||||
assertEquals("A:B:C", KeyTypeEnum.UNIQUE_KEY.build("A", "B", "C"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER_SIDE;
|
|||
/**
|
||||
* 2019/1/7
|
||||
*/
|
||||
public class MetadataIdentifierTest {
|
||||
class MetadataIdentifierTest {
|
||||
|
||||
@Test
|
||||
public void testGetUniqueKey() {
|
||||
void testGetUniqueKey() {
|
||||
String interfaceName = "org.apache.dubbo.metadata.integration.InterfaceNameTestService";
|
||||
String version = "1.0.0.zk.md";
|
||||
String group = null;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
/**
|
||||
* 2018/9/14
|
||||
*/
|
||||
public class AbstractMetadataReportFactoryTest {
|
||||
class AbstractMetadataReportFactoryTest {
|
||||
|
||||
private AbstractMetadataReportFactory metadataReportFactory = new AbstractMetadataReportFactory() {
|
||||
@Override
|
||||
|
|
@ -112,7 +112,7 @@ public class AbstractMetadataReportFactoryTest {
|
|||
};
|
||||
|
||||
@Test
|
||||
public void testGetOneMetadataReport() {
|
||||
void testGetOneMetadataReport() {
|
||||
URL url = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic");
|
||||
MetadataReport metadataReport1 = metadataReportFactory.getMetadataReport(url);
|
||||
MetadataReport metadataReport2 = metadataReportFactory.getMetadataReport(url);
|
||||
|
|
@ -120,7 +120,7 @@ public class AbstractMetadataReportFactoryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetOneMetadataReportForIpFormat() {
|
||||
void testGetOneMetadataReportForIpFormat() {
|
||||
String hostName = NetUtils.getLocalAddress().getHostName();
|
||||
String ip = NetUtils.getIpByHost(hostName);
|
||||
URL url1 = URL.valueOf("zookeeper://" + hostName + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic");
|
||||
|
|
@ -131,7 +131,7 @@ public class AbstractMetadataReportFactoryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetForDiffService() {
|
||||
void testGetForDiffService() {
|
||||
URL url1 = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService1?version=1.0.0&application=vic");
|
||||
URL url2 = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService2?version=1.0.0&application=vic");
|
||||
MetadataReport metadataReport1 = metadataReportFactory.getMetadataReport(url1);
|
||||
|
|
@ -140,7 +140,7 @@ public class AbstractMetadataReportFactoryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetForDiffGroup() {
|
||||
void testGetForDiffGroup() {
|
||||
URL url1 = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic&group=aaa");
|
||||
URL url2 = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic&group=bbb");
|
||||
MetadataReport metadataReport1 = metadataReportFactory.getMetadataReport(url1);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
|||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class AbstractMetadataReportTest {
|
||||
class AbstractMetadataReportTest {
|
||||
|
||||
private NewMetadataReport abstractMetadataReport;
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ public class AbstractMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetProtocol() {
|
||||
void testGetProtocol() {
|
||||
URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic&side=provider");
|
||||
String protocol = abstractMetadataReport.getProtocol(url);
|
||||
assertEquals(protocol, "provider");
|
||||
|
|
@ -78,7 +78,7 @@ public class AbstractMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testStoreProviderUsual() throws ClassNotFoundException, InterruptedException {
|
||||
void testStoreProviderUsual() throws ClassNotFoundException, InterruptedException {
|
||||
String interfaceName = "org.apache.dubbo.metadata.store.InterfaceNameTestService";
|
||||
String version = "1.0.0";
|
||||
String group = null;
|
||||
|
|
@ -89,7 +89,7 @@ public class AbstractMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testStoreProviderSync() throws ClassNotFoundException, InterruptedException {
|
||||
void testStoreProviderSync() throws ClassNotFoundException, InterruptedException {
|
||||
String interfaceName = "org.apache.dubbo.metadata.store.InterfaceNameTestService";
|
||||
String version = "1.0.0";
|
||||
String group = null;
|
||||
|
|
@ -100,7 +100,7 @@ public class AbstractMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFileExistAfterPut() throws InterruptedException, ClassNotFoundException {
|
||||
void testFileExistAfterPut() throws InterruptedException, ClassNotFoundException {
|
||||
//just for one method
|
||||
URL singleUrl = URL.valueOf("redis://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.metadata.store.InterfaceNameTestService?version=1.0.0&application=singleTest");
|
||||
NewMetadataReport singleMetadataReport = new NewMetadataReport(singleUrl);
|
||||
|
|
@ -119,7 +119,7 @@ public class AbstractMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRetry() throws InterruptedException, ClassNotFoundException {
|
||||
void testRetry() throws InterruptedException, ClassNotFoundException {
|
||||
String interfaceName = "org.apache.dubbo.metadata.store.RetryTestService";
|
||||
String version = "1.0.0.retry";
|
||||
String group = null;
|
||||
|
|
@ -148,7 +148,7 @@ public class AbstractMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRetryCancel() throws InterruptedException, ClassNotFoundException {
|
||||
void testRetryCancel() throws InterruptedException, ClassNotFoundException {
|
||||
String interfaceName = "org.apache.dubbo.metadata.store.RetryTestService";
|
||||
String version = "1.0.0.retrycancel";
|
||||
String group = null;
|
||||
|
|
@ -197,7 +197,7 @@ public class AbstractMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testPublishAll() throws ClassNotFoundException, InterruptedException {
|
||||
void testPublishAll() throws ClassNotFoundException, InterruptedException {
|
||||
|
||||
assertTrue(abstractMetadataReport.store.isEmpty());
|
||||
assertTrue(abstractMetadataReport.allMetadataReports.isEmpty());
|
||||
|
|
@ -250,7 +250,7 @@ public class AbstractMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCalculateStartTime() {
|
||||
void testCalculateStartTime() {
|
||||
for (int i = 0; i < 300; i++) {
|
||||
long t = abstractMetadataReport.calculateStartTime() + System.currentTimeMillis();
|
||||
Calendar c = Calendar.getInstance();
|
||||
|
|
|
|||
|
|
@ -37,12 +37,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class JAXRSServiceRestMetadataResolverTest {
|
||||
class JAXRSServiceRestMetadataResolverTest {
|
||||
|
||||
private JAXRSServiceRestMetadataResolver instance = new JAXRSServiceRestMetadataResolver();
|
||||
|
||||
@Test
|
||||
public void testSupports() {
|
||||
void testSupports() {
|
||||
// JAX-RS RestService class
|
||||
assertTrue(instance.supports(StandardRestService.class));
|
||||
// Spring MVC RestService class
|
||||
|
|
@ -56,7 +56,7 @@ public class JAXRSServiceRestMetadataResolverTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testResolve() {
|
||||
void testResolve() {
|
||||
// Generated by "dubbo-metadata-processor"
|
||||
ClassPathServiceRestMetadataReader reader = new ClassPathServiceRestMetadataReader("META-INF/dubbo/jax-rs-service-rest-metadata.json");
|
||||
List<ServiceRestMetadata> serviceRestMetadataList = reader.read();
|
||||
|
|
|
|||
|
|
@ -37,12 +37,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
*
|
||||
* @since 2.7.9
|
||||
*/
|
||||
public class SpringMvcServiceRestMetadataResolverTest {
|
||||
class SpringMvcServiceRestMetadataResolverTest {
|
||||
|
||||
private SpringMvcServiceRestMetadataResolver instance = new SpringMvcServiceRestMetadataResolver();
|
||||
|
||||
@Test
|
||||
public void testSupports() {
|
||||
void testSupports() {
|
||||
// Spring MVC RestService class
|
||||
assertTrue(instance.supports(SpringRestService.class));
|
||||
// JAX-RS RestService class
|
||||
|
|
@ -56,7 +56,7 @@ public class SpringMvcServiceRestMetadataResolverTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testResolve() {
|
||||
void testResolve() {
|
||||
// Generated by "dubbo-metadata-processor"
|
||||
ClassPathServiceRestMetadataReader reader = new ClassPathServiceRestMetadataReader("META-INF/dubbo/spring-mvc-service-rest-metadata.json");
|
||||
List<ServiceRestMetadata> serviceRestMetadataList = reader.read();
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
/**
|
||||
* ZookeeperRegistry
|
||||
*/
|
||||
public class JTestMetadataReport4Test extends AbstractMetadataReport {
|
||||
class JTestMetadataReport4Test extends AbstractMetadataReport {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(JTestMetadataReport4Test.class);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||
/**
|
||||
* 2019-07-01
|
||||
*/
|
||||
public class ProtobufTypeBuilderTest {
|
||||
class ProtobufTypeBuilderTest {
|
||||
@Test
|
||||
public void testProtobufBuilder() {
|
||||
void testProtobufBuilder() {
|
||||
TypeDefinitionBuilder.initBuilders(FrameworkModel.defaultModel());
|
||||
|
||||
// TEST Pb Service metaData builder
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class ArrayTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
|
||||
class ArrayTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
|
||||
|
||||
private ArrayTypeDefinitionBuilder builder;
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ public class ArrayTypeDefinitionBuilderTest extends AbstractAnnotationProcessing
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAccept() {
|
||||
void testAccept() {
|
||||
assertTrue(builder.accept(processingEnv, integersField.asType()));
|
||||
assertTrue(builder.accept(processingEnv, stringsField.asType()));
|
||||
assertTrue(builder.accept(processingEnv, primitiveTypeModelsField.asType()));
|
||||
|
|
@ -83,7 +83,7 @@ public class ArrayTypeDefinitionBuilderTest extends AbstractAnnotationProcessing
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBuild() {
|
||||
void testBuild() {
|
||||
|
||||
buildAndAssertTypeDefinition(processingEnv, integersField, "int[]", "int", builder);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class CollectionTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
|
||||
class CollectionTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
|
||||
|
||||
private CollectionTypeDefinitionBuilder builder;
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ public class CollectionTypeDefinitionBuilderTest extends AbstractAnnotationProce
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAccept() {
|
||||
void testAccept() {
|
||||
assertTrue(builder.accept(processingEnv, stringsField.asType()));
|
||||
assertTrue(builder.accept(processingEnv, colorsField.asType()));
|
||||
assertTrue(builder.accept(processingEnv, primitiveTypeModelsField.asType()));
|
||||
|
|
@ -81,7 +81,7 @@ public class CollectionTypeDefinitionBuilderTest extends AbstractAnnotationProce
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBuild() {
|
||||
void testBuild() {
|
||||
|
||||
buildAndAssertTypeDefinition(processingEnv, stringsField, "java.util.Collection<java.lang.String>", "java.lang.String", builder);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class EnumTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
|
||||
class EnumTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
|
||||
|
||||
private EnumTypeDefinitionBuilder builder;
|
||||
|
||||
|
|
@ -51,13 +51,13 @@ public class EnumTypeDefinitionBuilderTest extends AbstractAnnotationProcessingT
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAccept() {
|
||||
void testAccept() {
|
||||
TypeElement typeElement = getType(Color.class);
|
||||
assertTrue(builder.accept(processingEnv, typeElement.asType()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuild() {
|
||||
void testBuild() {
|
||||
TypeElement typeElement = getType(Color.class);
|
||||
Map<String, TypeDefinition> typeCache = new HashMap<>();
|
||||
TypeDefinition typeDefinition = TypeDefinitionBuilder.build(processingEnv, typeElement, typeCache);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class GeneralTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
|
||||
class GeneralTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
|
||||
|
||||
private GeneralTypeDefinitionBuilder builder;
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ public class GeneralTypeDefinitionBuilderTest extends AbstractAnnotationProcessi
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAccept() {
|
||||
void testAccept() {
|
||||
assertTrue(builder.accept(processingEnv, getType(Model.class).asType()));
|
||||
assertTrue(builder.accept(processingEnv, getType(PrimitiveTypeModel.class).asType()));
|
||||
assertTrue(builder.accept(processingEnv, getType(SimpleTypeModel.class).asType()));
|
||||
|
|
@ -61,7 +61,7 @@ public class GeneralTypeDefinitionBuilderTest extends AbstractAnnotationProcessi
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBuild() {
|
||||
void testBuild() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class MapTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
|
||||
class MapTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
|
||||
|
||||
private MapTypeDefinitionBuilder builder;
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ public class MapTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTe
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAccept() {
|
||||
void testAccept() {
|
||||
assertTrue(builder.accept(processingEnv, stringsField.asType()));
|
||||
assertTrue(builder.accept(processingEnv, colorsField.asType()));
|
||||
assertTrue(builder.accept(processingEnv, primitiveTypeModelsField.asType()));
|
||||
|
|
@ -86,7 +86,7 @@ public class MapTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTe
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBuild() {
|
||||
void testBuild() {
|
||||
|
||||
buildAndAssertTypeDefinition(processingEnv, stringsField,
|
||||
"java.util.Map<java.lang.String,java.lang.String>",
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class PrimitiveTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
|
||||
class PrimitiveTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
|
||||
|
||||
private PrimitiveTypeDefinitionBuilder builder;
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ public class PrimitiveTypeDefinitionBuilderTest extends AbstractAnnotationProces
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAccept() {
|
||||
void testAccept() {
|
||||
assertTrue(builder.accept(processingEnv, zField.asType()));
|
||||
assertTrue(builder.accept(processingEnv, bField.asType()));
|
||||
assertTrue(builder.accept(processingEnv, cField.asType()));
|
||||
|
|
@ -102,7 +102,7 @@ public class PrimitiveTypeDefinitionBuilderTest extends AbstractAnnotationProces
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBuild() {
|
||||
void testBuild() {
|
||||
buildAndAssertTypeDefinition(processingEnv, zField, builder);
|
||||
buildAndAssertTypeDefinition(processingEnv, bField, builder);
|
||||
buildAndAssertTypeDefinition(processingEnv, cField, builder);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class ServiceDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
|
||||
class ServiceDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
|
||||
|
||||
|
||||
@Override
|
||||
|
|
@ -48,7 +48,7 @@ public class ServiceDefinitionBuilderTest extends AbstractAnnotationProcessingTe
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBuild() {
|
||||
void testBuild() {
|
||||
ServiceDefinition serviceDefinition = build(processingEnv, getType(TestServiceImpl.class));
|
||||
assertEquals(TestServiceImpl.class.getTypeName(), serviceDefinition.getCanonicalName());
|
||||
assertEquals("org/apache/dubbo/metadata/tools/TestServiceImpl.class", serviceDefinition.getCodeSource());
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class SimpleTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
|
||||
class SimpleTypeDefinitionBuilderTest extends AbstractAnnotationProcessingTest {
|
||||
|
||||
private SimpleTypeDefinitionBuilder builder;
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ public class SimpleTypeDefinitionBuilderTest extends AbstractAnnotationProcessin
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAccept() {
|
||||
void testAccept() {
|
||||
assertTrue(builder.accept(processingEnv, vField.asType()));
|
||||
assertTrue(builder.accept(processingEnv, zField.asType()));
|
||||
assertTrue(builder.accept(processingEnv, cField.asType()));
|
||||
|
|
@ -129,7 +129,7 @@ public class SimpleTypeDefinitionBuilderTest extends AbstractAnnotationProcessin
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBuild() {
|
||||
void testBuild() {
|
||||
buildAndAssertTypeDefinition(processingEnv, vField, builder);
|
||||
buildAndAssertTypeDefinition(processingEnv, zField, builder);
|
||||
buildAndAssertTypeDefinition(processingEnv, cField, builder);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public abstract class AnnotatedMethodParameterProcessorTest extends AbstractAnno
|
|||
protected abstract String getExpectedAnnotationType();
|
||||
|
||||
@Test
|
||||
public void testGetAnnotationType() {
|
||||
void testGetAnnotationType() {
|
||||
String expectedAnnotationType = getExpectedAnnotationType();
|
||||
assertNull(processor.getAnnotationType());
|
||||
assertEquals(expectedAnnotationType, processor.getAnnotationType());
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class AnnotationUtilsTest extends AbstractAnnotationProcessingTest {
|
||||
class AnnotationUtilsTest extends AbstractAnnotationProcessingTest {
|
||||
|
||||
private TypeElement testType;
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ public class AnnotationUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetAnnotation() {
|
||||
void testGetAnnotation() {
|
||||
AnnotationMirror serviceAnnotation = getAnnotation(testType, Service.class);
|
||||
assertEquals("3.0.0", getAttribute(serviceAnnotation, "version"));
|
||||
assertEquals("test", getAttribute(serviceAnnotation, "group"));
|
||||
|
|
@ -90,7 +90,7 @@ public class AnnotationUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetAnnotations() {
|
||||
void testGetAnnotations() {
|
||||
List<AnnotationMirror> annotations = getAnnotations(testType);
|
||||
Iterator<AnnotationMirror> iterator = annotations.iterator();
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ public class AnnotationUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllAnnotations() {
|
||||
void testGetAllAnnotations() {
|
||||
|
||||
List<AnnotationMirror> annotations = getAllAnnotations(testType);
|
||||
assertEquals(5, annotations.size());
|
||||
|
|
@ -172,7 +172,7 @@ public class AnnotationUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testFindAnnotation() {
|
||||
void testFindAnnotation() {
|
||||
|
||||
assertEquals("org.apache.dubbo.config.annotation.Service", findAnnotation(testType, Service.class).getAnnotationType().toString());
|
||||
assertEquals("com.alibaba.dubbo.config.annotation.Service", findAnnotation(testType, com.alibaba.dubbo.config.annotation.Service.class).getAnnotationType().toString());
|
||||
|
|
@ -193,14 +193,14 @@ public class AnnotationUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFindMetaAnnotation() {
|
||||
void testFindMetaAnnotation() {
|
||||
getAllDeclaredMethods(getType(TestService.class)).forEach(method -> {
|
||||
assertEquals("javax.ws.rs.HttpMethod", findMetaAnnotation(method, "javax.ws.rs.HttpMethod").getAnnotationType().toString());
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAttribute() {
|
||||
void testGetAttribute() {
|
||||
assertEquals("org.apache.dubbo.metadata.tools.TestService", getAttribute(findAnnotation(testType, Service.class), "interfaceName"));
|
||||
assertEquals("org.apache.dubbo.metadata.tools.TestService", getAttribute(findAnnotation(testType, Service.class).getElementValues(), "interfaceName"));
|
||||
assertEquals("/echo", getAttribute(findAnnotation(testType, Path.class), "value"));
|
||||
|
|
@ -217,13 +217,13 @@ public class AnnotationUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetValue() {
|
||||
void testGetValue() {
|
||||
AnnotationMirror pathAnnotation = getAnnotation(getType(TestService.class), Path.class);
|
||||
assertEquals("/echo", getValue(pathAnnotation));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsAnnotationPresent() {
|
||||
void testIsAnnotationPresent() {
|
||||
assertTrue(isAnnotationPresent(testType, "org.apache.dubbo.config.annotation.Service"));
|
||||
assertTrue(isAnnotationPresent(testType, "com.alibaba.dubbo.config.annotation.Service"));
|
||||
assertTrue(isAnnotationPresent(testType, "javax.ws.rs.Path"));
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class FieldUtilsTest extends AbstractAnnotationProcessingTest {
|
||||
class FieldUtilsTest extends AbstractAnnotationProcessingTest {
|
||||
|
||||
private TypeElement testType;
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetDeclaredFields() {
|
||||
void testGetDeclaredFields() {
|
||||
TypeElement type = getType(Model.class);
|
||||
List<VariableElement> fields = getDeclaredFields(type);
|
||||
assertModelFields(fields);
|
||||
|
|
@ -88,7 +88,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllDeclaredFields() {
|
||||
void testGetAllDeclaredFields() {
|
||||
TypeElement type = getType(Model.class);
|
||||
|
||||
List<VariableElement> fields = getAllDeclaredFields(type);
|
||||
|
|
@ -104,7 +104,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetDeclaredField() {
|
||||
void testGetDeclaredField() {
|
||||
TypeElement type = getType(Model.class);
|
||||
testGetDeclaredField(type, "f", float.class);
|
||||
testGetDeclaredField(type, "d", double.class);
|
||||
|
|
@ -124,7 +124,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFindField() {
|
||||
void testFindField() {
|
||||
TypeElement type = getType(Model.class);
|
||||
testFindField(type, "f", float.class);
|
||||
testFindField(type, "d", double.class);
|
||||
|
|
@ -149,7 +149,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsEnumField() {
|
||||
void testIsEnumField() {
|
||||
TypeElement type = getType(Color.class);
|
||||
VariableElement field = findField(type, "RED");
|
||||
assertTrue(isEnumMemberField(field));
|
||||
|
|
@ -168,7 +168,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsNonStaticField() {
|
||||
void testIsNonStaticField() {
|
||||
TypeElement type = getType(Model.class);
|
||||
assertTrue(isNonStaticField(findField(type, "f")));
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsField() {
|
||||
void testIsField() {
|
||||
TypeElement type = getType(Model.class);
|
||||
assertTrue(isField(findField(type, "f")));
|
||||
assertTrue(isField(findField(type, "f"), PRIVATE));
|
||||
|
|
@ -191,7 +191,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetNonStaticFields() {
|
||||
void testGetNonStaticFields() {
|
||||
TypeElement type = getType(Model.class);
|
||||
|
||||
List<VariableElement> fields = getNonStaticFields(type);
|
||||
|
|
@ -205,7 +205,7 @@ public class FieldUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllNonStaticFields() {
|
||||
void testGetAllNonStaticFields() {
|
||||
TypeElement type = getType(Model.class);
|
||||
|
||||
List<VariableElement> fields = getAllNonStaticFields(type);
|
||||
|
|
|
|||
|
|
@ -27,22 +27,22 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class LoggerUtilsTest {
|
||||
class LoggerUtilsTest {
|
||||
|
||||
@Test
|
||||
public void testLogger() {
|
||||
void testLogger() {
|
||||
assertNotNull(LoggerUtils.LOGGER);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInfo() {
|
||||
void testInfo() {
|
||||
info("Hello,World");
|
||||
info("Hello,%s", "World");
|
||||
info("%s,%s", "Hello", "World");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWarn() {
|
||||
void testWarn() {
|
||||
warn("Hello,World");
|
||||
warn("Hello,%s", "World");
|
||||
warn("%s,%s", "Hello", "World");
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class MemberUtilsTest extends AbstractAnnotationProcessingTest {
|
||||
class MemberUtilsTest extends AbstractAnnotationProcessingTest {
|
||||
|
||||
private TypeElement testType;
|
||||
|
||||
|
|
@ -61,13 +61,13 @@ public class MemberUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsPublicNonStatic() {
|
||||
void testIsPublicNonStatic() {
|
||||
assertFalse(isPublicNonStatic(null));
|
||||
methodsIn(getDeclaredMembers(testType.asType())).forEach(method -> assertTrue(isPublicNonStatic(method)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHasModifiers() {
|
||||
void testHasModifiers() {
|
||||
assertFalse(hasModifiers(null));
|
||||
List<? extends Element> members = getAllDeclaredMembers(testType.asType());
|
||||
List<VariableElement> fields = fieldsIn(members);
|
||||
|
|
@ -75,7 +75,7 @@ public class MemberUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDeclaredMembers() {
|
||||
void testDeclaredMembers() {
|
||||
TypeElement type = getType(Model.class);
|
||||
List<? extends Element> members = getDeclaredMembers(type.asType());
|
||||
List<VariableElement> fields = fieldsIn(members);
|
||||
|
|
@ -105,7 +105,7 @@ public class MemberUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testMatchParameterTypes() {
|
||||
void testMatchParameterTypes() {
|
||||
ExecutableElement method = findMethod(testType, "echo", "java.lang.String");
|
||||
assertTrue(matchParameterTypes(method.getParameters(), "java.lang.String"));
|
||||
assertFalse(matchParameterTypes(method.getParameters(), "java.lang.Object"));
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class MethodUtilsTest extends AbstractAnnotationProcessingTest {
|
||||
class MethodUtilsTest extends AbstractAnnotationProcessingTest {
|
||||
|
||||
private TypeElement testType;
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ public class MethodUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDeclaredMethods() {
|
||||
void testDeclaredMethods() {
|
||||
TypeElement type = getType(Model.class);
|
||||
List<ExecutableElement> methods = getDeclaredMethods(type);
|
||||
assertEquals(12, methods.size());
|
||||
|
|
@ -79,13 +79,13 @@ public class MethodUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllDeclaredMethods() {
|
||||
void testGetAllDeclaredMethods() {
|
||||
List<? extends ExecutableElement> methods = doGetAllDeclaredMethods();
|
||||
assertEquals(14, methods.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPublicNonStaticMethods() {
|
||||
void testGetPublicNonStaticMethods() {
|
||||
List<? extends ExecutableElement> methods = getPublicNonStaticMethods(testType, Object.class);
|
||||
assertEquals(14, methods.size());
|
||||
|
||||
|
|
@ -94,19 +94,19 @@ public class MethodUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsMethod() {
|
||||
void testIsMethod() {
|
||||
List<? extends ExecutableElement> methods = getPublicNonStaticMethods(testType, Object.class);
|
||||
assertEquals(14, methods.stream().map(MethodUtils::isMethod).count());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsPublicNonStaticMethod() {
|
||||
void testIsPublicNonStaticMethod() {
|
||||
List<? extends ExecutableElement> methods = getPublicNonStaticMethods(testType, Object.class);
|
||||
assertEquals(14, methods.stream().map(MethodUtils::isPublicNonStaticMethod).count());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindMethod() {
|
||||
void testFindMethod() {
|
||||
TypeElement type = getType(Model.class);
|
||||
// Test methods from java.lang.Object
|
||||
// Object#toString()
|
||||
|
|
@ -161,7 +161,7 @@ public class MethodUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetOverrideMethod() {
|
||||
void testGetOverrideMethod() {
|
||||
List<? extends ExecutableElement> methods = doGetAllDeclaredMethods();
|
||||
|
||||
ExecutableElement overrideMethod = getOverrideMethod(processingEnv, testType, methods.get(0));
|
||||
|
|
@ -174,21 +174,21 @@ public class MethodUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetMethodName() {
|
||||
void testGetMethodName() {
|
||||
ExecutableElement method = findMethod(testType, "echo", "java.lang.String");
|
||||
assertEquals("echo", getMethodName(method));
|
||||
assertNull(getMethodName(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReturnType() {
|
||||
void testReturnType() {
|
||||
ExecutableElement method = findMethod(testType, "echo", "java.lang.String");
|
||||
assertEquals("java.lang.String", getReturnType(method));
|
||||
assertNull(getReturnType(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMatchParameterTypes() {
|
||||
void testMatchParameterTypes() {
|
||||
ExecutableElement method = findMethod(testType, "echo", "java.lang.String");
|
||||
assertArrayEquals(new String[]{"java.lang.String"}, getMethodParameterTypes(method));
|
||||
assertTrue(getMethodParameterTypes(null).length == 0);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest {
|
||||
class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest {
|
||||
|
||||
@Override
|
||||
protected void addCompiledClasses(Set<Class<?>> classesToBeCompiled) {
|
||||
|
|
@ -65,7 +65,7 @@ public class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConstants() {
|
||||
void testConstants() {
|
||||
assertEquals("org.apache.dubbo.config.annotation.DubboService", DUBBO_SERVICE_ANNOTATION_TYPE);
|
||||
assertEquals("org.apache.dubbo.config.annotation.Service", SERVICE_ANNOTATION_TYPE);
|
||||
assertEquals("com.alibaba.dubbo.config.annotation.Service", LEGACY_SERVICE_ANNOTATION_TYPE);
|
||||
|
|
@ -77,7 +77,7 @@ public class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsServiceAnnotationPresent() {
|
||||
void testIsServiceAnnotationPresent() {
|
||||
|
||||
assertTrue(isServiceAnnotationPresent(getType(TestServiceImpl.class)));
|
||||
assertTrue(isServiceAnnotationPresent(getType(GenericTestService.class)));
|
||||
|
|
@ -87,7 +87,7 @@ public class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetAnnotation() {
|
||||
void testGetAnnotation() {
|
||||
TypeElement type = getType(TestServiceImpl.class);
|
||||
assertEquals("org.apache.dubbo.config.annotation.Service", getAnnotation(type).getAnnotationType().toString());
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ public class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testResolveServiceInterfaceName() {
|
||||
void testResolveServiceInterfaceName() {
|
||||
TypeElement type = getType(TestServiceImpl.class);
|
||||
assertEquals("org.apache.dubbo.metadata.tools.TestService", resolveServiceInterfaceName(type, getAnnotation(type)));
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ public class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetVersion() {
|
||||
void testGetVersion() {
|
||||
TypeElement type = getType(TestServiceImpl.class);
|
||||
assertEquals("3.0.0", getVersion(getAnnotation(type)));
|
||||
|
||||
|
|
@ -125,7 +125,7 @@ public class ServiceAnnotationUtilsTest extends AbstractAnnotationProcessingTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetGroup() {
|
||||
void testGetGroup() {
|
||||
TypeElement type = getType(TestServiceImpl.class);
|
||||
assertEquals("test", getGroup(getAnnotation(type)));
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
||||
class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
||||
|
||||
private TypeElement testType;
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsSimpleType() {
|
||||
void testIsSimpleType() {
|
||||
|
||||
assertTrue(isSimpleType(getType(Void.class)));
|
||||
assertTrue(isSimpleType(getType(Boolean.class)));
|
||||
|
|
@ -121,7 +121,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsSameType() {
|
||||
void testIsSameType() {
|
||||
assertTrue(isSameType(getType(Void.class).asType(), "java.lang.Void"));
|
||||
assertFalse(isSameType(getType(String.class).asType(), "java.lang.Void"));
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsArrayType() {
|
||||
void testIsArrayType() {
|
||||
TypeElement type = getType(ArrayTypeModel.class);
|
||||
assertTrue(isArrayType(findField(type.asType(), "integers").asType()));
|
||||
assertTrue(isArrayType(findField(type.asType(), "strings").asType()));
|
||||
|
|
@ -146,7 +146,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsEnumType() {
|
||||
void testIsEnumType() {
|
||||
TypeElement type = getType(Color.class);
|
||||
assertTrue(isEnumType(type.asType()));
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsClassType() {
|
||||
void testIsClassType() {
|
||||
TypeElement type = getType(ArrayTypeModel.class);
|
||||
assertTrue(isClassType(type.asType()));
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsPrimitiveType() {
|
||||
void testIsPrimitiveType() {
|
||||
TypeElement type = getType(PrimitiveTypeModel.class);
|
||||
getDeclaredFields(type.asType())
|
||||
.stream()
|
||||
|
|
@ -184,7 +184,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsInterfaceType() {
|
||||
void testIsInterfaceType() {
|
||||
TypeElement type = getType(CharSequence.class);
|
||||
assertTrue(isInterfaceType(type));
|
||||
assertTrue(isInterfaceType(type.asType()));
|
||||
|
|
@ -198,7 +198,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsAnnotationType() {
|
||||
void testIsAnnotationType() {
|
||||
TypeElement type = getType(Override.class);
|
||||
|
||||
assertTrue(isAnnotationType(type));
|
||||
|
|
@ -213,7 +213,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetHierarchicalTypes() {
|
||||
void testGetHierarchicalTypes() {
|
||||
Set hierarchicalTypes = getHierarchicalTypes(testType.asType(), true, true, true);
|
||||
Iterator iterator = hierarchicalTypes.iterator();
|
||||
assertEquals(8, hierarchicalTypes.size());
|
||||
|
|
@ -288,7 +288,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testGetInterfaces() {
|
||||
void testGetInterfaces() {
|
||||
TypeElement type = getType(Model.class);
|
||||
List<TypeMirror> interfaces = getInterfaces(type);
|
||||
assertTrue(interfaces.isEmpty());
|
||||
|
|
@ -305,7 +305,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllInterfaces() {
|
||||
void testGetAllInterfaces() {
|
||||
Set<? extends TypeMirror> interfaces = getAllInterfaces(testType.asType());
|
||||
assertEquals(4, interfaces.size());
|
||||
Iterator<? extends TypeMirror> iterator = interfaces.iterator();
|
||||
|
|
@ -328,7 +328,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetType() {
|
||||
void testGetType() {
|
||||
TypeElement element = TypeUtils.getType(processingEnv, String.class);
|
||||
assertEquals(element, TypeUtils.getType(processingEnv, element.asType()));
|
||||
assertEquals(element, TypeUtils.getType(processingEnv, "java.lang.String"));
|
||||
|
|
@ -340,7 +340,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetSuperType() {
|
||||
void testGetSuperType() {
|
||||
TypeElement gtsTypeElement = getSuperType(testType);
|
||||
assertEquals(gtsTypeElement, getType(GenericTestService.class));
|
||||
TypeElement dtsTypeElement = getSuperType(gtsTypeElement);
|
||||
|
|
@ -356,7 +356,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllSuperTypes() {
|
||||
void testGetAllSuperTypes() {
|
||||
Set<?> allSuperTypes = getAllSuperTypes(testType);
|
||||
Iterator<?> iterator = allSuperTypes.iterator();
|
||||
assertEquals(3, allSuperTypes.size());
|
||||
|
|
@ -376,7 +376,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsDeclaredType() {
|
||||
void testIsDeclaredType() {
|
||||
assertTrue(isDeclaredType(testType));
|
||||
assertTrue(isDeclaredType(testType.asType()));
|
||||
assertFalse(isDeclaredType((Element) null));
|
||||
|
|
@ -387,7 +387,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOfDeclaredType() {
|
||||
void testOfDeclaredType() {
|
||||
assertEquals(testType.asType(), ofDeclaredType(testType));
|
||||
assertEquals(testType.asType(), ofDeclaredType(testType.asType()));
|
||||
assertEquals(ofDeclaredType(testType), ofDeclaredType(testType.asType()));
|
||||
|
|
@ -397,7 +397,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIsTypeElement() {
|
||||
void testIsTypeElement() {
|
||||
assertTrue(isTypeElement(testType));
|
||||
assertTrue(isTypeElement(testType.asType()));
|
||||
|
||||
|
|
@ -406,7 +406,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOfTypeElement() {
|
||||
void testOfTypeElement() {
|
||||
assertEquals(testType, ofTypeElement(testType));
|
||||
assertEquals(testType, ofTypeElement(testType.asType()));
|
||||
|
||||
|
|
@ -415,7 +415,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOfDeclaredTypes() {
|
||||
void testOfDeclaredTypes() {
|
||||
Set<DeclaredType> declaredTypes = ofDeclaredTypes(asList(getType(String.class), getType(TestServiceImpl.class), getType(Color.class)));
|
||||
assertTrue(declaredTypes.contains(getType(String.class).asType()));
|
||||
assertTrue(declaredTypes.contains(getType(TestServiceImpl.class).asType()));
|
||||
|
|
@ -425,7 +425,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testListDeclaredTypes() {
|
||||
void testListDeclaredTypes() {
|
||||
List<DeclaredType> types = listDeclaredTypes(asList(testType, testType, testType));
|
||||
assertEquals(1, types.size());
|
||||
assertEquals(ofDeclaredType(testType), types.get(0));
|
||||
|
|
@ -435,7 +435,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testListTypeElements() {
|
||||
void testListTypeElements() {
|
||||
List<TypeElement> typeElements = listTypeElements(asList(testType.asType(), ofDeclaredType(testType)));
|
||||
assertEquals(1, typeElements.size());
|
||||
assertEquals(testType, typeElements.get(0));
|
||||
|
|
@ -463,7 +463,7 @@ public class TypeUtilsTest extends AbstractAnnotationProcessingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetResourceName() {
|
||||
void testGetResourceName() {
|
||||
assertEquals("java/lang/String.class", getResourceName("java.lang.String"));
|
||||
assertNull(getResourceName(null));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ import java.io.IOException;
|
|||
/**
|
||||
* The Compiler test case
|
||||
*/
|
||||
public class CompilerTest {
|
||||
class CompilerTest {
|
||||
|
||||
@Test
|
||||
public void testCompile() throws IOException {
|
||||
void testCompile() throws IOException {
|
||||
Compiler compiler = new Compiler();
|
||||
compiler.compile(
|
||||
TestServiceImpl.class,
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ import java.io.IOException;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class DefaultRestServiceTest {
|
||||
class DefaultRestServiceTest {
|
||||
|
||||
@Test
|
||||
public void test() throws IOException {
|
||||
void test() throws IOException {
|
||||
Compiler compiler = new Compiler();
|
||||
compiler.compile(User.class,
|
||||
RestService.class,
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@ import java.io.IOException;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class RestServiceTest {
|
||||
class RestServiceTest {
|
||||
|
||||
@Test
|
||||
public void test() throws IOException {
|
||||
void test() throws IOException {
|
||||
Compiler compiler = new Compiler();
|
||||
compiler.compile(User.class, RestService.class,
|
||||
StandardRestService.class,
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ import java.io.IOException;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class SpringRestServiceTest {
|
||||
class SpringRestServiceTest {
|
||||
|
||||
@Test
|
||||
public void test() throws IOException {
|
||||
void test() throws IOException {
|
||||
Compiler compiler = new Compiler();
|
||||
compiler.compile(User.class, RestService.class, SpringRestService.class);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ import java.io.IOException;
|
|||
*
|
||||
* @since 2.7.6
|
||||
*/
|
||||
public class StandardRestServiceTest {
|
||||
class StandardRestServiceTest {
|
||||
|
||||
@Test
|
||||
public void test() throws IOException {
|
||||
void test() throws IOException {
|
||||
Compiler compiler = new Compiler();
|
||||
compiler.compile(User.class, RestService.class, StandardRestService.class);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER_SIDE;
|
|||
import static org.apache.dubbo.common.constants.CommonConstants.SYNC_REPORT_KEY;
|
||||
import static redis.embedded.RedisServer.newRedisServer;
|
||||
|
||||
public class RedisMetadataReportTest {
|
||||
class RedisMetadataReportTest {
|
||||
|
||||
private static final String
|
||||
REDIS_URL_TEMPLATE = "redis://%slocalhost:%d",
|
||||
|
|
@ -107,12 +107,12 @@ public class RedisMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAsyncStoreProvider() throws ClassNotFoundException {
|
||||
void testAsyncStoreProvider() throws ClassNotFoundException {
|
||||
testStoreProvider(redisMetadataReport, "1.0.0.redis.md.p1", 3000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSyncStoreProvider() throws ClassNotFoundException {
|
||||
void testSyncStoreProvider() throws ClassNotFoundException {
|
||||
testStoreProvider(syncRedisMetadataReport, "1.0.0.redis.md.p2", 3);
|
||||
}
|
||||
|
||||
|
|
@ -146,12 +146,12 @@ public class RedisMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAsyncStoreConsumer() throws ClassNotFoundException {
|
||||
void testAsyncStoreConsumer() throws ClassNotFoundException {
|
||||
testStoreConsumer(redisMetadataReport, "1.0.0.redis.md.c1", 3000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSyncStoreConsumer() throws ClassNotFoundException {
|
||||
void testSyncStoreConsumer() throws ClassNotFoundException {
|
||||
testStoreConsumer(syncRedisMetadataReport, "1.0.0.redis.md.c2", 3);
|
||||
}
|
||||
|
||||
|
|
@ -216,12 +216,12 @@ public class RedisMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAuthRedisMetadata() throws ClassNotFoundException {
|
||||
void testAuthRedisMetadata() throws ClassNotFoundException {
|
||||
testStoreProvider(redisMetadataReport, "1.0.0.redis.md.p1", 3000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWrongAuthRedisMetadata() throws ClassNotFoundException {
|
||||
void testWrongAuthRedisMetadata() throws ClassNotFoundException {
|
||||
registryUrl = registryUrl.setPassword("123456");
|
||||
redisMetadataReport = (RedisMetadataReport) new RedisMetadataReportFactory().createMetadataReport(registryUrl);
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ import static org.apache.dubbo.metadata.ServiceNameMapping.DEFAULT_MAPPING_GROUP
|
|||
/**
|
||||
* 2018/10/9
|
||||
*/
|
||||
public class ZookeeperMetadataReportTest {
|
||||
class ZookeeperMetadataReportTest {
|
||||
private ZookeeperMetadataReport zookeeperMetadataReport;
|
||||
private URL registryUrl;
|
||||
private ZookeeperMetadataReportFactory zookeeperMetadataReportFactory;
|
||||
|
|
@ -78,7 +78,7 @@ public class ZookeeperMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testStoreProvider() throws ClassNotFoundException, InterruptedException {
|
||||
void testStoreProvider() throws ClassNotFoundException, InterruptedException {
|
||||
String interfaceName = "org.apache.dubbo.metadata.store.zookeeper.ZookeeperMetadataReport4TstService";
|
||||
String version = "1.0.0.zk.md";
|
||||
String group = null;
|
||||
|
|
@ -106,7 +106,7 @@ public class ZookeeperMetadataReportTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testConsumer() throws ClassNotFoundException, InterruptedException {
|
||||
void testConsumer() throws ClassNotFoundException, InterruptedException {
|
||||
String interfaceName = "org.apache.dubbo.metadata.store.zookeeper.ZookeeperMetadataReport4TstService";
|
||||
String version = "1.0.0.zk.md";
|
||||
String group = null;
|
||||
|
|
@ -130,7 +130,7 @@ public class ZookeeperMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDoSaveMetadata() throws ExecutionException, InterruptedException {
|
||||
void testDoSaveMetadata() throws ExecutionException, InterruptedException {
|
||||
String interfaceName = "org.apache.dubbo.metadata.store.zookeeper.ZookeeperMetadataReport4TstService";
|
||||
String version = "1.0.0";
|
||||
String group = null;
|
||||
|
|
@ -149,7 +149,7 @@ public class ZookeeperMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDoRemoveMetadata() throws ExecutionException, InterruptedException {
|
||||
void testDoRemoveMetadata() throws ExecutionException, InterruptedException {
|
||||
String interfaceName = "org.apache.dubbo.metadata.store.zookeeper.ZookeeperMetadataReport4TstService";
|
||||
String version = "1.0.0";
|
||||
String group = null;
|
||||
|
|
@ -172,7 +172,7 @@ public class ZookeeperMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDoGetExportedURLs() throws ExecutionException, InterruptedException {
|
||||
void testDoGetExportedURLs() throws ExecutionException, InterruptedException {
|
||||
String interfaceName = "org.apache.dubbo.metadata.store.zookeeper.ZookeeperMetadataReport4TstService";
|
||||
String version = "1.0.0";
|
||||
String group = null;
|
||||
|
|
@ -194,7 +194,7 @@ public class ZookeeperMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDoSaveSubscriberData() throws ExecutionException, InterruptedException {
|
||||
void testDoSaveSubscriberData() throws ExecutionException, InterruptedException {
|
||||
String interfaceName = "org.apache.dubbo.metadata.store.zookeeper.ZookeeperMetadataReport4TstService";
|
||||
String version = "1.0.0";
|
||||
String group = null;
|
||||
|
|
@ -214,7 +214,7 @@ public class ZookeeperMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDoGetSubscribedURLs() throws ExecutionException, InterruptedException {
|
||||
void testDoGetSubscribedURLs() throws ExecutionException, InterruptedException {
|
||||
String interfaceName = "org.apache.dubbo.metadata.store.zookeeper.ZookeeperMetadataReport4TstService";
|
||||
String version = "1.0.0";
|
||||
String group = null;
|
||||
|
|
@ -279,7 +279,7 @@ public class ZookeeperMetadataReportTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testMapping() throws InterruptedException {
|
||||
void testMapping() throws InterruptedException {
|
||||
String serviceKey = ZookeeperMetadataReportTest.class.getName();
|
||||
URL url = URL.valueOf("test://127.0.0.1:8888/" + serviceKey);
|
||||
String appNames = "demo1,demo2";
|
||||
|
|
@ -308,7 +308,7 @@ public class ZookeeperMetadataReportTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAppMetadata() {
|
||||
void testAppMetadata() {
|
||||
String serviceKey = ZookeeperMetadataReportTest.class.getName();
|
||||
String appName = "demo";
|
||||
URL url = URL.valueOf("test://127.0.0.1:8888/" + serviceKey);
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ import static org.mockito.Mockito.times;
|
|||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class ListenerRegistryWrapperTest {
|
||||
class ListenerRegistryWrapperTest {
|
||||
|
||||
@Test
|
||||
public void testSubscribe() {
|
||||
void testSubscribe() {
|
||||
|
||||
Map<String, String> parameters = new HashMap<>();
|
||||
parameters.put(INTERFACE_KEY, DemoService.class.getName());
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ import org.junit.jupiter.api.Test;
|
|||
* RegistryPerformanceTest
|
||||
*
|
||||
*/
|
||||
public class PerformanceRegistryTest {
|
||||
class PerformanceRegistryTest {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PerformanceRegistryTest.class);
|
||||
|
||||
@Test
|
||||
public void testRegistry() {
|
||||
void testRegistry() {
|
||||
// read server info from property
|
||||
if (PerformanceUtils.getProperty("server", null) == null) {
|
||||
logger.warn("Please set -Dserver=127.0.0.1:9090");
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ import org.apache.dubbo.common.extension.ExtensionLoader;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
public class RegistryFactoryWrapperTest {
|
||||
class RegistryFactoryWrapperTest {
|
||||
private RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension();
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
void test() throws Exception {
|
||||
RegistryServiceListener listener1 = Mockito.mock(RegistryServiceListener.class);
|
||||
RegistryServiceListener1.delegate = listener1;
|
||||
RegistryServiceListener listener2 = Mockito.mock(RegistryServiceListener.class);
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ import java.util.List;
|
|||
/**
|
||||
* {@link AbstractServiceDiscoveryFactory}
|
||||
*/
|
||||
public class AbstractServiceDiscoveryFactoryTest {
|
||||
class AbstractServiceDiscoveryFactoryTest {
|
||||
|
||||
@Test
|
||||
public void testGetServiceDiscoveryWithCache() {
|
||||
void testGetServiceDiscoveryWithCache() {
|
||||
ApplicationModel.defaultModel().getApplicationConfigManager().setApplication(new ApplicationConfig("AbstractServiceDiscoveryFactoryTest"));
|
||||
URL url = URL.valueOf("mock://127.0.0.1:8888");
|
||||
ServiceDiscoveryFactory factory = ServiceDiscoveryFactory.getExtension(url);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import static org.junit.jupiter.api.Assertions.assertNotSame;
|
|||
*
|
||||
* @since 2.7.5
|
||||
*/
|
||||
public class DefaultServiceInstanceTest {
|
||||
class DefaultServiceInstanceTest {
|
||||
|
||||
public DefaultServiceInstance instance;
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ public class DefaultServiceInstanceTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSetAndGetValues() {
|
||||
void testSetAndGetValues() {
|
||||
instance.setEnabled(false);
|
||||
instance.setHealthy(false);
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ public class DefaultServiceInstanceTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testInstanceOperations() {
|
||||
void testInstanceOperations() {
|
||||
// test multiple protocols
|
||||
assertEquals(2, instance.getEndpoints().size());
|
||||
DefaultServiceInstance.Endpoint endpoint = getEndpoint(instance, "rest");
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
|||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class InstanceAddressURLTest {
|
||||
class InstanceAddressURLTest {
|
||||
private static URL url = URL.valueOf("dubbo://30.225.21.30:20880/org.apache.dubbo.registry.service.DemoService?" +
|
||||
"REGISTRY_CLUSTER=registry1&anyhost=true&application=demo-provider2&delay=1000&deprecated=false&dubbo=2.0.2" +
|
||||
"&dynamic=true&generic=false&group=greeting&interface=org.apache.dubbo.registry.service.DemoService" +
|
||||
|
|
@ -113,7 +113,7 @@ public class InstanceAddressURLTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test1() {
|
||||
void test1() {
|
||||
// test reading of keys in instance and metadata work fine
|
||||
assertEquals("value1", instanceURL.getParameter("key1"));//return instance key
|
||||
assertNull(instanceURL.getParameter("delay"));// no service key specified
|
||||
|
|
@ -169,7 +169,7 @@ public class InstanceAddressURLTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test2() {
|
||||
void test2() {
|
||||
RpcServiceContext.getServiceContext().setConsumerUrl(null);
|
||||
Assertions.assertNull(instanceURL.getScopeModel());
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ import static org.mockito.Mockito.times;
|
|||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class ServiceDiscoveryRegistryTest {
|
||||
class ServiceDiscoveryRegistryTest {
|
||||
public static final String APP_NAME1 = "app1";
|
||||
public static final String APP_NAME2 = "app2";
|
||||
public static final String APP_NAME3 = "app3";
|
||||
|
|
@ -121,7 +121,7 @@ public class ServiceDiscoveryRegistryTest {
|
|||
* - check=false
|
||||
*/
|
||||
@Test
|
||||
public void testDoSubscribe() {
|
||||
void testDoSubscribe() {
|
||||
ApplicationModel applicationModel = spy(ApplicationModel.defaultModel());
|
||||
when(applicationModel.getDefaultExtension(ServiceNameMapping.class)).thenReturn(mapping);
|
||||
// Exceptional case, no interface-app mapping found
|
||||
|
|
@ -170,7 +170,7 @@ public class ServiceDiscoveryRegistryTest {
|
|||
* - instance listener and service listener rightly mapped
|
||||
*/
|
||||
@Test
|
||||
public void testSubscribeURLs() {
|
||||
void testSubscribeURLs() {
|
||||
// interface to single app mapping
|
||||
Set<String> singleApp = new TreeSet<>();
|
||||
singleApp.add(APP_NAME1);
|
||||
|
|
@ -230,12 +230,12 @@ public class ServiceDiscoveryRegistryTest {
|
|||
* repeat of {@link this#testSubscribeURLs()} with multi threads
|
||||
*/
|
||||
@Test
|
||||
public void testConcurrencySubscribe() {
|
||||
void testConcurrencySubscribe() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnsubscribe() {
|
||||
void testUnsubscribe() {
|
||||
// do subscribe to prepare for unsubscribe verification
|
||||
Set<String> multiApps = new TreeSet<>();
|
||||
multiApps.add(APP_NAME1);
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ import static org.mockito.Mockito.when;
|
|||
* @since 2.7.5
|
||||
*/
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
public class ServiceInstancesChangedListenerTest {
|
||||
class ServiceInstancesChangedListenerTest {
|
||||
|
||||
static List<ServiceInstance> app1Instances;
|
||||
static List<ServiceInstance> app2Instances;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import static org.mockito.Mockito.mock;
|
|||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class MetadataServiceNameMappingTest {
|
||||
class MetadataServiceNameMappingTest {
|
||||
|
||||
private MetadataServiceNameMapping mapping;
|
||||
private URL url;
|
||||
|
|
@ -74,7 +74,7 @@ public class MetadataServiceNameMappingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testMap() {
|
||||
void testMap() {
|
||||
ApplicationModel mockedApplicationModel = spy(applicationModel);
|
||||
|
||||
when(configManager.getMetadataConfigs()).thenReturn(Collections.emptyList());
|
||||
|
|
@ -123,7 +123,7 @@ public class MetadataServiceNameMappingTest {
|
|||
* This test currently doesn't make any sense
|
||||
*/
|
||||
@Test
|
||||
public void testGet() {
|
||||
void testGet() {
|
||||
Set<String> set = new HashSet<>();
|
||||
set.add("app1");
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ public class MetadataServiceNameMappingTest {
|
|||
* Same situation as testGet, so left empty.
|
||||
*/
|
||||
@Test
|
||||
public void testGetAndListen() {
|
||||
void testGetAndListen() {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import org.apache.dubbo.rpc.model.ApplicationModel;
|
|||
*
|
||||
* @since 2.7.5
|
||||
*/
|
||||
public class MetadataServiceURLBuilderTest {
|
||||
class MetadataServiceURLBuilderTest {
|
||||
|
||||
static ServiceInstance serviceInstance = new DefaultServiceInstance("test", "127.0.0.1", 8080, ApplicationModel.defaultModel());
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import static org.hamcrest.Matchers.hasProperty;
|
|||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
public class ProtocolPortsMetadataCustomizerTest {
|
||||
class ProtocolPortsMetadataCustomizerTest {
|
||||
|
||||
public DefaultServiceInstance instance;
|
||||
private MetadataService mockedMetadataService;
|
||||
|
|
@ -80,7 +80,7 @@ public class ProtocolPortsMetadataCustomizerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
ProtocolPortsMetadataCustomizer customizer = new ProtocolPortsMetadataCustomizer();
|
||||
customizer.customize(instance, ApplicationModel.defaultModel());
|
||||
String endpoints = instance.getMetadata().get(ENDPOINTS);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY;
|
|||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
||||
public class ServiceInstanceMetadataCustomizerTest {
|
||||
class ServiceInstanceMetadataCustomizerTest {
|
||||
private static ServiceInstanceMetadataCustomizer serviceInstanceMetadataCustomizer;
|
||||
|
||||
@BeforeAll
|
||||
|
|
@ -49,7 +49,7 @@ public class ServiceInstanceMetadataCustomizerTest {
|
|||
* Only 'include' policy spicified in Customized Filter will take effect
|
||||
*/
|
||||
@Test
|
||||
public void testCustomizeWithIncludeFilters() {
|
||||
void testCustomizeWithIncludeFilters() {
|
||||
ApplicationModel applicationModel = spy(ApplicationModel.defaultModel());
|
||||
ApplicationConfig applicationConfig = new ApplicationConfig("aa");
|
||||
doReturn(applicationConfig).when(applicationModel).getCurrentConfig();
|
||||
|
|
@ -69,7 +69,7 @@ public class ServiceInstanceMetadataCustomizerTest {
|
|||
* Only 'exclude' policies specified in Exclude Filters will take effect
|
||||
*/
|
||||
@Test
|
||||
public void testCustomizeWithExcludeFilters() {
|
||||
void testCustomizeWithExcludeFilters() {
|
||||
ApplicationModel applicationModel = spy(ApplicationModel.defaultModel());
|
||||
ApplicationConfig applicationConfig = new ApplicationConfig("aa");
|
||||
doReturn(applicationConfig).when(applicationModel).getCurrentConfig();
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
*
|
||||
* @since 2.7.5
|
||||
*/
|
||||
public class SpringCloudMetadataServiceURLBuilderTest {
|
||||
class SpringCloudMetadataServiceURLBuilderTest {
|
||||
|
||||
private SpringCloudMetadataServiceURLBuilder builder = new SpringCloudMetadataServiceURLBuilder();
|
||||
|
||||
@Test
|
||||
public void testBuild() {
|
||||
void testBuild() {
|
||||
List<URL> urls = builder.build(new DefaultServiceInstance("127.0.0.1", "test", 8080, ApplicationModel.defaultModel()));
|
||||
assertEquals(0, urls.size());
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
/**
|
||||
* {@link StandardMetadataServiceURLBuilder} Test
|
||||
*/
|
||||
public class StandardMetadataServiceURLBuilderTest {
|
||||
class StandardMetadataServiceURLBuilderTest {
|
||||
|
||||
@BeforeAll
|
||||
public static void setUp() {
|
||||
|
|
@ -50,7 +50,7 @@ public class StandardMetadataServiceURLBuilderTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testBuild() {
|
||||
void testBuild() {
|
||||
ExtensionLoader<MetadataServiceURLBuilder> loader = ApplicationModel.defaultModel()
|
||||
.getExtensionLoader(MetadataServiceURLBuilder.class);
|
||||
MetadataServiceURLBuilder builder = loader.getExtension(StandardMetadataServiceURLBuilder.NAME);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
public class MetaCacheManagerTest {
|
||||
class MetaCacheManagerTest {
|
||||
|
||||
@BeforeEach
|
||||
public void setup() throws URISyntaxException {
|
||||
|
|
@ -50,7 +50,7 @@ public class MetaCacheManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCache() {
|
||||
void testCache() {
|
||||
// ScheduledExecutorService cacheRefreshExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("Dubbo-cache-refresh"));
|
||||
// ExecutorRepository executorRepository = Mockito.mock(ExecutorRepository.class);
|
||||
// when(executorRepository.getCacheRefreshExecutor()).thenReturn(cacheRefreshExecutor);
|
||||
|
|
@ -85,7 +85,7 @@ public class MetaCacheManagerTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testCacheDump() {
|
||||
void testCacheDump() {
|
||||
System.setProperty("dubbo.meta.cache.fileName", "not-exist.dubbo.cache");
|
||||
MetadataInfo metadataInfo3 = JsonUtils.getJson().toJavaObject("{\"app\":\"demo3\",\"services\":{\"greeting/org.apache.dubbo.registry.service.DemoService2:1.0.0:dubbo\":{\"name\":\"org.apache.dubbo.registry.service.DemoService2\",\"group\":\"greeting\",\"version\":\"1.0.0\",\"protocol\":\"dubbo\",\"path\":\"org.apache.dubbo.registry.service.DemoService2\",\"params\":{\"application\":\"demo-provider2\",\"sayHello.timeout\":\"7000\",\"version\":\"1.0.0\",\"timeout\":\"5000\",\"group\":\"greeting\"}},\"greeting/org.apache.dubbo.registry.service.DemoService:1.0.0:dubbo\":{\"name\":\"org.apache.dubbo.registry.service.DemoService\",\"group\":\"greeting\",\"version\":\"1.0.0\",\"protocol\":\"dubbo\",\"path\":\"org.apache.dubbo.registry.service.DemoService\",\"params\":{\"application\":\"demo-provider2\",\"version\":\"1.0.0\",\"timeout\":\"5000\",\"group\":\"greeting\"}}}}\n", MetadataInfo.class);
|
||||
MetaCacheManager cacheManager = new MetaCacheManager();
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ import java.util.List;
|
|||
import static org.apache.dubbo.registry.client.migration.DefaultMigrationAddressComparator.NEW_ADDRESS_SIZE;
|
||||
import static org.apache.dubbo.registry.client.migration.DefaultMigrationAddressComparator.OLD_ADDRESS_SIZE;
|
||||
|
||||
public class DefaultMigrationAddressComparatorTest {
|
||||
class DefaultMigrationAddressComparatorTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
DefaultMigrationAddressComparator comparator = new DefaultMigrationAddressComparator();
|
||||
|
||||
ClusterInvoker newInvoker = Mockito.mock(ClusterInvoker.class);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import org.mockito.Mockito;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class MigrationInvokerTest {
|
||||
class MigrationInvokerTest {
|
||||
@BeforeEach
|
||||
public void before() {
|
||||
FrameworkModel.destroyAll();
|
||||
|
|
@ -55,7 +55,7 @@ public class MigrationInvokerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
RegistryProtocol registryProtocol = Mockito.mock(RegistryProtocol.class);
|
||||
|
||||
ClusterInvoker invoker = Mockito.mock(ClusterInvoker.class);
|
||||
|
|
@ -226,7 +226,7 @@ public class MigrationInvokerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDecide() {
|
||||
void testDecide() {
|
||||
RegistryProtocol registryProtocol = Mockito.mock(RegistryProtocol.class);
|
||||
|
||||
ClusterInvoker invoker = Mockito.mock(ClusterInvoker.class);
|
||||
|
|
@ -286,7 +286,7 @@ public class MigrationInvokerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConcurrency() {
|
||||
void testConcurrency() {
|
||||
// 独立线程
|
||||
|
||||
// 独立线程invoker状态切换
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ import org.junit.jupiter.api.Assertions;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
public class MigrationRuleHandlerTest {
|
||||
class MigrationRuleHandlerTest {
|
||||
@Test
|
||||
public void test() {
|
||||
void test() {
|
||||
MigrationClusterInvoker invoker = Mockito.mock(MigrationClusterInvoker.class);
|
||||
URL url = Mockito.mock(URL.class);
|
||||
Mockito.when(url.getDisplayServiceKey()).thenReturn("test");
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test;
|
|||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
public class MigrationRuleListenerTest {
|
||||
class MigrationRuleListenerTest {
|
||||
|
||||
private String localRule = "key: demo-consumer\n" +
|
||||
"step: APPLICATION_FIRST\n" +
|
||||
|
|
@ -75,7 +75,7 @@ public class MigrationRuleListenerTest {
|
|||
* Check local rule take effect
|
||||
*/
|
||||
@Test
|
||||
public void test() throws InterruptedException {
|
||||
void test() throws InterruptedException {
|
||||
DynamicConfiguration dynamicConfiguration = Mockito.mock(DynamicConfiguration.class);
|
||||
|
||||
ApplicationModel.reset();
|
||||
|
|
@ -110,7 +110,7 @@ public class MigrationRuleListenerTest {
|
|||
* Test listener started without local rule and config center, INIT should be used and no scheduled task should be started.
|
||||
*/
|
||||
@Test
|
||||
public void testWithInitAndNoLocalRule() {
|
||||
void testWithInitAndNoLocalRule() {
|
||||
ApplicationModel.defaultModel().getDefaultModule().getModelEnvironment().setDynamicConfiguration(null);
|
||||
ApplicationModel.defaultModel().getDefaultModule().getModelEnvironment().setLocalMigrationRule("");
|
||||
ApplicationConfig applicationConfig = new ApplicationConfig();
|
||||
|
|
@ -145,7 +145,7 @@ public class MigrationRuleListenerTest {
|
|||
* 2. remote rule change and all invokers gets notified
|
||||
*/
|
||||
@Test
|
||||
public void testWithConfigurationListenerAndLocalRule() throws InterruptedException {
|
||||
void testWithConfigurationListenerAndLocalRule() throws InterruptedException {
|
||||
DynamicConfiguration dynamicConfiguration = Mockito.mock(DynamicConfiguration.class);
|
||||
Mockito.doReturn(remoteRule).when(dynamicConfiguration).getConfig(Mockito.anyString(), Mockito.anyString());
|
||||
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ import static org.mockito.ArgumentMatchers.anyString;
|
|||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class MigrationRuleTest {
|
||||
class MigrationRuleTest {
|
||||
private static ServiceNameMapping mapping = mock(ServiceNameMapping.class);
|
||||
|
||||
@Test
|
||||
public void test_parse() {
|
||||
void test_parse() {
|
||||
when(mapping.getCachedMapping(any(URL.class))).thenReturn(Collections.emptySet());
|
||||
|
||||
String rule = "key: demo-consumer\n" +
|
||||
|
|
|
|||
|
|
@ -40,13 +40,13 @@ import static org.mockito.Mockito.mock;
|
|||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
public class DynamicDirectoryTest {
|
||||
class DynamicDirectoryTest {
|
||||
|
||||
/**
|
||||
* verify simplified consumer url information that needs to be registered
|
||||
*/
|
||||
@Test
|
||||
public void testSimplifiedUrl() {
|
||||
void testSimplifiedUrl() {
|
||||
|
||||
// verify that the consumer url information that needs to be registered is not simplified by default
|
||||
Map<String, String> parameters = new HashMap<>();
|
||||
|
|
@ -112,7 +112,7 @@ public class DynamicDirectoryTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testSubscribe() {
|
||||
void testSubscribe() {
|
||||
|
||||
Map<String, String> parameters = new HashMap<>();
|
||||
parameters.put(INTERFACE_KEY, DemoService.class.getName());
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ import static org.mockito.Mockito.times;
|
|||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class RegistryProtocolTest {
|
||||
class RegistryProtocolTest {
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() throws IOException {
|
||||
|
|
@ -76,7 +76,7 @@ public class RegistryProtocolTest {
|
|||
* verify the generated consumer url information
|
||||
*/
|
||||
@Test
|
||||
public void testConsumerUrlWithoutProtocol() {
|
||||
void testConsumerUrlWithoutProtocol() {
|
||||
ApplicationConfig applicationConfig = new ApplicationConfig();
|
||||
applicationConfig.setName("application1");
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ public class RegistryProtocolTest {
|
|||
* verify that when the protocol is configured, the protocol of consumer url is the configured protocol
|
||||
*/
|
||||
@Test
|
||||
public void testConsumerUrlWithProtocol() {
|
||||
void testConsumerUrlWithProtocol() {
|
||||
ApplicationConfig applicationConfig = new ApplicationConfig();
|
||||
applicationConfig.setName("application1");
|
||||
|
||||
|
|
@ -214,7 +214,7 @@ public class RegistryProtocolTest {
|
|||
* @see FailoverCluster
|
||||
*/
|
||||
@Test
|
||||
public void testReferWithoutGroup() {
|
||||
void testReferWithoutGroup() {
|
||||
ApplicationConfig applicationConfig = new ApplicationConfig();
|
||||
applicationConfig.setName("application1");
|
||||
|
||||
|
|
@ -275,7 +275,7 @@ public class RegistryProtocolTest {
|
|||
* @see MergeableCluster
|
||||
*/
|
||||
@Test
|
||||
public void testReferWithGroup() {
|
||||
void testReferWithGroup() {
|
||||
ApplicationConfig applicationConfig = new ApplicationConfig();
|
||||
applicationConfig.setName("application1");
|
||||
|
||||
|
|
@ -340,7 +340,7 @@ public class RegistryProtocolTest {
|
|||
* @see MigrationRuleListener
|
||||
*/
|
||||
@Test
|
||||
public void testInterceptInvokerForMigrationRuleListener() {
|
||||
void testInterceptInvokerForMigrationRuleListener() {
|
||||
ApplicationConfig applicationConfig = new ApplicationConfig();
|
||||
applicationConfig.setName("application1");
|
||||
|
||||
|
|
@ -405,7 +405,7 @@ public class RegistryProtocolTest {
|
|||
* @see CountRegistryProtocolListener
|
||||
*/
|
||||
@Test
|
||||
public void testInterceptInvokerForCustomRegistryProtocolListener() {
|
||||
void testInterceptInvokerForCustomRegistryProtocolListener() {
|
||||
ApplicationConfig applicationConfig = new ApplicationConfig();
|
||||
applicationConfig.setName("application1");
|
||||
|
||||
|
|
@ -468,7 +468,7 @@ public class RegistryProtocolTest {
|
|||
* verify the registered consumer url
|
||||
*/
|
||||
@Test
|
||||
public void testRegisterConsumerUrl() {
|
||||
void testRegisterConsumerUrl() {
|
||||
ApplicationConfig applicationConfig = new ApplicationConfig();
|
||||
applicationConfig.setName("application1");
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import java.util.List;
|
|||
/**
|
||||
* AbstractRegistryFactoryTest
|
||||
*/
|
||||
public class AbstractRegistryFactoryTest {
|
||||
class AbstractRegistryFactoryTest {
|
||||
|
||||
private AbstractRegistryFactory registryFactory;
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ public class AbstractRegistryFactoryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRegistryFactoryCache() throws Exception {
|
||||
void testRegistryFactoryCache() throws Exception {
|
||||
URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostAddress() + ":2233");
|
||||
Registry registry1 = registryFactory.getRegistry(url);
|
||||
Registry registry2 = registryFactory.getRegistry(url);
|
||||
|
|
@ -109,14 +109,14 @@ public class AbstractRegistryFactoryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRegistryFactoryGroupCache() throws Exception {
|
||||
void testRegistryFactoryGroupCache() throws Exception {
|
||||
Registry registry1 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=aaa"));
|
||||
Registry registry2 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=bbb"));
|
||||
Assertions.assertNotSame(registry1, registry2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDestroyAllRegistries() {
|
||||
void testDestroyAllRegistries() {
|
||||
Registry registry1 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":8888?group=xxx"));
|
||||
Registry registry2 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":9999?group=yyy"));
|
||||
Registry registry3 = new AbstractRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2020?group=yyy")) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import static org.apache.dubbo.common.constants.RegistryConstants.EMPTY_PROTOCOL
|
|||
/**
|
||||
* AbstractRegistryTest
|
||||
*/
|
||||
public class AbstractRegistryTest {
|
||||
class AbstractRegistryTest {
|
||||
|
||||
private URL testUrl;
|
||||
private URL mockUrl;
|
||||
|
|
@ -93,7 +93,7 @@ public class AbstractRegistryTest {
|
|||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testRegister() throws Exception {
|
||||
void testRegister() throws Exception {
|
||||
//test one url
|
||||
abstractRegistry.register(mockUrl);
|
||||
assert abstractRegistry.getRegistered().contains(mockUrl);
|
||||
|
|
@ -109,7 +109,7 @@ public class AbstractRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRegisterIfURLNULL() {
|
||||
void testRegisterIfURLNULL() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
abstractRegistry.register(null);
|
||||
Assertions.fail("register url == null");
|
||||
|
|
@ -122,7 +122,7 @@ public class AbstractRegistryTest {
|
|||
*
|
||||
*/
|
||||
@Test
|
||||
public void testUnregister() {
|
||||
void testUnregister() {
|
||||
//test one unregister
|
||||
URL url = new ServiceConfigURL("dubbo", "192.168.0.1", 2200);
|
||||
abstractRegistry.register(url);
|
||||
|
|
@ -143,7 +143,7 @@ public class AbstractRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testUnregisterIfUrlNull() {
|
||||
void testUnregisterIfUrlNull() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
abstractRegistry.unregister(null);
|
||||
Assertions.fail("unregister url == null");
|
||||
|
|
@ -154,7 +154,7 @@ public class AbstractRegistryTest {
|
|||
* test subscribe and unsubscribe
|
||||
*/
|
||||
@Test
|
||||
public void testSubscribeAndUnsubscribe() {
|
||||
void testSubscribeAndUnsubscribe() {
|
||||
//test subscribe
|
||||
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
|
||||
NotifyListener listener = urls -> notified.set(Boolean.TRUE);
|
||||
|
|
@ -169,7 +169,7 @@ public class AbstractRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSubscribeIfUrlNull() {
|
||||
void testSubscribeIfUrlNull() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
|
||||
NotifyListener listener = urls -> notified.set(Boolean.TRUE);
|
||||
|
|
@ -180,7 +180,7 @@ public class AbstractRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSubscribeIfListenerNull() {
|
||||
void testSubscribeIfListenerNull() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
|
||||
NotifyListener listener = urls -> notified.set(Boolean.TRUE);
|
||||
|
|
@ -191,7 +191,7 @@ public class AbstractRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testUnsubscribeIfUrlNull() {
|
||||
void testUnsubscribeIfUrlNull() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
|
||||
NotifyListener listener = urls -> notified.set(Boolean.TRUE);
|
||||
|
|
@ -201,7 +201,7 @@ public class AbstractRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testUnsubscribeIfNotifyNull() {
|
||||
void testUnsubscribeIfNotifyNull() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
|
||||
URL url = new ServiceConfigURL("dubbo", "192.168.0.1", 2200);
|
||||
|
|
@ -216,7 +216,7 @@ public class AbstractRegistryTest {
|
|||
*
|
||||
*/
|
||||
@Test
|
||||
public void testSubscribe() {
|
||||
void testSubscribe() {
|
||||
// check parameters
|
||||
try {
|
||||
abstractRegistry.subscribe(testUrl, null);
|
||||
|
|
@ -244,7 +244,7 @@ public class AbstractRegistryTest {
|
|||
*
|
||||
*/
|
||||
@Test
|
||||
public void testUnsubscribe() {
|
||||
void testUnsubscribe() {
|
||||
// check parameters
|
||||
try {
|
||||
abstractRegistry.unsubscribe(testUrl, null);
|
||||
|
|
@ -274,7 +274,7 @@ public class AbstractRegistryTest {
|
|||
* {@link org.apache.dubbo.registry.support.AbstractRegistry#recover()}.
|
||||
*/
|
||||
@Test
|
||||
public void testRecover() throws Exception {
|
||||
void testRecover() throws Exception {
|
||||
// test recover nothing
|
||||
abstractRegistry.recover();
|
||||
Assertions.assertFalse(abstractRegistry.getRegistered().contains(testUrl));
|
||||
|
|
@ -292,7 +292,7 @@ public class AbstractRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRecover2() throws Exception {
|
||||
void testRecover2() throws Exception {
|
||||
List<URL> list = getList();
|
||||
abstractRegistry.recover();
|
||||
Assertions.assertEquals(0, abstractRegistry.getRegistered().size());
|
||||
|
|
@ -309,7 +309,7 @@ public class AbstractRegistryTest {
|
|||
* {@link org.apache.dubbo.registry.support.AbstractRegistry#notify(List)}.
|
||||
*/
|
||||
@Test
|
||||
public void testNotify() {
|
||||
void testNotify() {
|
||||
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
|
||||
NotifyListener listener1 = urls -> notified.set(Boolean.TRUE);
|
||||
URL url1 = new ServiceConfigURL("dubbo", "192.168.0.1", 2200, parametersConsumer);
|
||||
|
|
@ -335,7 +335,7 @@ public class AbstractRegistryTest {
|
|||
* test notifyList
|
||||
*/
|
||||
@Test
|
||||
public void testNotifyList() {
|
||||
void testNotifyList() {
|
||||
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
|
||||
NotifyListener listener1 = urls -> notified.set(Boolean.TRUE);
|
||||
URL url1 = new ServiceConfigURL("dubbo", "192.168.0.1", 2200, parametersConsumer);
|
||||
|
|
@ -358,7 +358,7 @@ public class AbstractRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNotifyIfURLNull() {
|
||||
void testNotifyIfURLNull() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
|
||||
NotifyListener listener1 = urls -> notified.set(Boolean.TRUE);
|
||||
|
|
@ -380,7 +380,7 @@ public class AbstractRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNotifyIfNotifyNull() {
|
||||
void testNotifyIfNotifyNull() {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
|
||||
NotifyListener listener1 = urls -> notified.set(Boolean.TRUE);
|
||||
|
|
@ -408,7 +408,7 @@ public class AbstractRegistryTest {
|
|||
*
|
||||
*/
|
||||
@Test
|
||||
public void testNotifyArgs() {
|
||||
void testNotifyArgs() {
|
||||
// check parameters
|
||||
try {
|
||||
abstractRegistry.notify(null, null, null);
|
||||
|
|
@ -444,7 +444,7 @@ public class AbstractRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void filterEmptyTest() {
|
||||
void filterEmptyTest() {
|
||||
// check parameters
|
||||
try {
|
||||
AbstractRegistry.filterEmpty(null, null);
|
||||
|
|
@ -477,7 +477,7 @@ public class AbstractRegistryTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void lookupTest() {
|
||||
void lookupTest() {
|
||||
// loop up before registry
|
||||
try {
|
||||
abstractRegistry.lookup(null);
|
||||
|
|
@ -497,7 +497,7 @@ public class AbstractRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void destroyTest() {
|
||||
void destroyTest() {
|
||||
abstractRegistry.register(testUrl);
|
||||
abstractRegistry.subscribe(testUrl, listener);
|
||||
Assertions.assertEquals(1, abstractRegistry.getRegistered().size());
|
||||
|
|
@ -509,7 +509,7 @@ public class AbstractRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void allTest() {
|
||||
void allTest() {
|
||||
// test all methods
|
||||
List<URL> urls = new ArrayList<>();
|
||||
urls.add(testUrl);
|
||||
|
|
@ -539,7 +539,7 @@ public class AbstractRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void getCacheUrlsTest() {
|
||||
void getCacheUrlsTest() {
|
||||
List<URL> urls = new ArrayList<>();
|
||||
urls.add(testUrl);
|
||||
// check if notify successfully
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import static org.apache.dubbo.registry.Constants.CONSUMER_PROTOCOL;
|
|||
import static org.apache.dubbo.registry.Constants.REGISTRY_RETRY_PERIOD_KEY;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class FailbackRegistryTest {
|
||||
class FailbackRegistryTest {
|
||||
protected final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
private URL serviceUrl;
|
||||
|
|
@ -60,7 +60,7 @@ public class FailbackRegistryTest {
|
|||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testDoRetry() throws Exception {
|
||||
void testDoRetry() throws Exception {
|
||||
|
||||
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ public class FailbackRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDoRetryRegister() throws Exception {
|
||||
void testDoRetryRegister() throws Exception {
|
||||
|
||||
final CountDownLatch latch = new CountDownLatch(1);//All of them are called 4 times. A successful attempt to lose 1. subscribe will not be done
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ public class FailbackRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDoRetrySubscribe() throws Exception {
|
||||
void testDoRetrySubscribe() throws Exception {
|
||||
|
||||
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
|
||||
final CountDownLatch latch = new CountDownLatch(1);//All of them are called 4 times. A successful attempt to lose 1. subscribe will not be done
|
||||
|
|
@ -143,7 +143,7 @@ public class FailbackRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRecover() throws Exception {
|
||||
void testRecover() throws Exception {
|
||||
CountDownLatch countDownLatch = new CountDownLatch(6);
|
||||
final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false);
|
||||
NotifyListener listener = urls -> notified.set(Boolean.TRUE);
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ import static org.hamcrest.CoreMatchers.not;
|
|||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
public class MulticastRegistryFactoryTest {
|
||||
class MulticastRegistryFactoryTest {
|
||||
@Test
|
||||
public void shouldCreateRegistry() {
|
||||
void shouldCreateRegistry() {
|
||||
Registry registry = new MulticastRegistryFactory().createRegistry(URL.valueOf("multicast://239.255.255.255/"));
|
||||
assertThat(registry, not(nullValue()));
|
||||
assertThat(registry.isAvailable(), is(true));
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import java.util.List;
|
|||
/**
|
||||
* 2019-04-30
|
||||
*/
|
||||
public class MultipleRegistry2S2RTest {
|
||||
class MultipleRegistry2S2RTest {
|
||||
|
||||
private static final String SERVICE_NAME = "org.apache.dubbo.registry.MultipleService2S2R";
|
||||
private static final String SERVICE2_NAME = "org.apache.dubbo.registry.MultipleService2S2R2";
|
||||
|
|
@ -68,7 +68,7 @@ public class MultipleRegistry2S2RTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testParamConfig() {
|
||||
void testParamConfig() {
|
||||
|
||||
Assertions.assertEquals(2, multipleRegistry.origReferenceRegistryURLs.size());
|
||||
Assertions.assertTrue(multipleRegistry.origReferenceRegistryURLs.contains(zookeeperConnectionAddress1));
|
||||
|
|
@ -107,7 +107,7 @@ public class MultipleRegistry2S2RTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRegistryAndUnRegistry() throws InterruptedException {
|
||||
void testRegistryAndUnRegistry() throws InterruptedException {
|
||||
URL serviceUrl = URL.valueOf("http2://multiple/" + SERVICE_NAME + "?notify=false&methods=test1,test2&category=providers");
|
||||
// URL serviceUrl2 = URL.valueOf("http2://multiple2/" + SERVICE_NAME + "?notify=false&methods=test1,test2&category=providers");
|
||||
multipleRegistry.register(serviceUrl);
|
||||
|
|
@ -138,7 +138,7 @@ public class MultipleRegistry2S2RTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSubscription() throws InterruptedException {
|
||||
void testSubscription() throws InterruptedException {
|
||||
URL serviceUrl = URL.valueOf("http2://multiple/" + SERVICE2_NAME + "?notify=false&methods=test1,test2&category=providers");
|
||||
// URL serviceUrl2 = URL.valueOf("http2://multiple2/" + SERVICE_NAME + "?notify=false&methods=test1,test2&category=providers");
|
||||
multipleRegistry.register(serviceUrl);
|
||||
|
|
@ -176,7 +176,7 @@ public class MultipleRegistry2S2RTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAggregation() {
|
||||
void testAggregation() {
|
||||
List<URL> result = new ArrayList<URL>();
|
||||
List<URL> listToAggregate = new ArrayList<URL>();
|
||||
URL url1= URL.valueOf("dubbo://127.0.0.1:20880/service1");
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import org.junit.jupiter.api.Test;
|
|||
/**
|
||||
* Test for NacosRegistryFactory
|
||||
*/
|
||||
public class NacosRegistryFactoryTest {
|
||||
class NacosRegistryFactoryTest {
|
||||
|
||||
private NacosRegistryFactory nacosRegistryFactory;
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ public class NacosRegistryFactoryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCreateRegistryCacheKey() {
|
||||
void testCreateRegistryCacheKey() {
|
||||
URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostAddress() + ":8080");
|
||||
String registryCacheKey1 = nacosRegistryFactory.createRegistryCacheKey(url);
|
||||
String registryCacheKey2 = nacosRegistryFactory.createRegistryCacheKey(url);
|
||||
|
|
@ -49,7 +49,7 @@ public class NacosRegistryFactoryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCreateRegistryCacheKeyWithNamespace() {
|
||||
void testCreateRegistryCacheKeyWithNamespace() {
|
||||
URL url = URL.valueOf("dubbo://" + NetUtils.getLocalAddress().getHostAddress() + ":8080?namespace=test");
|
||||
String registryCacheKey1 = nacosRegistryFactory.createRegistryCacheKey(url);
|
||||
String registryCacheKey2 = nacosRegistryFactory.createRegistryCacheKey(url);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import static org.mockito.Mockito.when;
|
|||
/**
|
||||
* Test for NacosRegistry
|
||||
*/
|
||||
public class NacosRegistryTest {
|
||||
class NacosRegistryTest {
|
||||
|
||||
private static final String serviceInterface = "org.apache.dubbo.registry.nacos.NacosService";
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ public class NacosRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRegister() {
|
||||
void testRegister() {
|
||||
NamingService namingService = mock(NacosNamingService.class);
|
||||
try {
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ public class NacosRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testUnRegister() {
|
||||
void testUnRegister() {
|
||||
NamingService namingService = mock(NacosNamingService.class);
|
||||
|
||||
try {
|
||||
|
|
@ -158,7 +158,7 @@ public class NacosRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSubscribe() {
|
||||
void testSubscribe() {
|
||||
NamingService namingService = mock(NacosNamingService.class);
|
||||
|
||||
try {
|
||||
|
|
@ -195,7 +195,7 @@ public class NacosRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testUnSubscribe() {
|
||||
void testUnSubscribe() {
|
||||
NamingService namingService = mock(NacosNamingService.class);
|
||||
|
||||
try {
|
||||
|
|
@ -240,7 +240,7 @@ public class NacosRegistryTest {
|
|||
|
||||
|
||||
@Test
|
||||
public void testIsConformRules() {
|
||||
void testIsConformRules() {
|
||||
NamingService namingService = mock(NacosNamingService.class);
|
||||
URL serviceUrlWithoutCategory = URL.valueOf("nacos://127.0.0.1:3333/" + serviceInterface + "?interface=" +
|
||||
serviceInterface + "¬ify=false&methods=test1,test2&version=1.0.0&group=default");
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test;
|
|||
/**
|
||||
* Test for NacosServiceDiscoveryFactory
|
||||
*/
|
||||
public class NacosServiceDiscoveryFactoryTest {
|
||||
class NacosServiceDiscoveryFactoryTest {
|
||||
|
||||
private NacosServiceDiscoveryFactory nacosServiceDiscoveryFactory;
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ public class NacosServiceDiscoveryFactoryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetServiceDiscoveryWithCache() {
|
||||
void testGetServiceDiscoveryWithCache() {
|
||||
URL url = URL.valueOf("dubbo://test:8080");
|
||||
ServiceDiscovery discovery = nacosServiceDiscoveryFactory.createDiscovery(url);
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ import static org.mockito.Mockito.when;
|
|||
/**
|
||||
* Test for NacosServiceDiscovery
|
||||
*/
|
||||
public class NacosServiceDiscoveryTest {
|
||||
class NacosServiceDiscoveryTest {
|
||||
|
||||
private static final String SERVICE_NAME = "NACOS_SERVICE";
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ public class NacosServiceDiscoveryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDoRegister() throws NacosException {
|
||||
void testDoRegister() throws NacosException {
|
||||
DefaultServiceInstance serviceInstance = createServiceInstance(SERVICE_NAME, LOCALHOST, NetUtils.getAvailablePort());
|
||||
// register
|
||||
nacosServiceDiscovery.doRegister(serviceInstance);
|
||||
|
|
@ -147,7 +147,7 @@ public class NacosServiceDiscoveryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDoUnRegister() throws NacosException {
|
||||
void testDoUnRegister() throws NacosException {
|
||||
// register
|
||||
DefaultServiceInstance serviceInstance = createServiceInstance(SERVICE_NAME, LOCALHOST, NetUtils.getAvailablePort());
|
||||
// register
|
||||
|
|
@ -166,7 +166,7 @@ public class NacosServiceDiscoveryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetServices() throws NacosException {
|
||||
void testGetServices() throws NacosException {
|
||||
DefaultServiceInstance serviceInstance = createServiceInstance(SERVICE_NAME, LOCALHOST, NetUtils.getAvailablePort());
|
||||
// register
|
||||
nacosServiceDiscovery.doRegister(serviceInstance);
|
||||
|
|
@ -187,7 +187,7 @@ public class NacosServiceDiscoveryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAddServiceInstancesChangedListener() {
|
||||
void testAddServiceInstancesChangedListener() {
|
||||
List<ServiceInstance> serviceInstances = new LinkedList<>();
|
||||
// Add Listener
|
||||
nacosServiceDiscovery.addServiceInstancesChangedListener(
|
||||
|
|
|
|||
|
|
@ -34,18 +34,18 @@ import static org.mockito.Mockito.mock;
|
|||
/**
|
||||
* Test for NacosNamingServiceUtils
|
||||
*/
|
||||
public class NacosNamingServiceUtilsTest {
|
||||
class NacosNamingServiceUtilsTest {
|
||||
private static MetadataReport metadataReport = Mockito.mock(MetadataReport.class);
|
||||
|
||||
@Test
|
||||
public void testToInstance() {
|
||||
void testToInstance() {
|
||||
ServiceInstance serviceInstance = mock(ServiceInstance.class);
|
||||
Instance instance = NacosNamingServiceUtils.toInstance(serviceInstance);
|
||||
Assertions.assertNotNull(instance);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToServiceInstance() {
|
||||
void testToServiceInstance() {
|
||||
URL registryUrl = URL.valueOf("test://test:8080/test");
|
||||
Instance instance = new Instance();
|
||||
instance.setServiceName("serviceName");
|
||||
|
|
@ -66,7 +66,7 @@ public class NacosNamingServiceUtilsTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCreateNamingService() {
|
||||
void testCreateNamingService() {
|
||||
URL url = URL.valueOf("test://test:8080/test?backup=backup");
|
||||
NacosNamingServiceWrapper namingService = NacosNamingServiceUtils.createNamingService(url);
|
||||
Assertions.assertNotNull(namingService);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import static org.hamcrest.Matchers.containsString;
|
|||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
public class ZookeeperRegistryTest {
|
||||
class ZookeeperRegistryTest {
|
||||
private static String zookeeperConnectionAddress1;
|
||||
private ZookeeperRegistry zookeeperRegistry;
|
||||
private String service = "org.apache.dubbo.test.injvmServie";
|
||||
|
|
@ -66,7 +66,7 @@ public class ZookeeperRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAnyHost() {
|
||||
void testAnyHost() {
|
||||
Assertions.assertThrows(IllegalStateException.class, () -> {
|
||||
URL errorUrl = URL.valueOf("multicast://0.0.0.0/");
|
||||
new ZookeeperRegistryFactory(ApplicationModel.defaultModel()).createRegistry(errorUrl);
|
||||
|
|
@ -74,7 +74,7 @@ public class ZookeeperRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRegister() {
|
||||
void testRegister() {
|
||||
Set<URL> registered;
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
|
|
@ -88,7 +88,7 @@ public class ZookeeperRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSubscribe() {
|
||||
void testSubscribe() {
|
||||
NotifyListener listener = mock(NotifyListener.class);
|
||||
zookeeperRegistry.subscribe(serviceUrl, listener);
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ public class ZookeeperRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAvailable() {
|
||||
void testAvailable() {
|
||||
zookeeperRegistry.register(serviceUrl);
|
||||
assertThat(zookeeperRegistry.isAvailable(), is(true));
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ public class ZookeeperRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLookup() {
|
||||
void testLookup() {
|
||||
List<URL> lookup = zookeeperRegistry.lookup(serviceUrl);
|
||||
assertThat(lookup.size(), is(1));
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ public class ZookeeperRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLookupIllegalUrl() {
|
||||
void testLookupIllegalUrl() {
|
||||
try {
|
||||
zookeeperRegistry.lookup(null);
|
||||
fail();
|
||||
|
|
@ -133,7 +133,7 @@ public class ZookeeperRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLookupWithException() {
|
||||
void testLookupWithException() {
|
||||
URL errorUrl = URL.valueOf("multicast://0.0.0.0/");
|
||||
Assertions.assertThrows(RpcException.class, () -> zookeeperRegistry.lookup(errorUrl));
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ public class ZookeeperRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testSubscribeAnyValue() throws InterruptedException {
|
||||
void testSubscribeAnyValue() throws InterruptedException {
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
zookeeperRegistry.register(serviceUrl);
|
||||
zookeeperRegistry.subscribe(anyUrl, urls -> latch.countDown());
|
||||
|
|
@ -170,14 +170,14 @@ public class ZookeeperRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDestroy() {
|
||||
void testDestroy() {
|
||||
zookeeperRegistry.destroy();
|
||||
assertThat(zookeeperRegistry.isAvailable(), is(false));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testDoRegisterWithException() {
|
||||
void testDoRegisterWithException() {
|
||||
Assertions.assertThrows(RpcException.class, () -> {
|
||||
URL errorUrl = URL.valueOf("multicast://0.0.0.0/");
|
||||
zookeeperRegistry.doRegister(errorUrl);
|
||||
|
|
@ -185,7 +185,7 @@ public class ZookeeperRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDoUnregisterWithException() {
|
||||
void testDoUnregisterWithException() {
|
||||
Assertions.assertThrows(RpcException.class, () -> {
|
||||
URL errorUrl = URL.valueOf("multicast://0.0.0.0/");
|
||||
zookeeperRegistry.doUnregister(errorUrl);
|
||||
|
|
@ -193,7 +193,7 @@ public class ZookeeperRegistryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDoSubscribeWithException() {
|
||||
void testDoSubscribeWithException() {
|
||||
Assertions.assertThrows(RpcException.class,
|
||||
() -> zookeeperRegistry.doSubscribe(anyUrl, listener));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
* @since 2.7.5
|
||||
*/
|
||||
@DisabledForJreRange(min = JRE.JAVA_16)
|
||||
public class ZookeeperServiceDiscoveryTest {
|
||||
class ZookeeperServiceDiscoveryTest {
|
||||
|
||||
private static final String SERVICE_NAME = "A";
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ public class ZookeeperServiceDiscoveryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRegistration() throws InterruptedException {
|
||||
void testRegistration() throws InterruptedException {
|
||||
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue