[Feature] Support the global registry center in unit tests (#9138)
This commit is contained in:
parent
57ab318ee8
commit
b06e5c2fdb
|
|
@ -21,6 +21,7 @@ package org.apache.dubbo.config;
|
||||||
import org.apache.dubbo.common.utils.StringUtils;
|
import org.apache.dubbo.common.utils.StringUtils;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
@ -60,11 +61,11 @@ public class ConfigCenterConfigTest {
|
||||||
ConfigCenterConfig config = new ConfigCenterConfig();
|
ConfigCenterConfig config = new ConfigCenterConfig();
|
||||||
config.setNamespace("namespace");
|
config.setNamespace("namespace");
|
||||||
config.setGroup("group");
|
config.setGroup("group");
|
||||||
config.setAddress("zookeeper://127.0.0.1:2181");
|
config.setAddress(ZookeeperRegistryCenterConfig.getConnectionAddress());
|
||||||
config.setHighestPriority(null);
|
config.setHighestPriority(null);
|
||||||
config.refresh();
|
config.refresh();
|
||||||
|
|
||||||
Assertions.assertEquals("zookeeper://127.0.0.1:2181/ConfigCenterConfig?check=true&" +
|
Assertions.assertEquals(ZookeeperRegistryCenterConfig.getConnectionAddress()+"/ConfigCenterConfig?check=true&" +
|
||||||
"config-file=dubbo.properties&group=group&" +
|
"config-file=dubbo.properties&group=group&" +
|
||||||
"namespace=namespace&timeout=3000",
|
"namespace=namespace&timeout=3000",
|
||||||
config.toUrl().toFullString()
|
config.toUrl().toFullString()
|
||||||
|
|
@ -74,7 +75,7 @@ public class ConfigCenterConfigTest {
|
||||||
@Test
|
@Test
|
||||||
public void testOverrideConfig() {
|
public void testOverrideConfig() {
|
||||||
|
|
||||||
String zkAddr = "zookeeper://127.0.0.1:2181";
|
String zkAddr = ZookeeperRegistryCenterConfig.getConnectionAddress();
|
||||||
// sysprops has no id
|
// sysprops has no id
|
||||||
SysProps.setProperty("dubbo.config-center.check", "false");
|
SysProps.setProperty("dubbo.config-center.check", "false");
|
||||||
SysProps.setProperty("dubbo.config-center.address", zkAddr);
|
SysProps.setProperty("dubbo.config-center.address", zkAddr);
|
||||||
|
|
@ -116,7 +117,7 @@ public class ConfigCenterConfigTest {
|
||||||
try {
|
try {
|
||||||
//No id but has address
|
//No id but has address
|
||||||
ConfigCenterConfig configCenter = new ConfigCenterConfig();
|
ConfigCenterConfig configCenter = new ConfigCenterConfig();
|
||||||
configCenter.setAddress("zookeeper://127.0.0.1:2181");
|
configCenter.setAddress(ZookeeperRegistryCenterConfig.getConnectionAddress());
|
||||||
|
|
||||||
DubboBootstrap.getInstance()
|
DubboBootstrap.getInstance()
|
||||||
.application("demo-app")
|
.application("demo-app")
|
||||||
|
|
@ -277,7 +278,7 @@ public class ConfigCenterConfigTest {
|
||||||
@Test
|
@Test
|
||||||
public void testAttributes() {
|
public void testAttributes() {
|
||||||
ConfigCenterConfig cc = new ConfigCenterConfig();
|
ConfigCenterConfig cc = new ConfigCenterConfig();
|
||||||
cc.setAddress("zookeeper://127.0.0.1:2181");
|
cc.setAddress(ZookeeperRegistryCenterConfig.getConnectionAddress());
|
||||||
Map<String, String> attributes = new LinkedHashMap<>();
|
Map<String, String> attributes = new LinkedHashMap<>();
|
||||||
ConfigCenterConfig.appendAttributes(attributes, cc);
|
ConfigCenterConfig.appendAttributes(attributes, cc);
|
||||||
|
|
||||||
|
|
@ -291,7 +292,7 @@ public class ConfigCenterConfigTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetAddress() {
|
public void testSetAddress() {
|
||||||
String address = "zookeeper://127.0.0.1:2181";
|
String address = ZookeeperRegistryCenterConfig.getConnectionAddress();
|
||||||
ConfigCenterConfig cc = new ConfigCenterConfig();
|
ConfigCenterConfig cc = new ConfigCenterConfig();
|
||||||
cc.setUsername("user123"); // set username first
|
cc.setUsername("user123"); // set username first
|
||||||
cc.setPassword("pass123");
|
cc.setPassword("pass123");
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,6 @@ import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.config.context.ModuleConfigManager;
|
import org.apache.dubbo.config.context.ModuleConfigManager;
|
||||||
import org.apache.dubbo.config.provider.impl.DemoServiceImpl;
|
import org.apache.dubbo.config.provider.impl.DemoServiceImpl;
|
||||||
import org.apache.dubbo.registry.client.migration.MigrationInvoker;
|
import org.apache.dubbo.registry.client.migration.MigrationInvoker;
|
||||||
import org.apache.dubbo.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.apache.dubbo.rpc.Exporter;
|
import org.apache.dubbo.rpc.Exporter;
|
||||||
import org.apache.dubbo.rpc.Invoker;
|
import org.apache.dubbo.rpc.Invoker;
|
||||||
import org.apache.dubbo.rpc.ProxyFactory;
|
import org.apache.dubbo.rpc.ProxyFactory;
|
||||||
|
|
@ -54,7 +52,6 @@ import demo.MultiClassLoaderServiceResult;
|
||||||
import javassist.CannotCompileException;
|
import javassist.CannotCompileException;
|
||||||
import javassist.CtClass;
|
import javassist.CtClass;
|
||||||
import javassist.NotFoundException;
|
import javassist.NotFoundException;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
@ -127,17 +124,11 @@ public class ReferenceConfigTest {
|
||||||
private static String zkUrl1;
|
private static String zkUrl1;
|
||||||
private static String zkUrl2;
|
private static String zkUrl2;
|
||||||
private static String registryUrl1;
|
private static String registryUrl1;
|
||||||
private static RegistryCenter registryCenter1;
|
|
||||||
private static RegistryCenter registryCenter2;
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll() {
|
public static void beforeAll() {
|
||||||
int zkServerPort1 = NetUtils.getAvailablePort(NetUtils.getRandomPort());
|
int zkServerPort1 = 2181;
|
||||||
registryCenter1 = new ZookeeperSingleRegistryCenter(zkServerPort1);
|
int zkServerPort2 = 2182;
|
||||||
registryCenter1.startup();
|
|
||||||
int zkServerPort2 = NetUtils.getAvailablePort(NetUtils.getRandomPort());
|
|
||||||
registryCenter2 = new ZookeeperSingleRegistryCenter(zkServerPort2);
|
|
||||||
registryCenter2.startup();
|
|
||||||
zkUrl1 = "zookeeper://localhost:" + zkServerPort1;
|
zkUrl1 = "zookeeper://localhost:" + zkServerPort1;
|
||||||
zkUrl2 = "zookeeper://localhost:" + zkServerPort2;
|
zkUrl2 = "zookeeper://localhost:" + zkServerPort2;
|
||||||
registryUrl1 = "registry://localhost:" + zkServerPort1 + "?registry=zookeeper";
|
registryUrl1 = "registry://localhost:" + zkServerPort1 + "?registry=zookeeper";
|
||||||
|
|
@ -156,12 +147,6 @@ public class ReferenceConfigTest {
|
||||||
Mockito.framework().clearInlineMocks();
|
Mockito.framework().clearInlineMocks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
|
||||||
public static void afterAll() {
|
|
||||||
registryCenter1.shutdown();
|
|
||||||
registryCenter2.shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether the configuration required for the aggregation service reference meets expectations
|
* Test whether the configuration required for the aggregation service reference meets expectations
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import org.apache.dubbo.common.utils.UrlUtils;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||||
|
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
@ -202,7 +203,7 @@ public class RegistryConfigTest {
|
||||||
public void testEquals() throws Exception {
|
public void testEquals() throws Exception {
|
||||||
RegistryConfig registry1 = new RegistryConfig();
|
RegistryConfig registry1 = new RegistryConfig();
|
||||||
RegistryConfig registry2 = new RegistryConfig();
|
RegistryConfig registry2 = new RegistryConfig();
|
||||||
registry1.setAddress("zookeeper://127.0.0.1:2182");
|
registry1.setAddress(ZookeeperRegistryCenterConfig.getConnectionAddress2());
|
||||||
registry2.setAddress("zookeeper://127.0.0.1:2183");
|
registry2.setAddress("zookeeper://127.0.0.1:2183");
|
||||||
Assertions.assertNotEquals(registry1, registry2);
|
Assertions.assertNotEquals(registry1, registry2);
|
||||||
}
|
}
|
||||||
|
|
@ -241,7 +242,7 @@ public class RegistryConfigTest {
|
||||||
// process Parameter annotation
|
// process Parameter annotation
|
||||||
AbstractConfig.appendParameters(map, registry);
|
AbstractConfig.appendParameters(map, registry);
|
||||||
// Simulate the check that ZoneAwareClusterInvoker#doInvoke do
|
// Simulate the check that ZoneAwareClusterInvoker#doInvoke do
|
||||||
URL url = UrlUtils.parseURL("zookeeper://127.0.0.1:2181", map);
|
URL url = UrlUtils.parseURL(ZookeeperRegistryCenterConfig.getConnectionAddress1(), map);
|
||||||
Assertions.assertTrue(url.getParameter(PREFERRED_KEY, false));
|
Assertions.assertTrue(url.getParameter(PREFERRED_KEY, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -253,7 +254,7 @@ public class RegistryConfigTest {
|
||||||
// Process Parameter annotation
|
// Process Parameter annotation
|
||||||
AbstractConfig.appendParameters(map, registry);
|
AbstractConfig.appendParameters(map, registry);
|
||||||
// Simulate the check that ZoneAwareClusterInvoker#doInvoke do
|
// Simulate the check that ZoneAwareClusterInvoker#doInvoke do
|
||||||
URL url = UrlUtils.parseURL("zookeeper://127.0.0.1:2181", map);
|
URL url = UrlUtils.parseURL(ZookeeperRegistryCenterConfig.getConnectionAddress1(), map);
|
||||||
Assertions.assertFalse(url.getParameter(PREFERRED_KEY, false));
|
Assertions.assertFalse(url.getParameter(PREFERRED_KEY, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||||
import org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol;
|
import org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol;
|
||||||
|
|
||||||
import org.apache.curator.test.TestingServer;
|
import org.apache.curator.test.TestingServer;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
|
@ -192,7 +193,7 @@ public class DubboBootstrapTest {
|
||||||
MonitorConfig monitorConfig = new MonitorConfig();
|
MonitorConfig monitorConfig = new MonitorConfig();
|
||||||
monitorConfig.setProtocol("registry");
|
monitorConfig.setProtocol("registry");
|
||||||
|
|
||||||
URL url = ConfigValidationUtils.loadMonitor(getTestInterfaceConfig(monitorConfig), URL.valueOf("zookeeper://127.0.0.1:2181"));
|
URL url = ConfigValidationUtils.loadMonitor(getTestInterfaceConfig(monitorConfig), URL.valueOf(ZookeeperRegistryCenterConfig.getConnectionAddress()));
|
||||||
Assertions.assertEquals("dubbo", url.getProtocol());
|
Assertions.assertEquals("dubbo", url.getProtocol());
|
||||||
Assertions.assertEquals("registry", url.getParameter("protocol"));
|
Assertions.assertEquals("registry", url.getParameter("protocol"));
|
||||||
}
|
}
|
||||||
|
|
@ -203,14 +204,14 @@ public class DubboBootstrapTest {
|
||||||
MonitorConfig monitorConfig = new MonitorConfig();
|
MonitorConfig monitorConfig = new MonitorConfig();
|
||||||
monitorConfig.setProtocol("service-discovery-registry");
|
monitorConfig.setProtocol("service-discovery-registry");
|
||||||
|
|
||||||
URL url = ConfigValidationUtils.loadMonitor(getTestInterfaceConfig(monitorConfig), URL.valueOf("zookeeper://127.0.0.1:2181"));
|
URL url = ConfigValidationUtils.loadMonitor(getTestInterfaceConfig(monitorConfig), URL.valueOf(ZookeeperRegistryCenterConfig.getConnectionAddress()));
|
||||||
Assertions.assertEquals("dubbo", url.getProtocol());
|
Assertions.assertEquals("dubbo", url.getProtocol());
|
||||||
Assertions.assertEquals("service-discovery-registry", url.getParameter("protocol"));
|
Assertions.assertEquals("service-discovery-registry", url.getParameter("protocol"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoadUserMonitor_no_monitor() {
|
public void testLoadUserMonitor_no_monitor() {
|
||||||
URL url = ConfigValidationUtils.loadMonitor(getTestInterfaceConfig(null), URL.valueOf("zookeeper://127.0.0.1:2181"));
|
URL url = ConfigValidationUtils.loadMonitor(getTestInterfaceConfig(null), URL.valueOf(ZookeeperRegistryCenterConfig.getConnectionAddress()));
|
||||||
Assertions.assertNull(url);
|
Assertions.assertNull(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -220,7 +221,7 @@ public class DubboBootstrapTest {
|
||||||
MonitorConfig monitorConfig = new MonitorConfig();
|
MonitorConfig monitorConfig = new MonitorConfig();
|
||||||
monitorConfig.setProtocol("user");
|
monitorConfig.setProtocol("user");
|
||||||
|
|
||||||
URL url = ConfigValidationUtils.loadMonitor(getTestInterfaceConfig(monitorConfig), URL.valueOf("zookeeper://127.0.0.1:2181"));
|
URL url = ConfigValidationUtils.loadMonitor(getTestInterfaceConfig(monitorConfig), URL.valueOf(ZookeeperRegistryCenterConfig.getConnectionAddress()));
|
||||||
Assertions.assertEquals("user", url.getProtocol());
|
Assertions.assertEquals("user", url.getProtocol());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -229,7 +230,7 @@ public class DubboBootstrapTest {
|
||||||
// dubbo.monitor.address=user://1.2.3.4:5678?k=v
|
// dubbo.monitor.address=user://1.2.3.4:5678?k=v
|
||||||
MonitorConfig monitorConfig = new MonitorConfig();
|
MonitorConfig monitorConfig = new MonitorConfig();
|
||||||
monitorConfig.setAddress("user://1.2.3.4:5678?param1=value1");
|
monitorConfig.setAddress("user://1.2.3.4:5678?param1=value1");
|
||||||
URL url = ConfigValidationUtils.loadMonitor(getTestInterfaceConfig(monitorConfig), URL.valueOf("zookeeper://127.0.0.1:2181"));
|
URL url = ConfigValidationUtils.loadMonitor(getTestInterfaceConfig(monitorConfig), URL.valueOf(ZookeeperRegistryCenterConfig.getConnectionAddress()));
|
||||||
Assertions.assertEquals("user", url.getProtocol());
|
Assertions.assertEquals("user", url.getProtocol());
|
||||||
Assertions.assertEquals("1.2.3.4:5678", url.getAddress());
|
Assertions.assertEquals("1.2.3.4:5678", url.getAddress());
|
||||||
Assertions.assertEquals("value1", url.getParameter("param1"));
|
Assertions.assertEquals("value1", url.getParameter("param1"));
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ package org.apache.dubbo.config.bootstrap;
|
||||||
|
|
||||||
import org.apache.dubbo.config.MetadataReportConfig;
|
import org.apache.dubbo.config.MetadataReportConfig;
|
||||||
import org.apache.dubbo.config.bootstrap.rest.UserService;
|
import org.apache.dubbo.config.bootstrap.rest.UserService;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dubbo Provider Bootstrap
|
* Dubbo Provider Bootstrap
|
||||||
|
|
@ -35,8 +36,8 @@ public class DubboServiceConsumerBootstrap {
|
||||||
// .registry(builder -> builder.address("eureka://127.0.0.1:8761?registry-type=service&subscribed-services=dubbo-provider-demo"))
|
// .registry(builder -> builder.address("eureka://127.0.0.1:8761?registry-type=service&subscribed-services=dubbo-provider-demo"))
|
||||||
|
|
||||||
// Zookeeper
|
// Zookeeper
|
||||||
.registry("zookeeper", builder -> builder.address("zookeeper://127.0.0.1:2181?registry-type=service&subscribed-services=dubbo-provider-demo"))
|
.registry("zookeeper", builder -> builder.address(ZookeeperRegistryCenterConfig.getConnectionAddress()+"?registry-type=service&subscribed-services=dubbo-provider-demo"))
|
||||||
.metadataReport(new MetadataReportConfig("zookeeper://127.0.0.1:2181"))
|
.metadataReport(new MetadataReportConfig(ZookeeperRegistryCenterConfig.getConnectionAddress()))
|
||||||
|
|
||||||
// Nacos
|
// Nacos
|
||||||
// .registry("nacos", builder -> builder.address("nacos://127.0.0.1:8848?registry.type=service&subscribed.services=dubbo-provider-demo"))
|
// .registry("nacos", builder -> builder.address("nacos://127.0.0.1:8848?registry.type=service&subscribed.services=dubbo-provider-demo"))
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import org.apache.dubbo.config.RegistryConfig;
|
||||||
import org.apache.dubbo.config.ServiceConfig;
|
import org.apache.dubbo.config.ServiceConfig;
|
||||||
import org.apache.dubbo.config.bootstrap.rest.UserService;
|
import org.apache.dubbo.config.bootstrap.rest.UserService;
|
||||||
import org.apache.dubbo.config.bootstrap.rest.UserServiceImpl;
|
import org.apache.dubbo.config.bootstrap.rest.UserServiceImpl;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
|
@ -45,11 +46,11 @@ public class DubboServiceProviderBootstrap {
|
||||||
|
|
||||||
RegistryConfig interfaceRegistry = new RegistryConfig();
|
RegistryConfig interfaceRegistry = new RegistryConfig();
|
||||||
interfaceRegistry.setId("interfaceRegistry");
|
interfaceRegistry.setId("interfaceRegistry");
|
||||||
interfaceRegistry.setAddress("zookeeper://127.0.0.1:2181");
|
interfaceRegistry.setAddress(ZookeeperRegistryCenterConfig.getConnectionAddress());
|
||||||
|
|
||||||
RegistryConfig serviceRegistry = new RegistryConfig();
|
RegistryConfig serviceRegistry = new RegistryConfig();
|
||||||
serviceRegistry.setId("serviceRegistry");
|
serviceRegistry.setId("serviceRegistry");
|
||||||
serviceRegistry.setAddress("zookeeper://127.0.0.1:2181?registry-type=service");
|
serviceRegistry.setAddress(ZookeeperRegistryCenterConfig.getConnectionAddress()+"?registry-type=service");
|
||||||
|
|
||||||
ServiceConfig<EchoService> echoService = new ServiceConfig<>();
|
ServiceConfig<EchoService> echoService = new ServiceConfig<>();
|
||||||
echoService.setInterface(EchoService.class.getName());
|
echoService.setInterface(EchoService.class.getName());
|
||||||
|
|
@ -73,7 +74,7 @@ public class DubboServiceProviderBootstrap {
|
||||||
.registries(Arrays.asList(interfaceRegistry, serviceRegistry))
|
.registries(Arrays.asList(interfaceRegistry, serviceRegistry))
|
||||||
// .registry(RegistryBuilder.newBuilder().address("consul://127.0.0.1:8500?registry.type=service").build())
|
// .registry(RegistryBuilder.newBuilder().address("consul://127.0.0.1:8500?registry.type=service").build())
|
||||||
.protocol(builder -> builder.port(-1).name("dubbo"))
|
.protocol(builder -> builder.port(-1).name("dubbo"))
|
||||||
.metadataReport(new MetadataReportConfig("zookeeper://127.0.0.1:2181"))
|
.metadataReport(new MetadataReportConfig(ZookeeperRegistryCenterConfig.getConnectionAddress()))
|
||||||
.service(echoService)
|
.service(echoService)
|
||||||
.service(userService)
|
.service(userService)
|
||||||
.start()
|
.start()
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ package org.apache.dubbo.config.bootstrap;
|
||||||
|
|
||||||
import org.apache.dubbo.config.bootstrap.rest.UserService;
|
import org.apache.dubbo.config.bootstrap.rest.UserService;
|
||||||
import org.apache.dubbo.config.bootstrap.rest.UserServiceImpl;
|
import org.apache.dubbo.config.bootstrap.rest.UserServiceImpl;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* TODO
|
||||||
|
|
@ -27,7 +28,7 @@ public class DubboServiceProviderMinimumBootstrap {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
DubboBootstrap.getInstance()
|
DubboBootstrap.getInstance()
|
||||||
.application("dubbo-provider-demo")
|
.application("dubbo-provider-demo")
|
||||||
.registry(builder -> builder.address("zookeeper://127.0.0.1:2181?registry-type=service"))
|
.registry(builder -> builder.address(ZookeeperRegistryCenterConfig.getConnectionAddress()+"?registry-type=service"))
|
||||||
// .registry(builder -> builder.address("eureka://127.0.0.1:8761?registry-type=service"))
|
// .registry(builder -> builder.address("eureka://127.0.0.1:8761?registry-type=service"))
|
||||||
.protocol(builder -> builder.port(-1).name("dubbo"))
|
.protocol(builder -> builder.port(-1).name("dubbo"))
|
||||||
.service("echo", builder -> builder.interfaceClass(EchoService.class).ref(new EchoServiceImpl()))
|
.service("echo", builder -> builder.interfaceClass(EchoService.class).ref(new EchoServiceImpl()))
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,13 @@ import org.apache.dubbo.config.api.DemoService;
|
||||||
import org.apache.dubbo.config.api.Greeting;
|
import org.apache.dubbo.config.api.Greeting;
|
||||||
import org.apache.dubbo.config.mock.GreetingLocal2;
|
import org.apache.dubbo.config.mock.GreetingLocal2;
|
||||||
import org.apache.dubbo.config.provider.impl.DemoServiceImpl;
|
import org.apache.dubbo.config.provider.impl.DemoServiceImpl;
|
||||||
import org.apache.dubbo.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||||
import org.apache.dubbo.rpc.model.FrameworkModel;
|
import org.apache.dubbo.rpc.model.FrameworkModel;
|
||||||
import org.apache.dubbo.rpc.model.FrameworkServiceRepository;
|
import org.apache.dubbo.rpc.model.FrameworkServiceRepository;
|
||||||
import org.apache.dubbo.rpc.model.ModuleModel;
|
import org.apache.dubbo.rpc.model.ModuleModel;
|
||||||
import org.apache.dubbo.rpc.model.ServiceDescriptor;
|
import org.apache.dubbo.rpc.model.ServiceDescriptor;
|
||||||
import org.apache.dubbo.test.check.DubboTestChecker;
|
import org.apache.dubbo.test.check.DubboTestChecker;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
|
@ -63,8 +62,6 @@ public class MultiInstanceTest {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(MultiInstanceTest.class);
|
private static final Logger logger = LoggerFactory.getLogger(MultiInstanceTest.class);
|
||||||
|
|
||||||
private static ZookeeperSingleRegistryCenter registryCenter;
|
|
||||||
|
|
||||||
private static RegistryConfig registryConfig;
|
private static RegistryConfig registryConfig;
|
||||||
|
|
||||||
private static DubboTestChecker testChecker;
|
private static DubboTestChecker testChecker;
|
||||||
|
|
@ -73,13 +70,7 @@ public class MultiInstanceTest {
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll() {
|
public static void beforeAll() {
|
||||||
FrameworkModel.destroyAll();
|
FrameworkModel.destroyAll();
|
||||||
registryCenter = new ZookeeperSingleRegistryCenter(NetUtils.getAvailablePort());
|
registryConfig = new RegistryConfig(ZookeeperRegistryCenterConfig.getConnectionAddress1());
|
||||||
registryCenter.startup();
|
|
||||||
RegistryCenter.Instance instance = registryCenter.getRegistryCenterInstance().get(0);
|
|
||||||
registryConfig = new RegistryConfig(String.format("%s://%s:%s",
|
|
||||||
instance.getType(),
|
|
||||||
instance.getHostname(),
|
|
||||||
instance.getPort()));
|
|
||||||
|
|
||||||
// pre-check threads
|
// pre-check threads
|
||||||
//precheckUnclosedThreads();
|
//precheckUnclosedThreads();
|
||||||
|
|
@ -87,7 +78,6 @@ public class MultiInstanceTest {
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void afterAll() throws Exception {
|
public static void afterAll() throws Exception {
|
||||||
registryCenter.shutdown();
|
|
||||||
FrameworkModel.destroyAll();
|
FrameworkModel.destroyAll();
|
||||||
|
|
||||||
// check threads
|
// check threads
|
||||||
|
|
@ -321,7 +311,6 @@ public class MultiInstanceTest {
|
||||||
|
|
||||||
DubboBootstrap providerBootstrap1 = null;
|
DubboBootstrap providerBootstrap1 = null;
|
||||||
DubboBootstrap providerBootstrap2 = null;
|
DubboBootstrap providerBootstrap2 = null;
|
||||||
ZookeeperSingleRegistryCenter registryCenter2 = null;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
@ -349,13 +338,7 @@ public class MultiInstanceTest {
|
||||||
Assertions.assertTrue(stackTraces1.size() > 0, "Get threads of provider app 1 failed");
|
Assertions.assertTrue(stackTraces1.size() > 0, "Get threads of provider app 1 failed");
|
||||||
|
|
||||||
// start zk server 2
|
// start zk server 2
|
||||||
registryCenter2 = new ZookeeperSingleRegistryCenter(NetUtils.getAvailablePort());
|
RegistryConfig registryConfig2 = new RegistryConfig(ZookeeperRegistryCenterConfig.getConnectionAddress2());
|
||||||
registryCenter2.startup();
|
|
||||||
RegistryCenter.Instance instance = registryCenter2.getRegistryCenterInstance().get(0);
|
|
||||||
RegistryConfig registryConfig2 = new RegistryConfig(String.format("%s://%s:%s",
|
|
||||||
instance.getType(),
|
|
||||||
instance.getHostname(),
|
|
||||||
instance.getPort()));
|
|
||||||
|
|
||||||
// start provider app 2 use a difference zk server 2
|
// start provider app 2 use a difference zk server 2
|
||||||
ServiceConfig serviceConfig2 = new ServiceConfig();
|
ServiceConfig serviceConfig2 = new ServiceConfig();
|
||||||
|
|
@ -388,7 +371,6 @@ public class MultiInstanceTest {
|
||||||
// stop provider app 2 and check threads
|
// stop provider app 2 and check threads
|
||||||
providerBootstrap2.stop();
|
providerBootstrap2.stop();
|
||||||
// shutdown register center after dubbo application to avoid unregister services blocking
|
// shutdown register center after dubbo application to avoid unregister services blocking
|
||||||
registryCenter2.shutdown();
|
|
||||||
checkUnclosedThreadsOfApp(stackTraces2, "Found unclosed threads of app 2: ", null);
|
checkUnclosedThreadsOfApp(stackTraces2, "Found unclosed threads of app 2: ", null);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -398,9 +380,6 @@ public class MultiInstanceTest {
|
||||||
if (providerBootstrap2 != null) {
|
if (providerBootstrap2 != null) {
|
||||||
providerBootstrap2.stop();
|
providerBootstrap2.stop();
|
||||||
}
|
}
|
||||||
if (registryCenter2 != null) {
|
|
||||||
registryCenter2.shutdown();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
package org.apache.dubbo.config.bootstrap;
|
package org.apache.dubbo.config.bootstrap;
|
||||||
|
|
||||||
import org.apache.dubbo.config.bootstrap.rest.UserService;
|
import org.apache.dubbo.config.bootstrap.rest.UserService;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
|
|
||||||
import static org.apache.dubbo.common.constants.CommonConstants.COMPOSITE_METADATA_STORAGE_TYPE;
|
import static org.apache.dubbo.common.constants.CommonConstants.COMPOSITE_METADATA_STORAGE_TYPE;
|
||||||
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_TYPE_KEY;
|
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_TYPE_KEY;
|
||||||
|
|
@ -33,7 +34,7 @@ public class ZookeeperDubboServiceConsumerBootstrap {
|
||||||
|
|
||||||
DubboBootstrap bootstrap = DubboBootstrap.getInstance()
|
DubboBootstrap bootstrap = DubboBootstrap.getInstance()
|
||||||
.application("zookeeper-dubbo-consumer", app -> app.metadata(COMPOSITE_METADATA_STORAGE_TYPE))
|
.application("zookeeper-dubbo-consumer", app -> app.metadata(COMPOSITE_METADATA_STORAGE_TYPE))
|
||||||
.registry("zookeeper", builder -> builder.address("zookeeper://127.0.0.1:2181")
|
.registry("zookeeper", builder -> builder.address(ZookeeperRegistryCenterConfig.getConnectionAddress())
|
||||||
.parameter(REGISTRY_TYPE_KEY, SERVICE_REGISTRY_TYPE)
|
.parameter(REGISTRY_TYPE_KEY, SERVICE_REGISTRY_TYPE)
|
||||||
.useAsConfigCenter(true)
|
.useAsConfigCenter(true)
|
||||||
.useAsMetadataCenter(true))
|
.useAsMetadataCenter(true))
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import org.apache.dubbo.config.RegistryConfig;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.config.bootstrap.EchoService;
|
import org.apache.dubbo.config.bootstrap.EchoService;
|
||||||
import org.apache.dubbo.config.bootstrap.rest.UserService;
|
import org.apache.dubbo.config.bootstrap.rest.UserService;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dubbo Provider Bootstrap
|
* Dubbo Provider Bootstrap
|
||||||
|
|
@ -31,7 +32,7 @@ public class DubboInterfaceConsumerBootstrap {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
RegistryConfig interfaceRegistry = new RegistryConfig();
|
RegistryConfig interfaceRegistry = new RegistryConfig();
|
||||||
interfaceRegistry.setId("interfaceRegistry");
|
interfaceRegistry.setId("interfaceRegistry");
|
||||||
interfaceRegistry.setAddress("zookeeper://127.0.0.1:2181");
|
interfaceRegistry.setAddress(ZookeeperRegistryCenterConfig.getConnectionAddress());
|
||||||
|
|
||||||
DubboBootstrap bootstrap = DubboBootstrap.getInstance()
|
DubboBootstrap bootstrap = DubboBootstrap.getInstance()
|
||||||
.application("dubbo-consumer-demo")
|
.application("dubbo-consumer-demo")
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration;
|
package org.apache.dubbo.config.integration;
|
||||||
|
|
||||||
import org.apache.dubbo.rpc.Exporter;
|
import org.apache.dubbo.rpc.Exporter;
|
||||||
import org.apache.dubbo.rpc.ExporterListener;
|
import org.apache.dubbo.rpc.ExporterListener;
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration;
|
package org.apache.dubbo.config.integration;
|
||||||
|
|
||||||
import org.apache.dubbo.config.ServiceConfig;
|
import org.apache.dubbo.config.ServiceConfig;
|
||||||
import org.apache.dubbo.config.ServiceListener;
|
import org.apache.dubbo.config.ServiceListener;
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration;
|
package org.apache.dubbo.config.integration;
|
||||||
|
|
||||||
public interface Constants {
|
public interface Constants {
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration;
|
package org.apache.dubbo.config.integration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The interface for integration testcases.
|
* The interface for integration testcases.
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple;
|
package org.apache.dubbo.config.integration.multiple;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple;
|
package org.apache.dubbo.config.integration.multiple;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface to store the given type instance in multiple registry center.
|
* This interface to store the given type instance in multiple registry center.
|
||||||
|
|
@ -14,11 +14,11 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.exportmetadata;
|
package org.apache.dubbo.config.integration.multiple.exportmetadata;
|
||||||
|
|
||||||
import org.apache.dubbo.common.constants.CommonConstants;
|
import org.apache.dubbo.common.constants.CommonConstants;
|
||||||
import org.apache.dubbo.common.extension.Activate;
|
import org.apache.dubbo.common.extension.Activate;
|
||||||
import org.apache.dubbo.integration.AbstractRegistryCenterExporterListener;
|
import org.apache.dubbo.config.integration.AbstractRegistryCenterExporterListener;
|
||||||
import org.apache.dubbo.metadata.MetadataService;
|
import org.apache.dubbo.metadata.MetadataService;
|
||||||
|
|
||||||
@Activate(group = CommonConstants.PROVIDER, order = 1000)
|
@Activate(group = CommonConstants.PROVIDER, order = 1000)
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.exportmetadata;
|
package org.apache.dubbo.config.integration.multiple.exportmetadata;
|
||||||
|
|
||||||
import org.apache.dubbo.common.extension.ExtensionLoader;
|
import org.apache.dubbo.common.extension.ExtensionLoader;
|
||||||
import org.apache.dubbo.config.RegistryConfig;
|
import org.apache.dubbo.config.RegistryConfig;
|
||||||
|
|
@ -23,13 +23,12 @@ import org.apache.dubbo.config.ApplicationConfig;
|
||||||
import org.apache.dubbo.config.ProtocolConfig;
|
import org.apache.dubbo.config.ProtocolConfig;
|
||||||
import org.apache.dubbo.config.ServiceListener;
|
import org.apache.dubbo.config.ServiceListener;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.integration.IntegrationTest;
|
import org.apache.dubbo.config.integration.IntegrationTest;
|
||||||
import org.apache.dubbo.metadata.MetadataService;
|
import org.apache.dubbo.metadata.MetadataService;
|
||||||
import org.apache.dubbo.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.registrycenter.ZookeeperMultipleRegistryCenter;
|
|
||||||
import org.apache.dubbo.rpc.Exporter;
|
import org.apache.dubbo.rpc.Exporter;
|
||||||
import org.apache.dubbo.rpc.ExporterListener;
|
import org.apache.dubbo.rpc.ExporterListener;
|
||||||
import org.apache.dubbo.rpc.Filter;
|
import org.apache.dubbo.rpc.Filter;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
@ -77,17 +76,11 @@ public class MultipleRegistryCenterExportMetadataIntegrationTest implements Inte
|
||||||
*/
|
*/
|
||||||
private MultipleRegistryCenterExportMetadataExporterListener exporterListener;
|
private MultipleRegistryCenterExportMetadataExporterListener exporterListener;
|
||||||
|
|
||||||
/**
|
|
||||||
* Define a registry center.
|
|
||||||
*/
|
|
||||||
private RegistryCenter registryCenter;
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
logger.info(getClass().getSimpleName() + " testcase is beginning...");
|
logger.info(getClass().getSimpleName() + " testcase is beginning...");
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
registryCenter = new ZookeeperMultipleRegistryCenter();
|
|
||||||
registryCenter.startup();
|
|
||||||
// initialize service config
|
// initialize service config
|
||||||
serviceConfig = new ServiceConfig<>();
|
serviceConfig = new ServiceConfig<>();
|
||||||
serviceConfig.setInterface(MultipleRegistryCenterExportMetadataService.class);
|
serviceConfig.setInterface(MultipleRegistryCenterExportMetadataService.class);
|
||||||
|
|
@ -99,13 +92,9 @@ public class MultipleRegistryCenterExportMetadataIntegrationTest implements Inte
|
||||||
DubboBootstrap.getInstance()
|
DubboBootstrap.getInstance()
|
||||||
.application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
|
.application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
|
||||||
.protocol(new ProtocolConfig(PROTOCOL_NAME))
|
.protocol(new ProtocolConfig(PROTOCOL_NAME))
|
||||||
.service(serviceConfig);
|
.service(serviceConfig)
|
||||||
for (RegistryCenter.Instance instance : registryCenter.getRegistryCenterInstance()) {
|
.registry(new RegistryConfig(ZookeeperRegistryCenterConfig.getConnectionAddress1()))
|
||||||
DubboBootstrap.getInstance().registry(new RegistryConfig(String.format("%s://%s:%s",
|
.registry(new RegistryConfig(ZookeeperRegistryCenterConfig.getConnectionAddress2()));
|
||||||
instance.getType(),
|
|
||||||
instance.getHostname(),
|
|
||||||
instance.getPort())));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -201,7 +190,5 @@ public class MultipleRegistryCenterExportMetadataIntegrationTest implements Inte
|
||||||
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
||||||
serviceListener = null;
|
serviceListener = null;
|
||||||
logger.info(getClass().getSimpleName() + " testcase is ending...");
|
logger.info(getClass().getSimpleName() + " testcase is ending...");
|
||||||
registryCenter.shutdown();
|
|
||||||
registryCenter = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.exportmetadata;
|
package org.apache.dubbo.config.integration.multiple.exportmetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is used to check if the exported metadata service works well or not in multiple registry center.
|
* This interface is used to check if the exported metadata service works well or not in multiple registry center.
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.exportmetadata;
|
package org.apache.dubbo.config.integration.multiple.exportmetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The simple implementation for {@link MultipleRegistryCenterExportMetadataService}
|
* The simple implementation for {@link MultipleRegistryCenterExportMetadataService}
|
||||||
|
|
@ -14,10 +14,10 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.exportmetadata;
|
package org.apache.dubbo.config.integration.multiple.exportmetadata;
|
||||||
|
|
||||||
import org.apache.dubbo.config.ServiceListener;
|
import org.apache.dubbo.config.ServiceListener;
|
||||||
import org.apache.dubbo.integration.AbstractRegistryCenterServiceListener;
|
import org.apache.dubbo.config.integration.AbstractRegistryCenterServiceListener;
|
||||||
import org.apache.dubbo.metadata.MetadataService;
|
import org.apache.dubbo.metadata.MetadataService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -14,11 +14,11 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.exportprovider;
|
package org.apache.dubbo.config.integration.multiple.exportprovider;
|
||||||
|
|
||||||
import org.apache.dubbo.common.constants.CommonConstants;
|
import org.apache.dubbo.common.constants.CommonConstants;
|
||||||
import org.apache.dubbo.common.extension.Activate;
|
import org.apache.dubbo.common.extension.Activate;
|
||||||
import org.apache.dubbo.integration.AbstractRegistryCenterExporterListener;
|
import org.apache.dubbo.config.integration.AbstractRegistryCenterExporterListener;
|
||||||
|
|
||||||
@Activate(group = CommonConstants.PROVIDER, order = 1000)
|
@Activate(group = CommonConstants.PROVIDER, order = 1000)
|
||||||
public class MultipleRegistryCenterExportProviderExporterListener extends AbstractRegistryCenterExporterListener {
|
public class MultipleRegistryCenterExportProviderExporterListener extends AbstractRegistryCenterExporterListener {
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.exportprovider;
|
package org.apache.dubbo.config.integration.multiple.exportprovider;
|
||||||
|
|
||||||
import org.apache.dubbo.common.constants.CommonConstants;
|
import org.apache.dubbo.common.constants.CommonConstants;
|
||||||
import org.apache.dubbo.common.extension.Activate;
|
import org.apache.dubbo.common.extension.Activate;
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.exportprovider;
|
package org.apache.dubbo.config.integration.multiple.exportprovider;
|
||||||
|
|
||||||
import org.apache.dubbo.common.config.configcenter.ConfigItem;
|
import org.apache.dubbo.common.config.configcenter.ConfigItem;
|
||||||
import org.apache.dubbo.common.constants.CommonConstants;
|
import org.apache.dubbo.common.constants.CommonConstants;
|
||||||
|
|
@ -26,15 +26,14 @@ import org.apache.dubbo.config.RegistryConfig;
|
||||||
import org.apache.dubbo.config.ServiceConfig;
|
import org.apache.dubbo.config.ServiceConfig;
|
||||||
import org.apache.dubbo.config.ServiceListener;
|
import org.apache.dubbo.config.ServiceListener;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.integration.IntegrationTest;
|
import org.apache.dubbo.config.integration.IntegrationTest;
|
||||||
import org.apache.dubbo.metadata.ServiceNameMapping;
|
import org.apache.dubbo.metadata.ServiceNameMapping;
|
||||||
import org.apache.dubbo.metadata.report.MetadataReportInstance;
|
import org.apache.dubbo.metadata.report.MetadataReportInstance;
|
||||||
import org.apache.dubbo.registry.integration.RegistryProtocolListener;
|
import org.apache.dubbo.registry.integration.RegistryProtocolListener;
|
||||||
import org.apache.dubbo.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.registrycenter.ZookeeperMultipleRegistryCenter;
|
|
||||||
import org.apache.dubbo.rpc.ExporterListener;
|
import org.apache.dubbo.rpc.ExporterListener;
|
||||||
import org.apache.dubbo.rpc.Filter;
|
import org.apache.dubbo.rpc.Filter;
|
||||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
@ -75,11 +74,6 @@ public class MultipleRegistryCenterExportProviderIntegrationTest implements Inte
|
||||||
*/
|
*/
|
||||||
private ServiceConfig<MultipleRegistryCenterExportProviderService> serviceConfig;
|
private ServiceConfig<MultipleRegistryCenterExportProviderService> serviceConfig;
|
||||||
|
|
||||||
/**
|
|
||||||
* Define a registry center.
|
|
||||||
*/
|
|
||||||
private RegistryCenter registryCenter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define a {@link RegistryProtocolListener} instance.
|
* Define a {@link RegistryProtocolListener} instance.
|
||||||
*/
|
*/
|
||||||
|
|
@ -104,8 +98,6 @@ public class MultipleRegistryCenterExportProviderIntegrationTest implements Inte
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
logger.info(getClass().getSimpleName() + " testcase is beginning...");
|
logger.info(getClass().getSimpleName() + " testcase is beginning...");
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
registryCenter = new ZookeeperMultipleRegistryCenter();
|
|
||||||
registryCenter.startup();
|
|
||||||
// initialize service config
|
// initialize service config
|
||||||
serviceConfig = new ServiceConfig<>();
|
serviceConfig = new ServiceConfig<>();
|
||||||
serviceConfig.setInterface(MultipleRegistryCenterExportProviderService.class);
|
serviceConfig.setInterface(MultipleRegistryCenterExportProviderService.class);
|
||||||
|
|
@ -116,14 +108,9 @@ public class MultipleRegistryCenterExportProviderIntegrationTest implements Inte
|
||||||
DubboBootstrap.getInstance()
|
DubboBootstrap.getInstance()
|
||||||
.application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
|
.application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
|
||||||
.protocol(new ProtocolConfig(PROTOCOL_NAME, PROTOCOL_PORT))
|
.protocol(new ProtocolConfig(PROTOCOL_NAME, PROTOCOL_PORT))
|
||||||
.service(serviceConfig);
|
.service(serviceConfig)
|
||||||
for (RegistryCenter.Instance instance : registryCenter.getRegistryCenterInstance()) {
|
.registry(new RegistryConfig(ZookeeperRegistryCenterConfig.getConnectionAddress1()))
|
||||||
RegistryConfig registryConfig = new RegistryConfig(String.format("%s://%s:%s",
|
.registry(new RegistryConfig(ZookeeperRegistryCenterConfig.getConnectionAddress2()));
|
||||||
instance.getType(),
|
|
||||||
instance.getHostname(),
|
|
||||||
instance.getPort()));
|
|
||||||
DubboBootstrap.getInstance().registry(registryConfig);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -254,8 +241,6 @@ public class MultipleRegistryCenterExportProviderIntegrationTest implements Inte
|
||||||
// The exported service has been unexported
|
// The exported service has been unexported
|
||||||
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
||||||
logger.info(getClass().getSimpleName() + " testcase is ending...");
|
logger.info(getClass().getSimpleName() + " testcase is ending...");
|
||||||
registryCenter.shutdown();
|
|
||||||
registryProtocolListener = null;
|
registryProtocolListener = null;
|
||||||
registryCenter = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.exportprovider;
|
package org.apache.dubbo.config.integration.multiple.exportprovider;
|
||||||
|
|
||||||
import org.apache.dubbo.common.URL;
|
import org.apache.dubbo.common.URL;
|
||||||
import org.apache.dubbo.common.extension.Activate;
|
import org.apache.dubbo.common.extension.Activate;
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.exportprovider;
|
package org.apache.dubbo.config.integration.multiple.exportprovider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is used to check if the exported provider works well or not in multiple registry center.
|
* This interface is used to check if the exported provider works well or not in multiple registry center.
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.exportprovider;
|
package org.apache.dubbo.config.integration.multiple.exportprovider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The implementation of {@link MultipleRegistryCenterExportProviderService}
|
* The implementation of {@link MultipleRegistryCenterExportProviderService}
|
||||||
|
|
@ -14,10 +14,10 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.exportprovider;
|
package org.apache.dubbo.config.integration.multiple.exportprovider;
|
||||||
|
|
||||||
import org.apache.dubbo.config.ServiceListener;
|
import org.apache.dubbo.config.ServiceListener;
|
||||||
import org.apache.dubbo.integration.AbstractRegistryCenterServiceListener;
|
import org.apache.dubbo.config.integration.AbstractRegistryCenterServiceListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This implementation of {@link ServiceListener} is to record exported services with injvm protocol in single registry center.
|
* This implementation of {@link ServiceListener} is to record exported services with injvm protocol in single registry center.
|
||||||
|
|
@ -14,11 +14,11 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.injvm;
|
package org.apache.dubbo.config.integration.multiple.injvm;
|
||||||
|
|
||||||
import org.apache.dubbo.common.constants.CommonConstants;
|
import org.apache.dubbo.common.constants.CommonConstants;
|
||||||
import org.apache.dubbo.common.extension.Activate;
|
import org.apache.dubbo.common.extension.Activate;
|
||||||
import org.apache.dubbo.integration.AbstractRegistryCenterExporterListener;
|
import org.apache.dubbo.config.integration.AbstractRegistryCenterExporterListener;
|
||||||
|
|
||||||
@Activate(group = CommonConstants.PROVIDER, order = 1000)
|
@Activate(group = CommonConstants.PROVIDER, order = 1000)
|
||||||
public class MultipleRegistryCenterInjvmExporterListener extends AbstractRegistryCenterExporterListener {
|
public class MultipleRegistryCenterInjvmExporterListener extends AbstractRegistryCenterExporterListener {
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.injvm;
|
package org.apache.dubbo.config.integration.multiple.injvm;
|
||||||
|
|
||||||
import org.apache.dubbo.common.constants.CommonConstants;
|
import org.apache.dubbo.common.constants.CommonConstants;
|
||||||
import org.apache.dubbo.common.extension.Activate;
|
import org.apache.dubbo.common.extension.Activate;
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.injvm;
|
package org.apache.dubbo.config.integration.multiple.injvm;
|
||||||
|
|
||||||
import org.apache.dubbo.common.extension.ExtensionLoader;
|
import org.apache.dubbo.common.extension.ExtensionLoader;
|
||||||
import org.apache.dubbo.config.ApplicationConfig;
|
import org.apache.dubbo.config.ApplicationConfig;
|
||||||
|
|
@ -24,11 +24,10 @@ import org.apache.dubbo.config.RegistryConfig;
|
||||||
import org.apache.dubbo.config.ServiceConfig;
|
import org.apache.dubbo.config.ServiceConfig;
|
||||||
import org.apache.dubbo.config.ServiceListener;
|
import org.apache.dubbo.config.ServiceListener;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.integration.IntegrationTest;
|
import org.apache.dubbo.config.integration.IntegrationTest;
|
||||||
import org.apache.dubbo.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.registrycenter.ZookeeperMultipleRegistryCenter;
|
|
||||||
import org.apache.dubbo.rpc.ExporterListener;
|
import org.apache.dubbo.rpc.ExporterListener;
|
||||||
import org.apache.dubbo.rpc.Filter;
|
import org.apache.dubbo.rpc.Filter;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
@ -77,18 +76,10 @@ public class MultipleRegistryCenterInjvmIntegrationTest implements IntegrationTe
|
||||||
*/
|
*/
|
||||||
private MultipleRegistryCenterInjvmFilter filter;
|
private MultipleRegistryCenterInjvmFilter filter;
|
||||||
|
|
||||||
/**
|
|
||||||
* Default a registry center.
|
|
||||||
*/
|
|
||||||
private RegistryCenter registryCenter;
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
logger.info(getClass().getSimpleName() + " testcase is beginning...");
|
logger.info(getClass().getSimpleName() + " testcase is beginning...");
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
//start all zookeeper services only once
|
|
||||||
registryCenter = new ZookeeperMultipleRegistryCenter();
|
|
||||||
registryCenter.startup();
|
|
||||||
// initialize service config
|
// initialize service config
|
||||||
serviceConfig = new ServiceConfig<>();
|
serviceConfig = new ServiceConfig<>();
|
||||||
serviceConfig.setInterface(MultipleRegistryCenterInjvmService.class);
|
serviceConfig.setInterface(MultipleRegistryCenterInjvmService.class);
|
||||||
|
|
@ -96,17 +87,12 @@ public class MultipleRegistryCenterInjvmIntegrationTest implements IntegrationTe
|
||||||
serviceConfig.setAsync(false);
|
serviceConfig.setAsync(false);
|
||||||
serviceConfig.setScope(SCOPE_LOCAL);
|
serviceConfig.setScope(SCOPE_LOCAL);
|
||||||
|
|
||||||
// initailize bootstrap
|
|
||||||
for (RegistryCenter.Instance instance : registryCenter.getRegistryCenterInstance()) {
|
|
||||||
DubboBootstrap.getInstance().registry(new RegistryConfig(String.format("%s://%s:%s",
|
|
||||||
instance.getType(),
|
|
||||||
instance.getHostname(),
|
|
||||||
instance.getPort())));
|
|
||||||
}
|
|
||||||
DubboBootstrap.getInstance()
|
DubboBootstrap.getInstance()
|
||||||
.application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
|
.application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
|
||||||
.protocol(new ProtocolConfig("injvm"))
|
.protocol(new ProtocolConfig("injvm"))
|
||||||
.service(serviceConfig);
|
.service(serviceConfig)
|
||||||
|
.registry(new RegistryConfig(ZookeeperRegistryCenterConfig.getConnectionAddress1()))
|
||||||
|
.registry(new RegistryConfig(ZookeeperRegistryCenterConfig.getConnectionAddress2()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -201,8 +187,5 @@ public class MultipleRegistryCenterInjvmIntegrationTest implements IntegrationTe
|
||||||
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
||||||
serviceListener = null;
|
serviceListener = null;
|
||||||
logger.info(getClass().getSimpleName() + " testcase is ending...");
|
logger.info(getClass().getSimpleName() + " testcase is ending...");
|
||||||
// destroy registry center
|
|
||||||
registryCenter.shutdown();
|
|
||||||
registryCenter = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.injvm;
|
package org.apache.dubbo.config.integration.multiple.injvm;
|
||||||
/**
|
/**
|
||||||
* This interface is used to check if the exported injvm protocol works well or not.
|
* This interface is used to check if the exported injvm protocol works well or not.
|
||||||
*/
|
*/
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.injvm;
|
package org.apache.dubbo.config.integration.multiple.injvm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The simple implementation for {@link MultipleRegistryCenterInjvmService}
|
* The simple implementation for {@link MultipleRegistryCenterInjvmService}
|
||||||
|
|
@ -14,10 +14,10 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.injvm;
|
package org.apache.dubbo.config.integration.multiple.injvm;
|
||||||
|
|
||||||
import org.apache.dubbo.config.ServiceListener;
|
import org.apache.dubbo.config.ServiceListener;
|
||||||
import org.apache.dubbo.integration.AbstractRegistryCenterServiceListener;
|
import org.apache.dubbo.config.integration.AbstractRegistryCenterServiceListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This implementation of {@link ServiceListener} is to record exported services with injvm protocol in multiple registry center.
|
* This implementation of {@link ServiceListener} is to record exported services with injvm protocol in multiple registry center.
|
||||||
|
|
@ -19,4 +19,4 @@
|
||||||
* The one is single registry center, the other is multiple registry centers.<p>
|
* The one is single registry center, the other is multiple registry centers.<p>
|
||||||
* The purpose of all of testcases in this package is to test for multiple registry center.
|
* The purpose of all of testcases in this package is to test for multiple registry center.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple;
|
package org.apache.dubbo.config.integration.multiple;
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.servicediscoveryregistry;
|
package org.apache.dubbo.config.integration.multiple.servicediscoveryregistry;
|
||||||
|
|
||||||
import org.apache.dubbo.common.constants.CommonConstants;
|
import org.apache.dubbo.common.constants.CommonConstants;
|
||||||
import org.apache.dubbo.common.extension.ExtensionLoader;
|
import org.apache.dubbo.common.extension.ExtensionLoader;
|
||||||
|
|
@ -24,12 +24,11 @@ import org.apache.dubbo.config.ReferenceConfig;
|
||||||
import org.apache.dubbo.config.RegistryConfig;
|
import org.apache.dubbo.config.RegistryConfig;
|
||||||
import org.apache.dubbo.config.ServiceConfig;
|
import org.apache.dubbo.config.ServiceConfig;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.integration.IntegrationTest;
|
import org.apache.dubbo.config.integration.IntegrationTest;
|
||||||
import org.apache.dubbo.registry.RegistryServiceListener;
|
import org.apache.dubbo.registry.RegistryServiceListener;
|
||||||
import org.apache.dubbo.registry.client.metadata.store.InMemoryWritableMetadataService;
|
import org.apache.dubbo.registry.client.metadata.store.InMemoryWritableMetadataService;
|
||||||
import org.apache.dubbo.registrycenter.RegistryCenter;
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.apache.dubbo.registrycenter.ZookeeperMultipleRegistryCenter;
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperConfig;
|
||||||
|
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
@ -43,7 +42,7 @@ import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.apache.dubbo.integration.Constants.MULTIPLE_CONFIG_CENTER_SERVICE_DISCOVERY_REGISTRY;
|
import static org.apache.dubbo.config.integration.Constants.MULTIPLE_CONFIG_CENTER_SERVICE_DISCOVERY_REGISTRY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The testcases are only for checking the process of exporting provider using service-discovery-registry protocol.
|
* The testcases are only for checking the process of exporting provider using service-discovery-registry protocol.
|
||||||
|
|
@ -71,11 +70,6 @@ public class MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest imple
|
||||||
*/
|
*/
|
||||||
private ServiceConfig<MultipleRegistryCenterServiceDiscoveryRegistryService> serviceConfig;
|
private ServiceConfig<MultipleRegistryCenterServiceDiscoveryRegistryService> serviceConfig;
|
||||||
|
|
||||||
/**
|
|
||||||
* Default a registry center.
|
|
||||||
*/
|
|
||||||
private RegistryCenter registryCenter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define a {@link RegistryServiceListener} instance.
|
* Define a {@link RegistryServiceListener} instance.
|
||||||
*/
|
*/
|
||||||
|
|
@ -95,27 +89,26 @@ public class MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest imple
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
logger.info(getClass().getSimpleName() + " testcase is beginning...");
|
logger.info(getClass().getSimpleName() + " testcase is beginning...");
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
//start all zookeeper services only once
|
|
||||||
registryCenter = new ZookeeperMultipleRegistryCenter();
|
|
||||||
registryCenter.startup();
|
|
||||||
// initialize service config
|
// initialize service config
|
||||||
serviceConfig = new ServiceConfig<>();
|
serviceConfig = new ServiceConfig<>();
|
||||||
serviceConfig.setInterface(MultipleRegistryCenterServiceDiscoveryRegistryService.class);
|
serviceConfig.setInterface(MultipleRegistryCenterServiceDiscoveryRegistryService.class);
|
||||||
serviceConfig.setRef(new MultipleRegistryCenterServiceDiscoveryRegistryServiceImpl());
|
serviceConfig.setRef(new MultipleRegistryCenterServiceDiscoveryRegistryServiceImpl());
|
||||||
serviceConfig.setAsync(false);
|
serviceConfig.setAsync(false);
|
||||||
|
|
||||||
// initialize bootstrap
|
RegistryConfig registryConfig1 = new RegistryConfig(ZookeeperRegistryCenterConfig.getConnectionAddress1());
|
||||||
for (RegistryCenter.Instance instance : registryCenter.getRegistryCenterInstance()) {
|
Map<String, String> parameters1 = new HashMap<>();
|
||||||
RegistryConfig registryConfig = new RegistryConfig(String.format("%s://%s:%s",
|
parameters1.put("registry.listeners", MULTIPLE_CONFIG_CENTER_SERVICE_DISCOVERY_REGISTRY);
|
||||||
instance.getType(),
|
registryConfig1.updateParameters(parameters1);
|
||||||
instance.getHostname(),
|
DubboBootstrap.getInstance().registry(registryConfig1);
|
||||||
instance.getPort()));
|
ports.add(ZookeeperConfig.DEFAULT_CLIENT_PORT_1);
|
||||||
Map<String, String> parameters = new HashMap<>();
|
|
||||||
parameters.put("registry.listeners", MULTIPLE_CONFIG_CENTER_SERVICE_DISCOVERY_REGISTRY);
|
RegistryConfig registryConfig2 = new RegistryConfig(ZookeeperRegistryCenterConfig.getConnectionAddress2());
|
||||||
registryConfig.updateParameters(parameters);
|
Map<String, String> parameters2 = new HashMap<>();
|
||||||
DubboBootstrap.getInstance().registry(registryConfig);
|
parameters2.put("registry.listeners", MULTIPLE_CONFIG_CENTER_SERVICE_DISCOVERY_REGISTRY);
|
||||||
ports.add(instance.getPort());
|
registryConfig2.updateParameters(parameters2);
|
||||||
}
|
DubboBootstrap.getInstance().registry(registryConfig2);
|
||||||
|
ports.add(ZookeeperConfig.DEFAULT_CLIENT_PORT_2);
|
||||||
|
|
||||||
DubboBootstrap.getInstance()
|
DubboBootstrap.getInstance()
|
||||||
.application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
|
.application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
|
||||||
.protocol(new ProtocolConfig(PROTOCOL_NAME, PROTOCOL_PORT))
|
.protocol(new ProtocolConfig(PROTOCOL_NAME, PROTOCOL_PORT))
|
||||||
|
|
@ -218,8 +211,5 @@ public class MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest imple
|
||||||
registryServiceListener.getStorage().clear();
|
registryServiceListener.getStorage().clear();
|
||||||
registryServiceListener = null;
|
registryServiceListener = null;
|
||||||
logger.info(getClass().getSimpleName() + " testcase is ending...");
|
logger.info(getClass().getSimpleName() + " testcase is ending...");
|
||||||
// destroy registry center
|
|
||||||
registryCenter.shutdown();
|
|
||||||
registryCenter = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.servicediscoveryregistry;
|
package org.apache.dubbo.config.integration.multiple.servicediscoveryregistry;
|
||||||
|
|
||||||
import org.apache.dubbo.common.URL;
|
import org.apache.dubbo.common.URL;
|
||||||
import org.apache.dubbo.common.extension.Activate;
|
import org.apache.dubbo.common.extension.Activate;
|
||||||
|
|
@ -24,7 +24,7 @@ import org.apache.dubbo.registry.RegistryServiceListener;
|
||||||
import org.apache.dubbo.registry.client.ServiceDiscoveryRegistry;
|
import org.apache.dubbo.registry.client.ServiceDiscoveryRegistry;
|
||||||
import org.apache.dubbo.registry.client.metadata.store.InMemoryWritableMetadataService;
|
import org.apache.dubbo.registry.client.metadata.store.InMemoryWritableMetadataService;
|
||||||
|
|
||||||
import static org.apache.dubbo.integration.Constants.MULTIPLE_CONFIG_CENTER_SERVICE_DISCOVERY_REGISTRY;
|
import static org.apache.dubbo.config.integration.Constants.MULTIPLE_CONFIG_CENTER_SERVICE_DISCOVERY_REGISTRY;
|
||||||
|
|
||||||
|
|
||||||
@Activate(value = MULTIPLE_CONFIG_CENTER_SERVICE_DISCOVERY_REGISTRY)
|
@Activate(value = MULTIPLE_CONFIG_CENTER_SERVICE_DISCOVERY_REGISTRY)
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.servicediscoveryregistry;
|
package org.apache.dubbo.config.integration.multiple.servicediscoveryregistry;
|
||||||
/**
|
/**
|
||||||
* This interface is used to check if the exported service-discovery-registry protocol works well or not.
|
* This interface is used to check if the exported service-discovery-registry protocol works well or not.
|
||||||
*/
|
*/
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.servicediscoveryregistry;
|
package org.apache.dubbo.config.integration.multiple.servicediscoveryregistry;
|
||||||
/**
|
/**
|
||||||
* The simple implementation for {@link MultipleRegistryCenterServiceDiscoveryRegistryService}
|
* The simple implementation for {@link MultipleRegistryCenterServiceDiscoveryRegistryService}
|
||||||
*/
|
*/
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.servicediscoveryregistry;
|
package org.apache.dubbo.config.integration.multiple.servicediscoveryregistry;
|
||||||
|
|
||||||
import org.apache.dubbo.registry.client.ServiceDiscoveryRegistry;
|
import org.apache.dubbo.registry.client.ServiceDiscoveryRegistry;
|
||||||
import org.apache.dubbo.registry.client.metadata.store.InMemoryWritableMetadataService;
|
import org.apache.dubbo.registry.client.metadata.store.InMemoryWritableMetadataService;
|
||||||
|
|
@ -14,9 +14,9 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.multiple.servicediscoveryregistry;
|
package org.apache.dubbo.config.integration.multiple.servicediscoveryregistry;
|
||||||
|
|
||||||
import org.apache.dubbo.integration.multiple.AbstractStorage;
|
import org.apache.dubbo.config.integration.multiple.AbstractStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The storage to store {@link ServiceDiscoveryRegistryInfoWrapper} instances in multiple registry center.
|
* The storage to store {@link ServiceDiscoveryRegistryInfoWrapper} instances in multiple registry center.
|
||||||
|
|
@ -14,12 +14,11 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single;
|
package org.apache.dubbo.config.integration.single;
|
||||||
|
|
||||||
import org.apache.dubbo.common.URL;
|
import org.apache.dubbo.common.URL;
|
||||||
import org.apache.dubbo.common.constants.CommonConstants;
|
import org.apache.dubbo.common.constants.CommonConstants;
|
||||||
import org.apache.dubbo.common.extension.ExtensionLoader;
|
import org.apache.dubbo.common.extension.ExtensionLoader;
|
||||||
import org.apache.dubbo.common.utils.NetUtils;
|
|
||||||
import org.apache.dubbo.config.ApplicationConfig;
|
import org.apache.dubbo.config.ApplicationConfig;
|
||||||
import org.apache.dubbo.config.ProtocolConfig;
|
import org.apache.dubbo.config.ProtocolConfig;
|
||||||
import org.apache.dubbo.config.ReferenceConfig;
|
import org.apache.dubbo.config.ReferenceConfig;
|
||||||
|
|
@ -27,7 +26,7 @@ import org.apache.dubbo.config.RegistryConfig;
|
||||||
import org.apache.dubbo.config.ServiceConfig;
|
import org.apache.dubbo.config.ServiceConfig;
|
||||||
import org.apache.dubbo.config.ServiceListener;
|
import org.apache.dubbo.config.ServiceListener;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.integration.IntegrationTest;
|
import org.apache.dubbo.config.integration.IntegrationTest;
|
||||||
import org.apache.dubbo.metadata.MetadataInfo;
|
import org.apache.dubbo.metadata.MetadataInfo;
|
||||||
import org.apache.dubbo.metadata.WritableMetadataService;
|
import org.apache.dubbo.metadata.WritableMetadataService;
|
||||||
import org.apache.dubbo.registry.ListenerRegistryWrapper;
|
import org.apache.dubbo.registry.ListenerRegistryWrapper;
|
||||||
|
|
@ -38,10 +37,9 @@ import org.apache.dubbo.registry.client.metadata.store.InMemoryWritableMetadataS
|
||||||
import org.apache.dubbo.registry.client.migration.MigrationInvoker;
|
import org.apache.dubbo.registry.client.migration.MigrationInvoker;
|
||||||
import org.apache.dubbo.registry.support.RegistryManager;
|
import org.apache.dubbo.registry.support.RegistryManager;
|
||||||
import org.apache.dubbo.registry.zookeeper.ZookeeperServiceDiscovery;
|
import org.apache.dubbo.registry.zookeeper.ZookeeperServiceDiscovery;
|
||||||
import org.apache.dubbo.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.apache.dubbo.rpc.cluster.Directory;
|
import org.apache.dubbo.rpc.cluster.Directory;
|
||||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
@ -101,17 +99,10 @@ public class SingleRegistryCenterDubboProtocolIntegrationTest implements Integra
|
||||||
*/
|
*/
|
||||||
private SingleRegistryCenterExportedServiceListener singleRegistryCenterExportedServiceListener;
|
private SingleRegistryCenterExportedServiceListener singleRegistryCenterExportedServiceListener;
|
||||||
|
|
||||||
/**
|
|
||||||
* Define a registry center.
|
|
||||||
*/
|
|
||||||
private RegistryCenter registryCenter;
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
logger.info(getClass().getSimpleName() + " testcase is beginning...");
|
logger.info(getClass().getSimpleName() + " testcase is beginning...");
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
registryCenter = new ZookeeperSingleRegistryCenter(NetUtils.getAvailablePort());
|
|
||||||
registryCenter.startup();
|
|
||||||
// initialize ServiceConfig
|
// initialize ServiceConfig
|
||||||
serviceConfig = new ServiceConfig<>();
|
serviceConfig = new ServiceConfig<>();
|
||||||
serviceConfig.setInterface(SingleRegistryCenterIntegrationService.class);
|
serviceConfig.setInterface(SingleRegistryCenterIntegrationService.class);
|
||||||
|
|
@ -122,11 +113,7 @@ public class SingleRegistryCenterDubboProtocolIntegrationTest implements Integra
|
||||||
.application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
|
.application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
|
||||||
.protocol(new ProtocolConfig(PROTOCOL_NAME, PROTOCOL_PORT))
|
.protocol(new ProtocolConfig(PROTOCOL_NAME, PROTOCOL_PORT))
|
||||||
.service(serviceConfig);
|
.service(serviceConfig);
|
||||||
RegistryCenter.Instance instance = registryCenter.getRegistryCenterInstance().get(0);
|
registryConfig = new RegistryConfig(ZookeeperRegistryCenterConfig.getConnectionAddress());
|
||||||
registryConfig = new RegistryConfig(String.format("%s://%s:%s",
|
|
||||||
instance.getType(),
|
|
||||||
instance.getHostname(),
|
|
||||||
instance.getPort()));
|
|
||||||
DubboBootstrap.getInstance().registry(registryConfig);
|
DubboBootstrap.getInstance().registry(registryConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -386,8 +373,5 @@ public class SingleRegistryCenterDubboProtocolIntegrationTest implements Integra
|
||||||
Assertions.assertTrue(singleRegistryCenterExportedServiceListener.getExportedServices().isEmpty());
|
Assertions.assertTrue(singleRegistryCenterExportedServiceListener.getExportedServices().isEmpty());
|
||||||
singleRegistryCenterExportedServiceListener = null;
|
singleRegistryCenterExportedServiceListener = null;
|
||||||
logger.info(getClass().getSimpleName() + " testcase is ending...");
|
logger.info(getClass().getSimpleName() + " testcase is ending...");
|
||||||
// destroy registry center
|
|
||||||
registryCenter.shutdown();
|
|
||||||
registryCenter = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -14,10 +14,10 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single;
|
package org.apache.dubbo.config.integration.single;
|
||||||
|
|
||||||
import org.apache.dubbo.config.ServiceListener;
|
import org.apache.dubbo.config.ServiceListener;
|
||||||
import org.apache.dubbo.integration.AbstractRegistryCenterServiceListener;
|
import org.apache.dubbo.config.integration.AbstractRegistryCenterServiceListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This implementation of {@link ServiceListener} is to record exported services in single registry center.
|
* This implementation of {@link ServiceListener} is to record exported services in single registry center.
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single;
|
package org.apache.dubbo.config.integration.single;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface for integration testcases in single registry center.
|
* This interface for integration testcases in single registry center.
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single;
|
package org.apache.dubbo.config.integration.single;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
@ -14,11 +14,11 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.exportmetadata;
|
package org.apache.dubbo.config.integration.single.exportmetadata;
|
||||||
|
|
||||||
import org.apache.dubbo.common.constants.CommonConstants;
|
import org.apache.dubbo.common.constants.CommonConstants;
|
||||||
import org.apache.dubbo.common.extension.Activate;
|
import org.apache.dubbo.common.extension.Activate;
|
||||||
import org.apache.dubbo.integration.AbstractRegistryCenterExporterListener;
|
import org.apache.dubbo.config.integration.AbstractRegistryCenterExporterListener;
|
||||||
import org.apache.dubbo.metadata.MetadataService;
|
import org.apache.dubbo.metadata.MetadataService;
|
||||||
|
|
||||||
@Activate(group = CommonConstants.PROVIDER, order = 1000)
|
@Activate(group = CommonConstants.PROVIDER, order = 1000)
|
||||||
|
|
@ -14,23 +14,21 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.exportmetadata;
|
package org.apache.dubbo.config.integration.single.exportmetadata;
|
||||||
|
|
||||||
import org.apache.dubbo.common.extension.ExtensionLoader;
|
import org.apache.dubbo.common.extension.ExtensionLoader;
|
||||||
import org.apache.dubbo.common.utils.NetUtils;
|
|
||||||
import org.apache.dubbo.config.RegistryConfig;
|
import org.apache.dubbo.config.RegistryConfig;
|
||||||
import org.apache.dubbo.config.ServiceConfig;
|
import org.apache.dubbo.config.ServiceConfig;
|
||||||
import org.apache.dubbo.config.ApplicationConfig;
|
import org.apache.dubbo.config.ApplicationConfig;
|
||||||
import org.apache.dubbo.config.ProtocolConfig;
|
import org.apache.dubbo.config.ProtocolConfig;
|
||||||
import org.apache.dubbo.config.ServiceListener;
|
import org.apache.dubbo.config.ServiceListener;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.integration.IntegrationTest;
|
import org.apache.dubbo.config.integration.IntegrationTest;
|
||||||
import org.apache.dubbo.metadata.MetadataService;
|
import org.apache.dubbo.metadata.MetadataService;
|
||||||
import org.apache.dubbo.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.apache.dubbo.rpc.Exporter;
|
import org.apache.dubbo.rpc.Exporter;
|
||||||
import org.apache.dubbo.rpc.ExporterListener;
|
import org.apache.dubbo.rpc.ExporterListener;
|
||||||
import org.apache.dubbo.rpc.Filter;
|
import org.apache.dubbo.rpc.Filter;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
@ -78,17 +76,10 @@ public class SingleRegistryCenterExportMetadataIntegrationTest implements Integr
|
||||||
*/
|
*/
|
||||||
private SingleRegistryCenterExportMetadataExporterListener exporterListener;
|
private SingleRegistryCenterExportMetadataExporterListener exporterListener;
|
||||||
|
|
||||||
/**
|
|
||||||
* Define a registry center.
|
|
||||||
*/
|
|
||||||
private RegistryCenter registryCenter;
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
logger.info(getClass().getSimpleName() + " testcase is beginning...");
|
logger.info(getClass().getSimpleName() + " testcase is beginning...");
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
registryCenter = new ZookeeperSingleRegistryCenter(NetUtils.getAvailablePort());
|
|
||||||
registryCenter.startup();
|
|
||||||
// initialize service config
|
// initialize service config
|
||||||
serviceConfig = new ServiceConfig<>();
|
serviceConfig = new ServiceConfig<>();
|
||||||
serviceConfig.setInterface(SingleRegistryCenterExportMetadataService.class);
|
serviceConfig.setInterface(SingleRegistryCenterExportMetadataService.class);
|
||||||
|
|
@ -101,11 +92,7 @@ public class SingleRegistryCenterExportMetadataIntegrationTest implements Integr
|
||||||
.application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
|
.application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
|
||||||
.protocol(new ProtocolConfig(PROTOCOL_NAME))
|
.protocol(new ProtocolConfig(PROTOCOL_NAME))
|
||||||
.service(serviceConfig);
|
.service(serviceConfig);
|
||||||
RegistryCenter.Instance instance = registryCenter.getRegistryCenterInstance().get(0);
|
RegistryConfig registryConfig = new RegistryConfig(ZookeeperRegistryCenterConfig.getConnectionAddress());
|
||||||
RegistryConfig registryConfig = new RegistryConfig(String.format("%s://%s:%s",
|
|
||||||
instance.getType(),
|
|
||||||
instance.getHostname(),
|
|
||||||
instance.getPort()));
|
|
||||||
DubboBootstrap.getInstance().registry(registryConfig);
|
DubboBootstrap.getInstance().registry(registryConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -199,7 +186,5 @@ public class SingleRegistryCenterExportMetadataIntegrationTest implements Integr
|
||||||
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
||||||
serviceListener = null;
|
serviceListener = null;
|
||||||
logger.info(getClass().getSimpleName() + " testcase is ending...");
|
logger.info(getClass().getSimpleName() + " testcase is ending...");
|
||||||
registryCenter.shutdown();
|
|
||||||
registryCenter = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.exportmetadata;
|
package org.apache.dubbo.config.integration.single.exportmetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is used to check if the exported metadata service works well or not.
|
* This interface is used to check if the exported metadata service works well or not.
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.exportmetadata;
|
package org.apache.dubbo.config.integration.single.exportmetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The simple implementation for {@link SingleRegistryCenterExportMetadataService}
|
* The simple implementation for {@link SingleRegistryCenterExportMetadataService}
|
||||||
|
|
@ -14,10 +14,10 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.exportmetadata;
|
package org.apache.dubbo.config.integration.single.exportmetadata;
|
||||||
|
|
||||||
import org.apache.dubbo.config.ServiceListener;
|
import org.apache.dubbo.config.ServiceListener;
|
||||||
import org.apache.dubbo.integration.AbstractRegistryCenterServiceListener;
|
import org.apache.dubbo.config.integration.AbstractRegistryCenterServiceListener;
|
||||||
import org.apache.dubbo.metadata.MetadataService;
|
import org.apache.dubbo.metadata.MetadataService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -14,11 +14,11 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.exportprovider;
|
package org.apache.dubbo.config.integration.single.exportprovider;
|
||||||
|
|
||||||
import org.apache.dubbo.common.constants.CommonConstants;
|
import org.apache.dubbo.common.constants.CommonConstants;
|
||||||
import org.apache.dubbo.common.extension.Activate;
|
import org.apache.dubbo.common.extension.Activate;
|
||||||
import org.apache.dubbo.integration.AbstractRegistryCenterExporterListener;
|
import org.apache.dubbo.config.integration.AbstractRegistryCenterExporterListener;
|
||||||
|
|
||||||
@Activate(group = CommonConstants.PROVIDER, order = 1000)
|
@Activate(group = CommonConstants.PROVIDER, order = 1000)
|
||||||
public class SingleRegistryCenterExportProviderExporterListener extends AbstractRegistryCenterExporterListener {
|
public class SingleRegistryCenterExportProviderExporterListener extends AbstractRegistryCenterExporterListener {
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.exportprovider;
|
package org.apache.dubbo.config.integration.single.exportprovider;
|
||||||
|
|
||||||
import org.apache.dubbo.common.constants.CommonConstants;
|
import org.apache.dubbo.common.constants.CommonConstants;
|
||||||
import org.apache.dubbo.common.extension.Activate;
|
import org.apache.dubbo.common.extension.Activate;
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.exportprovider;
|
package org.apache.dubbo.config.integration.single.exportprovider;
|
||||||
|
|
||||||
import org.apache.dubbo.common.config.configcenter.ConfigItem;
|
import org.apache.dubbo.common.config.configcenter.ConfigItem;
|
||||||
import org.apache.dubbo.common.constants.CommonConstants;
|
import org.apache.dubbo.common.constants.CommonConstants;
|
||||||
|
|
@ -26,15 +26,14 @@ import org.apache.dubbo.config.RegistryConfig;
|
||||||
import org.apache.dubbo.config.ServiceConfig;
|
import org.apache.dubbo.config.ServiceConfig;
|
||||||
import org.apache.dubbo.config.ServiceListener;
|
import org.apache.dubbo.config.ServiceListener;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.integration.IntegrationTest;
|
import org.apache.dubbo.config.integration.IntegrationTest;
|
||||||
import org.apache.dubbo.metadata.ServiceNameMapping;
|
import org.apache.dubbo.metadata.ServiceNameMapping;
|
||||||
import org.apache.dubbo.metadata.report.MetadataReportInstance;
|
import org.apache.dubbo.metadata.report.MetadataReportInstance;
|
||||||
import org.apache.dubbo.registry.integration.RegistryProtocolListener;
|
import org.apache.dubbo.registry.integration.RegistryProtocolListener;
|
||||||
import org.apache.dubbo.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.registrycenter.ZookeeperMultipleRegistryCenter;
|
|
||||||
import org.apache.dubbo.rpc.ExporterListener;
|
import org.apache.dubbo.rpc.ExporterListener;
|
||||||
import org.apache.dubbo.rpc.Filter;
|
import org.apache.dubbo.rpc.Filter;
|
||||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
@ -47,7 +46,7 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.apache.dubbo.common.constants.CommonConstants.REGISTRY_PROTOCOL_LISTENER_KEY;
|
import static org.apache.dubbo.common.constants.CommonConstants.REGISTRY_PROTOCOL_LISTENER_KEY;
|
||||||
import static org.apache.dubbo.integration.Constants.SINGLE_CONFIG_CENTER_EXPORT_PROVIDER;
|
import static org.apache.dubbo.config.integration.Constants.SINGLE_CONFIG_CENTER_EXPORT_PROVIDER;
|
||||||
import static org.apache.dubbo.rpc.Constants.SCOPE_LOCAL;
|
import static org.apache.dubbo.rpc.Constants.SCOPE_LOCAL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -76,11 +75,6 @@ public class SingleRegistryCenterExportProviderIntegrationTest implements Integr
|
||||||
*/
|
*/
|
||||||
private ServiceConfig<SingleRegistryCenterExportProviderService> serviceConfig;
|
private ServiceConfig<SingleRegistryCenterExportProviderService> serviceConfig;
|
||||||
|
|
||||||
/**
|
|
||||||
* Define a registry center.
|
|
||||||
*/
|
|
||||||
private RegistryCenter registryCenter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define a {@link RegistryProtocolListener} instance.
|
* Define a {@link RegistryProtocolListener} instance.
|
||||||
*/
|
*/
|
||||||
|
|
@ -105,8 +99,6 @@ public class SingleRegistryCenterExportProviderIntegrationTest implements Integr
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
logger.info(getClass().getSimpleName() + " testcase is beginning...");
|
logger.info(getClass().getSimpleName() + " testcase is beginning...");
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
registryCenter = new ZookeeperMultipleRegistryCenter();
|
|
||||||
registryCenter.startup();
|
|
||||||
// initialize service config
|
// initialize service config
|
||||||
serviceConfig = new ServiceConfig<>();
|
serviceConfig = new ServiceConfig<>();
|
||||||
serviceConfig.setInterface(SingleRegistryCenterExportProviderService.class);
|
serviceConfig.setInterface(SingleRegistryCenterExportProviderService.class);
|
||||||
|
|
@ -118,12 +110,8 @@ public class SingleRegistryCenterExportProviderIntegrationTest implements Integr
|
||||||
.application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
|
.application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
|
||||||
.protocol(new ProtocolConfig(PROTOCOL_NAME, PROTOCOL_PORT))
|
.protocol(new ProtocolConfig(PROTOCOL_NAME, PROTOCOL_PORT))
|
||||||
.service(serviceConfig);
|
.service(serviceConfig);
|
||||||
RegistryCenter.Instance instance = registryCenter.getRegistryCenterInstance().get(0);
|
|
||||||
|
|
||||||
RegistryConfig registryConfig = new RegistryConfig(String.format("%s://%s:%s",
|
RegistryConfig registryConfig = new RegistryConfig(ZookeeperRegistryCenterConfig.getConnectionAddress());
|
||||||
instance.getType(),
|
|
||||||
instance.getHostname(),
|
|
||||||
instance.getPort()));
|
|
||||||
Map<String, String> parameters = new HashMap<>();
|
Map<String, String> parameters = new HashMap<>();
|
||||||
parameters.put(REGISTRY_PROTOCOL_LISTENER_KEY, "singleConfigCenterExportProvider");
|
parameters.put(REGISTRY_PROTOCOL_LISTENER_KEY, "singleConfigCenterExportProvider");
|
||||||
registryConfig.updateParameters(parameters);
|
registryConfig.updateParameters(parameters);
|
||||||
|
|
@ -253,8 +241,6 @@ public class SingleRegistryCenterExportProviderIntegrationTest implements Integr
|
||||||
// The exported service has been unexported
|
// The exported service has been unexported
|
||||||
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
||||||
logger.info(getClass().getSimpleName() + " testcase is ending...");
|
logger.info(getClass().getSimpleName() + " testcase is ending...");
|
||||||
registryCenter.shutdown();
|
|
||||||
registryProtocolListener = null;
|
registryProtocolListener = null;
|
||||||
registryCenter = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.exportprovider;
|
package org.apache.dubbo.config.integration.single.exportprovider;
|
||||||
|
|
||||||
import org.apache.dubbo.common.URL;
|
import org.apache.dubbo.common.URL;
|
||||||
import org.apache.dubbo.common.extension.Activate;
|
import org.apache.dubbo.common.extension.Activate;
|
||||||
|
|
@ -24,7 +24,7 @@ import org.apache.dubbo.registry.integration.RegistryProtocolListener;
|
||||||
import org.apache.dubbo.rpc.Exporter;
|
import org.apache.dubbo.rpc.Exporter;
|
||||||
import org.apache.dubbo.rpc.cluster.ClusterInvoker;
|
import org.apache.dubbo.rpc.cluster.ClusterInvoker;
|
||||||
|
|
||||||
import static org.apache.dubbo.integration.Constants.SINGLE_CONFIG_CENTER_EXPORT_PROVIDER;
|
import static org.apache.dubbo.config.integration.Constants.SINGLE_CONFIG_CENTER_EXPORT_PROVIDER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link RegistryProtocolListener} for {@link SingleRegistryCenterExportProviderService}
|
* The {@link RegistryProtocolListener} for {@link SingleRegistryCenterExportProviderService}
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.exportprovider;
|
package org.apache.dubbo.config.integration.single.exportprovider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is used to check if the exported provider works well or not.
|
* This interface is used to check if the exported provider works well or not.
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.exportprovider;
|
package org.apache.dubbo.config.integration.single.exportprovider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The implementation of {@link SingleRegistryCenterExportProviderService}
|
* The implementation of {@link SingleRegistryCenterExportProviderService}
|
||||||
|
|
@ -14,10 +14,10 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.exportprovider;
|
package org.apache.dubbo.config.integration.single.exportprovider;
|
||||||
|
|
||||||
import org.apache.dubbo.config.ServiceListener;
|
import org.apache.dubbo.config.ServiceListener;
|
||||||
import org.apache.dubbo.integration.AbstractRegistryCenterServiceListener;
|
import org.apache.dubbo.config.integration.AbstractRegistryCenterServiceListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This implementation of {@link ServiceListener} is to record exported services with injvm protocol in single registry center.
|
* This implementation of {@link ServiceListener} is to record exported services with injvm protocol in single registry center.
|
||||||
|
|
@ -14,11 +14,11 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.injvm;
|
package org.apache.dubbo.config.integration.single.injvm;
|
||||||
|
|
||||||
import org.apache.dubbo.common.constants.CommonConstants;
|
import org.apache.dubbo.common.constants.CommonConstants;
|
||||||
import org.apache.dubbo.common.extension.Activate;
|
import org.apache.dubbo.common.extension.Activate;
|
||||||
import org.apache.dubbo.integration.AbstractRegistryCenterExporterListener;
|
import org.apache.dubbo.config.integration.AbstractRegistryCenterExporterListener;
|
||||||
|
|
||||||
@Activate(group = CommonConstants.PROVIDER, order = 1000)
|
@Activate(group = CommonConstants.PROVIDER, order = 1000)
|
||||||
public class SingleRegistryCenterInjvmExporterListener extends AbstractRegistryCenterExporterListener {
|
public class SingleRegistryCenterInjvmExporterListener extends AbstractRegistryCenterExporterListener {
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.injvm;
|
package org.apache.dubbo.config.integration.single.injvm;
|
||||||
|
|
||||||
import org.apache.dubbo.common.constants.CommonConstants;
|
import org.apache.dubbo.common.constants.CommonConstants;
|
||||||
import org.apache.dubbo.common.extension.Activate;
|
import org.apache.dubbo.common.extension.Activate;
|
||||||
|
|
@ -14,10 +14,9 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.injvm;
|
package org.apache.dubbo.config.integration.single.injvm;
|
||||||
|
|
||||||
import org.apache.dubbo.common.extension.ExtensionLoader;
|
import org.apache.dubbo.common.extension.ExtensionLoader;
|
||||||
import org.apache.dubbo.common.utils.NetUtils;
|
|
||||||
import org.apache.dubbo.config.ApplicationConfig;
|
import org.apache.dubbo.config.ApplicationConfig;
|
||||||
import org.apache.dubbo.config.ProtocolConfig;
|
import org.apache.dubbo.config.ProtocolConfig;
|
||||||
import org.apache.dubbo.config.ReferenceConfig;
|
import org.apache.dubbo.config.ReferenceConfig;
|
||||||
|
|
@ -25,11 +24,10 @@ import org.apache.dubbo.config.RegistryConfig;
|
||||||
import org.apache.dubbo.config.ServiceConfig;
|
import org.apache.dubbo.config.ServiceConfig;
|
||||||
import org.apache.dubbo.config.ServiceListener;
|
import org.apache.dubbo.config.ServiceListener;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.integration.IntegrationTest;
|
import org.apache.dubbo.config.integration.IntegrationTest;
|
||||||
import org.apache.dubbo.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.apache.dubbo.rpc.ExporterListener;
|
import org.apache.dubbo.rpc.ExporterListener;
|
||||||
import org.apache.dubbo.rpc.Filter;
|
import org.apache.dubbo.rpc.Filter;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
@ -77,17 +75,10 @@ public class SingleRegistryCenterInjvmIntegrationTest implements IntegrationTest
|
||||||
*/
|
*/
|
||||||
private SingleRegistryCenterInjvmFilter filter;
|
private SingleRegistryCenterInjvmFilter filter;
|
||||||
|
|
||||||
/**
|
|
||||||
* Define a registry center.
|
|
||||||
*/
|
|
||||||
private RegistryCenter registryCenter;
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
logger.info(getClass().getSimpleName() + " testcase is beginning...");
|
logger.info(getClass().getSimpleName() + " testcase is beginning...");
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
registryCenter = new ZookeeperSingleRegistryCenter(NetUtils.getAvailablePort());
|
|
||||||
registryCenter.startup();
|
|
||||||
// initialize service config
|
// initialize service config
|
||||||
serviceConfig = new ServiceConfig<>();
|
serviceConfig = new ServiceConfig<>();
|
||||||
serviceConfig.setInterface(SingleRegistryCenterInjvmService.class);
|
serviceConfig.setInterface(SingleRegistryCenterInjvmService.class);
|
||||||
|
|
@ -100,11 +91,7 @@ public class SingleRegistryCenterInjvmIntegrationTest implements IntegrationTest
|
||||||
.application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
|
.application(new ApplicationConfig(PROVIDER_APPLICATION_NAME))
|
||||||
.protocol(new ProtocolConfig("injvm"))
|
.protocol(new ProtocolConfig("injvm"))
|
||||||
.service(serviceConfig);
|
.service(serviceConfig);
|
||||||
RegistryCenter.Instance instance = registryCenter.getRegistryCenterInstance().get(0);
|
RegistryConfig registryConfig = new RegistryConfig(ZookeeperRegistryCenterConfig.getConnectionAddress());
|
||||||
RegistryConfig registryConfig = new RegistryConfig(String.format("%s://%s:%s",
|
|
||||||
instance.getType(),
|
|
||||||
instance.getHostname(),
|
|
||||||
instance.getPort()));
|
|
||||||
DubboBootstrap.getInstance().registry(registryConfig);
|
DubboBootstrap.getInstance().registry(registryConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -199,7 +186,5 @@ public class SingleRegistryCenterInjvmIntegrationTest implements IntegrationTest
|
||||||
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
||||||
serviceListener = null;
|
serviceListener = null;
|
||||||
logger.info(getClass().getSimpleName() + " testcase is ending...");
|
logger.info(getClass().getSimpleName() + " testcase is ending...");
|
||||||
registryCenter.shutdown();
|
|
||||||
registryCenter = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.injvm;
|
package org.apache.dubbo.config.integration.single.injvm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface is used to check if the exported injvm protocol works well or not.
|
* This interface is used to check if the exported injvm protocol works well or not.
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.injvm;
|
package org.apache.dubbo.config.integration.single.injvm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The simple implementation for {@link SingleRegistryCenterInjvmService}
|
* The simple implementation for {@link SingleRegistryCenterInjvmService}
|
||||||
|
|
@ -14,10 +14,10 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single.injvm;
|
package org.apache.dubbo.config.integration.single.injvm;
|
||||||
|
|
||||||
import org.apache.dubbo.config.ServiceListener;
|
import org.apache.dubbo.config.ServiceListener;
|
||||||
import org.apache.dubbo.integration.AbstractRegistryCenterServiceListener;
|
import org.apache.dubbo.config.integration.AbstractRegistryCenterServiceListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This implementation of {@link ServiceListener} is to record exported services with injvm protocol in single registry center.
|
* This implementation of {@link ServiceListener} is to record exported services with injvm protocol in single registry center.
|
||||||
|
|
@ -19,4 +19,4 @@
|
||||||
* The one is single registry center, the other is multiple registry centers.<p>
|
* The one is single registry center, the other is multiple registry centers.<p>
|
||||||
* The purpose of all of testcases in this package is to test for single registry center.
|
* The purpose of all of testcases in this package is to test for single registry center.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.integration.single;
|
package org.apache.dubbo.config.integration.single;
|
||||||
|
|
@ -14,23 +14,21 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.metadata;
|
package org.apache.dubbo.config.metadata;
|
||||||
|
|
||||||
import org.apache.dubbo.common.URL;
|
import org.apache.dubbo.common.URL;
|
||||||
import org.apache.dubbo.common.utils.NetUtils;
|
|
||||||
import org.apache.dubbo.config.ApplicationConfig;
|
import org.apache.dubbo.config.ApplicationConfig;
|
||||||
import org.apache.dubbo.config.ProtocolConfig;
|
import org.apache.dubbo.config.ProtocolConfig;
|
||||||
import org.apache.dubbo.config.RegistryConfig;
|
import org.apache.dubbo.config.RegistryConfig;
|
||||||
import org.apache.dubbo.config.ServiceConfig;
|
import org.apache.dubbo.config.ServiceConfig;
|
||||||
import org.apache.dubbo.config.api.DemoService;
|
import org.apache.dubbo.config.api.DemoService;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.config.metadata.ConfigurableMetadataServiceExporter;
|
|
||||||
import org.apache.dubbo.config.provider.impl.DemoServiceImpl;
|
import org.apache.dubbo.config.provider.impl.DemoServiceImpl;
|
||||||
import org.apache.dubbo.registrycenter.RegistryCenter;
|
import org.apache.dubbo.metadata.MetadataService;
|
||||||
import org.apache.dubbo.registrycenter.ZookeeperSingleRegistryCenter;
|
import org.apache.dubbo.metadata.MetadataServiceExporter;
|
||||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||||
import org.apache.dubbo.rpc.model.FrameworkModel;
|
import org.apache.dubbo.rpc.model.FrameworkModel;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
@ -241,20 +239,12 @@ public class MetadataServiceExporterTest {
|
||||||
// assertFalse(exporter.isExported());
|
// assertFalse(exporter.isExported());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private static ZookeeperSingleRegistryCenter registryCenter;
|
|
||||||
private static RegistryConfig registryConfig;
|
private static RegistryConfig registryConfig;
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll() {
|
public static void beforeAll() {
|
||||||
FrameworkModel.destroyAll();
|
FrameworkModel.destroyAll();
|
||||||
registryCenter = new ZookeeperSingleRegistryCenter(NetUtils.getAvailablePort());
|
registryConfig = new RegistryConfig(ZookeeperRegistryCenterConfig.getConnectionAddress());
|
||||||
registryCenter.startup();
|
|
||||||
RegistryCenter.Instance instance = registryCenter.getRegistryCenterInstance().get(0);
|
|
||||||
registryConfig = new RegistryConfig(String.format("%s://%s:%s",
|
|
||||||
instance.getType(),
|
|
||||||
instance.getHostname(),
|
|
||||||
instance.getPort()));
|
|
||||||
|
|
||||||
// pre-check threads
|
// pre-check threads
|
||||||
//precheckUnclosedThreads();
|
//precheckUnclosedThreads();
|
||||||
}
|
}
|
||||||
|
|
@ -1,107 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.apache.dubbo.registrycenter;
|
|
||||||
|
|
||||||
import org.apache.curator.test.InstanceSpec;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The abstraction of {@link RegistryCenter} implements the basic methods.
|
|
||||||
*/
|
|
||||||
abstract class AbstractRegistryCenter implements RegistryCenter {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default data directory is null
|
|
||||||
*/
|
|
||||||
private static final File DEFAULT_DATA_DIRECTORY = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default election port is -1.
|
|
||||||
*/
|
|
||||||
private static final int DEFAULT_ELECTION_PORT = -1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default quorum port is -1.
|
|
||||||
*/
|
|
||||||
private static final int DEFAULT_QUORUM_PORT = -1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default value is true.
|
|
||||||
*/
|
|
||||||
private static final boolean DEFAULT_DELETE_DATA_DIRECTORY_ON_CLOSE = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default service id is -1.
|
|
||||||
*/
|
|
||||||
private static final int DEFAULT_SERVER_ID = -1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default tick time is 5000
|
|
||||||
*/
|
|
||||||
private static final int DEFAULT_TICK_TIME = 5 * 1000;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default value is -1.
|
|
||||||
*/
|
|
||||||
private static final int DEFAULT_MAX_CLIENT_CNXNS = 200;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The minimum session timeout.
|
|
||||||
*/
|
|
||||||
private static final int DEFAULT_MINIMUM_SESSION_TIMEOUT = DEFAULT_TICK_TIME * 2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The maximum session timeout.
|
|
||||||
*/
|
|
||||||
private static final int DEFAULT_MAXIMUM_SESSION_TIMEOUT = 60 * 1000;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default customer properties.
|
|
||||||
*/
|
|
||||||
private static final Map<String, Object> DEFAULT_CUSTOM_PROPERTIES = new HashMap<>(2);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default hostname.
|
|
||||||
*/
|
|
||||||
private static final String DEFAULT_HOSTNAME = "127.0.0.1";
|
|
||||||
|
|
||||||
static {
|
|
||||||
DEFAULT_CUSTOM_PROPERTIES.put("minSessionTimeout", DEFAULT_MINIMUM_SESSION_TIMEOUT);
|
|
||||||
DEFAULT_CUSTOM_PROPERTIES.put("maxSessionTimeout", DEFAULT_MAXIMUM_SESSION_TIMEOUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an {@link InstanceSpec} instance to initialize {@link org.apache.curator.test.TestingServer}
|
|
||||||
*
|
|
||||||
* @param port the zookeeper server's port.
|
|
||||||
*/
|
|
||||||
protected InstanceSpec createInstanceSpec(int port) {
|
|
||||||
return new InstanceSpec(DEFAULT_DATA_DIRECTORY,
|
|
||||||
port,
|
|
||||||
DEFAULT_ELECTION_PORT,
|
|
||||||
DEFAULT_QUORUM_PORT,
|
|
||||||
DEFAULT_DELETE_DATA_DIRECTORY_ON_CLOSE,
|
|
||||||
DEFAULT_SERVER_ID,
|
|
||||||
DEFAULT_TICK_TIME,
|
|
||||||
DEFAULT_MAX_CLIENT_CNXNS,
|
|
||||||
DEFAULT_CUSTOM_PROPERTIES,
|
|
||||||
DEFAULT_HOSTNAME);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.apache.dubbo.registrycenter;
|
|
||||||
|
|
||||||
import org.apache.dubbo.rpc.RpcException;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The mock registry center.
|
|
||||||
*/
|
|
||||||
public interface RegistryCenter {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start the registry center.
|
|
||||||
*
|
|
||||||
* @throws RpcException when an exception occurred
|
|
||||||
*/
|
|
||||||
void startup() throws RpcException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the registry center instance.
|
|
||||||
* <p>This method can be called only after {@link #startup()} is called</p>
|
|
||||||
*
|
|
||||||
* @throws RpcException when an exception occurred
|
|
||||||
*/
|
|
||||||
List<Instance> getRegistryCenterInstance() throws RpcException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop the registry center.
|
|
||||||
*
|
|
||||||
* @throws RpcException when an exception occurred
|
|
||||||
*/
|
|
||||||
void shutdown() throws RpcException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The registry center instance.
|
|
||||||
*/
|
|
||||||
interface Instance {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the registry center type.
|
|
||||||
*/
|
|
||||||
String getType();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the hostname of registry center.
|
|
||||||
*/
|
|
||||||
String getHostname();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the port of registry center.
|
|
||||||
*/
|
|
||||||
int getPort();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,142 +0,0 @@
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
|
||||||
* this work for additional information regarding copyright ownership.
|
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
* (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.apache.dubbo.registrycenter;
|
|
||||||
|
|
||||||
import org.apache.curator.test.InstanceSpec;
|
|
||||||
import org.apache.curator.test.TestingServer;
|
|
||||||
import org.apache.dubbo.common.logger.Logger;
|
|
||||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
|
||||||
import org.apache.dubbo.rpc.RpcException;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default implementation of registry center can support single and multiple registry center.
|
|
||||||
* <p>Each port represents an instance. You can provide multiple ports to build multiple registry center,
|
|
||||||
* if you want to create multiple registry center
|
|
||||||
*/
|
|
||||||
class ZookeeperRegistryCenter extends AbstractRegistryCenter {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the default registry center.
|
|
||||||
*
|
|
||||||
* @param ports the registry center's ports.
|
|
||||||
*/
|
|
||||||
public ZookeeperRegistryCenter(int... ports) {
|
|
||||||
this.ports = ports;
|
|
||||||
this.instanceSpecs = new ArrayList<>(this.ports.length);
|
|
||||||
this.zookeeperServers = new ArrayList<>(this.ports.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ZookeeperRegistryCenter.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The type of the registry center.
|
|
||||||
*/
|
|
||||||
private static final String DEFAULT_REGISTRY_CENTER_TYPE = "zookeeper";
|
|
||||||
|
|
||||||
private int[] ports;
|
|
||||||
|
|
||||||
private List<InstanceSpec> instanceSpecs;
|
|
||||||
|
|
||||||
private List<TestingServer> zookeeperServers;
|
|
||||||
|
|
||||||
private AtomicBoolean started = new AtomicBoolean(false);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void startup() throws RpcException {
|
|
||||||
try {
|
|
||||||
if (started.compareAndSet(false, true)) {
|
|
||||||
logger.info("The ZookeeperRegistryCenter is starting...");
|
|
||||||
for (int port : this.ports) {
|
|
||||||
InstanceSpec instanceSpec = this.createInstanceSpec(port);
|
|
||||||
this.instanceSpecs.add(instanceSpec);
|
|
||||||
this.zookeeperServers.add(new TestingServer(instanceSpec, true));
|
|
||||||
}
|
|
||||||
logger.info("The ZookeeperRegistryCenter is started successfully");
|
|
||||||
}
|
|
||||||
} catch (Exception exception) {
|
|
||||||
started.set(false);
|
|
||||||
throw new RpcException("Failed to initialize ZookeeperRegistryCenter instance", exception);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<Instance> getRegistryCenterInstance() throws RpcException {
|
|
||||||
this.startup();
|
|
||||||
List<Instance> instances = new ArrayList<>(this.instanceSpecs.size());
|
|
||||||
for (InstanceSpec instanceSpec : this.instanceSpecs) {
|
|
||||||
instances.add(new Instance() {
|
|
||||||
@Override
|
|
||||||
public String getType() {
|
|
||||||
return DEFAULT_REGISTRY_CENTER_TYPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getHostname() {
|
|
||||||
return instanceSpec.getHostname();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPort() {
|
|
||||||
return instanceSpec.getPort();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return instances;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void shutdown() throws RpcException {
|
|
||||||
logger.info("The ZookeeperRegistryCenter is stopping...");
|
|
||||||
List<RpcException> exceptions = new ArrayList<>(this.zookeeperServers.size());
|
|
||||||
for (TestingServer testingServer : this.zookeeperServers) {
|
|
||||||
try {
|
|
||||||
testingServer.close();
|
|
||||||
logger.info(String.format("The zookeeper instance of %s is shutdown successfully",
|
|
||||||
testingServer.getConnectString()));
|
|
||||||
} catch (IOException exception) {
|
|
||||||
RpcException rpcException = new RpcException(String.format("Failed to close zookeeper instance of %s",
|
|
||||||
testingServer.getConnectString()),
|
|
||||||
exception);
|
|
||||||
exceptions.add(rpcException);
|
|
||||||
logger.error(rpcException);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.instanceSpecs.clear();
|
|
||||||
this.zookeeperServers.clear();
|
|
||||||
if (!exceptions.isEmpty()) {
|
|
||||||
logger.info("The ZookeeperRegistryCenter failed to close.");
|
|
||||||
// throw any one of exceptions
|
|
||||||
throw exceptions.get(0);
|
|
||||||
} else {
|
|
||||||
logger.info("The ZookeeperRegistryCenter close successfully.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
mock=org.apache.dubbo.config.mock.MockServiceListener
|
mock=org.apache.dubbo.config.mock.MockServiceListener
|
||||||
exported=org.apache.dubbo.integration.single.SingleRegistryCenterExportedServiceListener
|
exported=org.apache.dubbo.config.integration.single.SingleRegistryCenterExportedServiceListener
|
||||||
singleConfigCenterInjvm=org.apache.dubbo.integration.single.injvm.SingleRegistryCenterInjvmServiceListener
|
singleConfigCenterInjvm=org.apache.dubbo.config.integration.single.injvm.SingleRegistryCenterInjvmServiceListener
|
||||||
multipleConfigCenterInjvm=org.apache.dubbo.integration.multiple.injvm.MultipleRegistryCenterInjvmServiceListener
|
multipleConfigCenterInjvm=org.apache.dubbo.config.integration.multiple.injvm.MultipleRegistryCenterInjvmServiceListener
|
||||||
singleConfigCenterExportProvider=org.apache.dubbo.integration.single.exportprovider.SingleRegistryCenterExportProviderServiceListener
|
singleConfigCenterExportProvider=org.apache.dubbo.config.integration.single.exportprovider.SingleRegistryCenterExportProviderServiceListener
|
||||||
singleConfigCenterExportMetadata=org.apache.dubbo.integration.single.exportmetadata.SingleRegistryCenterExportMetadataServiceListener
|
singleConfigCenterExportMetadata=org.apache.dubbo.config.integration.single.exportmetadata.SingleRegistryCenterExportMetadataServiceListener
|
||||||
multipleConfigCenterExportMetadata=org.apache.dubbo.integration.multiple.exportmetadata.MultipleRegistryCenterExportMetadataServiceListener
|
multipleConfigCenterExportMetadata=org.apache.dubbo.config.integration.multiple.exportmetadata.MultipleRegistryCenterExportMetadataServiceListener
|
||||||
multipleConfigCenterExportProvider=org.apache.dubbo.integration.multiple.exportprovider.MultipleRegistryCenterExportProviderServiceListener
|
multipleConfigCenterExportProvider=org.apache.dubbo.config.integration.multiple.exportprovider.MultipleRegistryCenterExportProviderServiceListener
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
multipleConfigCenterServiceDiscoveryRegistry=org.apache.dubbo.integration.multiple.servicediscoveryregistry.MultipleRegistryCenterServiceDiscoveryRegistryRegistryServiceListener
|
multipleConfigCenterServiceDiscoveryRegistry=org.apache.dubbo.config.integration.multiple.servicediscoveryregistry.MultipleRegistryCenterServiceDiscoveryRegistryRegistryServiceListener
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
singleConfigCenterExportProvider=org.apache.dubbo.integration.single.exportprovider.SingleRegistryCenterExportProviderRegistryProtocolListener
|
singleConfigCenterExportProvider=org.apache.dubbo.config.integration.single.exportprovider.SingleRegistryCenterExportProviderRegistryProtocolListener
|
||||||
multipleConfigCenterExportProvider=org.apache.dubbo.integration.multiple.exportprovider.MultipleRegistryCenterExportProviderRegistryProtocolListener
|
multipleConfigCenterExportProvider=org.apache.dubbo.config.integration.multiple.exportprovider.MultipleRegistryCenterExportProviderRegistryProtocolListener
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
mockexporterlistener=org.apache.dubbo.config.mock.MockExporterListener
|
mockexporterlistener=org.apache.dubbo.config.mock.MockExporterListener
|
||||||
singleConfigCenterInjvm=org.apache.dubbo.integration.single.injvm.SingleRegistryCenterInjvmExporterListener
|
singleConfigCenterInjvm=org.apache.dubbo.config.integration.single.injvm.SingleRegistryCenterInjvmExporterListener
|
||||||
multipleConfigCenterInjvm=org.apache.dubbo.integration.multiple.injvm.MultipleRegistryCenterInjvmExporterListener
|
multipleConfigCenterInjvm=org.apache.dubbo.config.integration.multiple.injvm.MultipleRegistryCenterInjvmExporterListener
|
||||||
singleConfigCenterExportProvider=org.apache.dubbo.integration.single.exportprovider.SingleRegistryCenterExportProviderExporterListener
|
singleConfigCenterExportProvider=org.apache.dubbo.config.integration.single.exportprovider.SingleRegistryCenterExportProviderExporterListener
|
||||||
singleConfigCenterExportMetadata=org.apache.dubbo.integration.single.exportmetadata.SingleRegistryCenterExportMetadataExporterListener
|
singleConfigCenterExportMetadata=org.apache.dubbo.config.integration.single.exportmetadata.SingleRegistryCenterExportMetadataExporterListener
|
||||||
multipleConfigCenterExportMetadata=org.apache.dubbo.integration.multiple.exportmetadata.MultipleRegistryCenterExportMetadataExporterListener
|
multipleConfigCenterExportMetadata=org.apache.dubbo.config.integration.multiple.exportmetadata.MultipleRegistryCenterExportMetadataExporterListener
|
||||||
multipleConfigCenterExportProvider=org.apache.dubbo.integration.multiple.exportprovider.MultipleRegistryCenterExportProviderExporterListener
|
multipleConfigCenterExportProvider=org.apache.dubbo.config.integration.multiple.exportprovider.MultipleRegistryCenterExportProviderExporterListener
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
mockfilter=org.apache.dubbo.config.mock.MockFilter
|
mockfilter=org.apache.dubbo.config.mock.MockFilter
|
||||||
singleConfigCenterInjvm=org.apache.dubbo.integration.single.injvm.SingleRegistryCenterInjvmFilter
|
singleConfigCenterInjvm=org.apache.dubbo.config.integration.single.injvm.SingleRegistryCenterInjvmFilter
|
||||||
multipleConfigCenterInjvm=org.apache.dubbo.integration.multiple.injvm.MultipleRegistryCenterInjvmFilter
|
multipleConfigCenterInjvm=org.apache.dubbo.config.integration.multiple.injvm.MultipleRegistryCenterInjvmFilter
|
||||||
singleConfigCenterExportProvider=org.apache.dubbo.integration.single.exportprovider.SingleRegistryCenterExportProviderFilter
|
singleConfigCenterExportProvider=org.apache.dubbo.config.integration.single.exportprovider.SingleRegistryCenterExportProviderFilter
|
||||||
multipleConfigCenterExportProvider=org.apache.dubbo.integration.multiple.exportprovider.MultipleRegistryCenterExportProviderFilter
|
multipleConfigCenterExportProvider=org.apache.dubbo.config.integration.multiple.exportprovider.MultipleRegistryCenterExportProviderFilter
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,6 @@ import org.apache.dubbo.config.spring.impl.HelloServiceImpl;
|
||||||
import org.apache.dubbo.config.spring.impl.NotifyService;
|
import org.apache.dubbo.config.spring.impl.NotifyService;
|
||||||
import org.apache.dubbo.config.spring.registry.MockRegistry;
|
import org.apache.dubbo.config.spring.registry.MockRegistry;
|
||||||
import org.apache.dubbo.config.spring.registry.MockRegistryFactory;
|
import org.apache.dubbo.config.spring.registry.MockRegistryFactory;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.apache.dubbo.registry.Registry;
|
import org.apache.dubbo.registry.Registry;
|
||||||
import org.apache.dubbo.registry.RegistryService;
|
import org.apache.dubbo.registry.RegistryService;
|
||||||
import org.apache.dubbo.rpc.Exporter;
|
import org.apache.dubbo.rpc.Exporter;
|
||||||
|
|
@ -86,19 +84,6 @@ public class ConfigTest {
|
||||||
|
|
||||||
private static String resourcePath = ConfigTest.class.getPackage().getName().replace('.', '/');
|
private static String resourcePath = ConfigTest.class.getPackage().getName().replace('.', '/');
|
||||||
|
|
||||||
private static RegistryCenter singleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
|
||||||
public static void beforeAll() {
|
|
||||||
singleRegistryCenter = new ZookeeperSingleRegistryCenter();
|
|
||||||
singleRegistryCenter.startup();
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterAll
|
|
||||||
public static void afterAll() {
|
|
||||||
singleRegistryCenter.shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
SysProps.clear();
|
SysProps.clear();
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,11 @@ import org.apache.dubbo.config.context.ModuleConfigManager;
|
||||||
import org.apache.dubbo.config.spring.api.DemoService;
|
import org.apache.dubbo.config.spring.api.DemoService;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.apache.dubbo.config.spring.impl.DemoServiceImpl;
|
import org.apache.dubbo.config.spring.impl.DemoServiceImpl;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.apache.dubbo.rpc.Constants;
|
import org.apache.dubbo.rpc.Constants;
|
||||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||||
|
|
@ -50,18 +47,6 @@ public class JavaConfigBeanTest {
|
||||||
|
|
||||||
private static final String MY_PROTOCOL_ID = "myProtocol";
|
private static final String MY_PROTOCOL_ID = "myProtocol";
|
||||||
private static final String MY_REGISTRY_ID = "my-registry";
|
private static final String MY_REGISTRY_ID = "my-registry";
|
||||||
private static RegistryCenter singleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
|
||||||
public static void beforeAll() {
|
|
||||||
singleRegistryCenter = new ZookeeperSingleRegistryCenter();
|
|
||||||
singleRegistryCenter.startup();
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterAll
|
|
||||||
public static void afterAll() {
|
|
||||||
singleRegistryCenter.shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void beforeEach() {
|
public void beforeEach() {
|
||||||
|
|
@ -80,7 +65,7 @@ public class JavaConfigBeanTest {
|
||||||
SysProps.setProperty("dubbo.application.qos-enable", "false");
|
SysProps.setProperty("dubbo.application.qos-enable", "false");
|
||||||
SysProps.setProperty("dubbo.protocol.name", "dubbo");
|
SysProps.setProperty("dubbo.protocol.name", "dubbo");
|
||||||
SysProps.setProperty("dubbo.protocol.port", "2346");
|
SysProps.setProperty("dubbo.protocol.port", "2346");
|
||||||
String registryAddress = "zookeeper://127.0.0.1:2181";
|
String registryAddress = ZookeeperRegistryCenterConfig.getConnectionAddress();
|
||||||
SysProps.setProperty("dubbo.registry.address", registryAddress);
|
SysProps.setProperty("dubbo.registry.address", registryAddress);
|
||||||
SysProps.setProperty("dubbo.provider.group", "test");
|
SysProps.setProperty("dubbo.provider.group", "test");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,6 @@ import org.apache.dubbo.config.spring.api.HelloService;
|
||||||
import org.apache.dubbo.config.spring.api.MethodCallback;
|
import org.apache.dubbo.config.spring.api.MethodCallback;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.provider.ProviderConfiguration;
|
import org.apache.dubbo.config.spring.context.annotation.provider.ProviderConfiguration;
|
||||||
import org.apache.dubbo.config.spring.impl.MethodCallbackImpl;
|
import org.apache.dubbo.config.spring.impl.MethodCallbackImpl;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
@ -49,25 +47,20 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
})
|
})
|
||||||
@TestPropertySource(properties = {
|
@TestPropertySource(properties = {
|
||||||
"dubbo.protocol.port=-1",
|
"dubbo.protocol.port=-1",
|
||||||
"dubbo.registry.address=zookeeper://127.0.0.1:2181"
|
"dubbo.registry.address=${zookeeper.connection.address}"
|
||||||
})
|
})
|
||||||
@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
|
@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
|
||||||
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
|
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
|
||||||
public class MethodConfigCallbackTest {
|
public class MethodConfigCallbackTest {
|
||||||
|
|
||||||
private static RegistryCenter singleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll() {
|
public static void beforeAll() {
|
||||||
singleRegistryCenter = new ZookeeperSingleRegistryCenter();
|
|
||||||
singleRegistryCenter.startup();
|
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void afterAll() {
|
public static void afterAll() {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
singleRegistryCenter.shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@ package org.apache.dubbo.config.spring.boot.conditional1;
|
||||||
|
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.config.spring.api.HelloService;
|
import org.apache.dubbo.config.spring.api.HelloService;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
@ -50,19 +48,14 @@ import java.util.Map;
|
||||||
//@ComponentScan
|
//@ComponentScan
|
||||||
public class XmlReferenceBeanConditionalTest {
|
public class XmlReferenceBeanConditionalTest {
|
||||||
|
|
||||||
private static RegistryCenter singleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll(){
|
public static void beforeAll(){
|
||||||
singleRegistryCenter = new ZookeeperSingleRegistryCenter();
|
|
||||||
singleRegistryCenter.startup();
|
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void afterAll(){
|
public static void afterAll(){
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
singleRegistryCenter.shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,6 @@ import org.apache.dubbo.config.spring.ReferenceBean;
|
||||||
import org.apache.dubbo.config.spring.api.HelloService;
|
import org.apache.dubbo.config.spring.api.HelloService;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.provider.HelloServiceImpl;
|
import org.apache.dubbo.config.spring.context.annotation.provider.HelloServiceImpl;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
@ -56,19 +54,14 @@ import java.util.Map;
|
||||||
@EnableDubbo
|
@EnableDubbo
|
||||||
public class JavaConfigAnnotationReferenceBeanConditionalTest {
|
public class JavaConfigAnnotationReferenceBeanConditionalTest {
|
||||||
|
|
||||||
private static RegistryCenter singleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll(){
|
public static void beforeAll(){
|
||||||
singleRegistryCenter = new ZookeeperSingleRegistryCenter();
|
|
||||||
singleRegistryCenter.startup();
|
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void afterAll(){
|
public static void afterAll(){
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
singleRegistryCenter.shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,6 @@ import org.apache.dubbo.config.spring.api.HelloService;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.provider.HelloServiceImpl;
|
import org.apache.dubbo.config.spring.context.annotation.provider.HelloServiceImpl;
|
||||||
import org.apache.dubbo.config.spring.reference.ReferenceBeanBuilder;
|
import org.apache.dubbo.config.spring.reference.ReferenceBeanBuilder;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
@ -56,19 +54,14 @@ import java.util.Map;
|
||||||
@EnableDubbo
|
@EnableDubbo
|
||||||
public class JavaConfigRawReferenceBeanConditionalTest {
|
public class JavaConfigRawReferenceBeanConditionalTest {
|
||||||
|
|
||||||
private static RegistryCenter singleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll(){
|
public static void beforeAll(){
|
||||||
singleRegistryCenter = new ZookeeperSingleRegistryCenter();
|
|
||||||
singleRegistryCenter.startup();
|
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void afterAll(){
|
public static void afterAll(){
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
singleRegistryCenter.shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,6 @@ import org.apache.dubbo.config.spring.ReferenceBean;
|
||||||
import org.apache.dubbo.config.spring.api.HelloService;
|
import org.apache.dubbo.config.spring.api.HelloService;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.provider.HelloServiceImpl;
|
import org.apache.dubbo.config.spring.context.annotation.provider.HelloServiceImpl;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
@ -56,19 +54,14 @@ import java.util.Map;
|
||||||
@EnableDubbo
|
@EnableDubbo
|
||||||
public class JavaConfigReferenceBeanConditionalTest4 {
|
public class JavaConfigReferenceBeanConditionalTest4 {
|
||||||
|
|
||||||
private static RegistryCenter singleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll(){
|
public static void beforeAll(){
|
||||||
singleRegistryCenter = new ZookeeperSingleRegistryCenter();
|
|
||||||
singleRegistryCenter.startup();
|
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void afterAll(){
|
public static void afterAll(){
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
singleRegistryCenter.shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,8 @@ import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.config.context.ConfigManager;
|
import org.apache.dubbo.config.context.ConfigManager;
|
||||||
import org.apache.dubbo.config.context.ModuleConfigManager;
|
import org.apache.dubbo.config.context.ModuleConfigManager;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperMultipleRegistryCenter;
|
|
||||||
import org.apache.dubbo.rpc.model.ModuleModel;
|
import org.apache.dubbo.rpc.model.ModuleModel;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
@ -48,51 +47,46 @@ import java.util.List;
|
||||||
import static org.apache.dubbo.common.constants.MetricsConstants.PROTOCOL_PROMETHEUS;
|
import static org.apache.dubbo.common.constants.MetricsConstants.PROTOCOL_PROMETHEUS;
|
||||||
|
|
||||||
@SpringBootTest(
|
@SpringBootTest(
|
||||||
properties = {
|
properties = {
|
||||||
"dubbo.application.NAME = dubbo-demo-application",
|
"dubbo.application.NAME = dubbo-demo-application",
|
||||||
"dubbo.module.name = dubbo-demo-module",
|
"dubbo.module.name = dubbo-demo-module",
|
||||||
"dubbo.registry.address = zookeeper://192.168.99.100:32770",
|
"dubbo.registry.address = zookeeper://192.168.99.100:32770",
|
||||||
"dubbo.protocol.name=dubbo",
|
"dubbo.protocol.name=dubbo",
|
||||||
"dubbo.protocol.port=20880",
|
"dubbo.protocol.port=20880",
|
||||||
"dubbo.metrics.protocol=prometheus",
|
"dubbo.metrics.protocol=prometheus",
|
||||||
"dubbo.metrics.prometheus.exporter.enabled=true",
|
"dubbo.metrics.prometheus.exporter.enabled=true",
|
||||||
"dubbo.metrics.prometheus.exporter.enable-http-service-discovery=true",
|
"dubbo.metrics.prometheus.exporter.enable-http-service-discovery=true",
|
||||||
"dubbo.metrics.prometheus.exporter.http-service-discovery-url=localhost:8080",
|
"dubbo.metrics.prometheus.exporter.http-service-discovery-url=localhost:8080",
|
||||||
"dubbo.metrics.prometheus.exporter.metrics-port=20888",
|
"dubbo.metrics.prometheus.exporter.metrics-port=20888",
|
||||||
"dubbo.metrics.prometheus.exporter.metrics-path=/metrics",
|
"dubbo.metrics.prometheus.exporter.metrics-path=/metrics",
|
||||||
"dubbo.metrics.aggregation.enabled=true",
|
"dubbo.metrics.aggregation.enabled=true",
|
||||||
"dubbo.metrics.aggregation.bucket-num=5",
|
"dubbo.metrics.aggregation.bucket-num=5",
|
||||||
"dubbo.metrics.aggregation.time-window-seconds=120",
|
"dubbo.metrics.aggregation.time-window-seconds=120",
|
||||||
"dubbo.monitor.address=zookeeper://127.0.0.1:32770",
|
"dubbo.monitor.address=zookeeper://127.0.0.1:32770",
|
||||||
"dubbo.Config-center.address=zookeeper://127.0.0.1:2181",
|
"dubbo.Config-center.address=${zookeeper.connection.address.1}",
|
||||||
"dubbo.config-Center.group=group1",
|
"dubbo.config-Center.group=group1",
|
||||||
"dubbo.metadata-report.address=zookeeper://127.0.0.1:2182",
|
"dubbo.metadata-report.address=${zookeeper.connection.address.2}",
|
||||||
"dubbo.METADATA-REPORT.username=User",
|
"dubbo.METADATA-REPORT.username=User",
|
||||||
"dubbo.provider.host=127.0.0.1",
|
"dubbo.provider.host=127.0.0.1",
|
||||||
"dubbo.consumer.client=netty"
|
"dubbo.consumer.client=netty"
|
||||||
},
|
},
|
||||||
classes = {
|
classes = {
|
||||||
SpringBootConfigPropsTest.class
|
SpringBootConfigPropsTest.class
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@Configuration
|
@Configuration
|
||||||
@ComponentScan
|
@ComponentScan
|
||||||
@EnableDubbo
|
@EnableDubbo
|
||||||
public class SpringBootConfigPropsTest {
|
public class SpringBootConfigPropsTest {
|
||||||
|
|
||||||
private static RegistryCenter multipleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll() {
|
public static void beforeAll() {
|
||||||
multipleRegistryCenter = new ZookeeperMultipleRegistryCenter();
|
|
||||||
multipleRegistryCenter.startup();
|
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void afterAll() {
|
public static void afterAll() {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
multipleRegistryCenter.shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -135,13 +129,13 @@ public class SpringBootConfigPropsTest {
|
||||||
Collection<ConfigCenterConfig> configCenters = configManager.getConfigCenters();
|
Collection<ConfigCenterConfig> configCenters = configManager.getConfigCenters();
|
||||||
Assertions.assertEquals(1, configCenters.size());
|
Assertions.assertEquals(1, configCenters.size());
|
||||||
ConfigCenterConfig centerConfig = configCenters.iterator().next();
|
ConfigCenterConfig centerConfig = configCenters.iterator().next();
|
||||||
Assertions.assertEquals("zookeeper://127.0.0.1:2181", centerConfig.getAddress());
|
Assertions.assertEquals(ZookeeperRegistryCenterConfig.getConnectionAddress1(), centerConfig.getAddress());
|
||||||
Assertions.assertEquals("group1", centerConfig.getGroup());
|
Assertions.assertEquals("group1", centerConfig.getGroup());
|
||||||
|
|
||||||
Collection<MetadataReportConfig> metadataConfigs = configManager.getMetadataConfigs();
|
Collection<MetadataReportConfig> metadataConfigs = configManager.getMetadataConfigs();
|
||||||
Assertions.assertEquals(1, metadataConfigs.size());
|
Assertions.assertEquals(1, metadataConfigs.size());
|
||||||
MetadataReportConfig reportConfig = metadataConfigs.iterator().next();
|
MetadataReportConfig reportConfig = metadataConfigs.iterator().next();
|
||||||
Assertions.assertEquals("zookeeper://127.0.0.1:2182", reportConfig.getAddress());
|
Assertions.assertEquals(ZookeeperRegistryCenterConfig.getConnectionAddress2(), reportConfig.getAddress());
|
||||||
Assertions.assertEquals("User", reportConfig.getUsername());
|
Assertions.assertEquals("User", reportConfig.getUsername());
|
||||||
|
|
||||||
// module configs
|
// module configs
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,8 @@ import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.config.context.ConfigManager;
|
import org.apache.dubbo.config.context.ConfigManager;
|
||||||
import org.apache.dubbo.config.context.ModuleConfigManager;
|
import org.apache.dubbo.config.context.ModuleConfigManager;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperMultipleRegistryCenter;
|
|
||||||
import org.apache.dubbo.rpc.model.ModuleModel;
|
import org.apache.dubbo.rpc.model.ModuleModel;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
@ -65,9 +63,9 @@ import static org.apache.dubbo.common.constants.MetricsConstants.PROTOCOL_PROMET
|
||||||
"dubbo.metricses.my-metrics.aggregation.bucket-num=5",
|
"dubbo.metricses.my-metrics.aggregation.bucket-num=5",
|
||||||
"dubbo.metricses.my-metrics.aggregation.time-window-seconds=120",
|
"dubbo.metricses.my-metrics.aggregation.time-window-seconds=120",
|
||||||
"dubbo.monitors.my-monitor.address=zookeeper://127.0.0.1:32770",
|
"dubbo.monitors.my-monitor.address=zookeeper://127.0.0.1:32770",
|
||||||
"dubbo.config-centers.my-configcenter.address=zookeeper://127.0.0.1:2181",
|
"dubbo.config-centers.my-configcenter.address=${zookeeper.connection.address.1}",
|
||||||
"dubbo.config-centers.my-configcenter.group=group1",
|
"dubbo.config-centers.my-configcenter.group=group1",
|
||||||
"dubbo.metadata-reports.my-metadata.address=zookeeper://127.0.0.1:2182",
|
"dubbo.metadata-reports.my-metadata.address=${zookeeper.connection.address.2}",
|
||||||
"dubbo.metadata-reports.my-metadata.username=User",
|
"dubbo.metadata-reports.my-metadata.username=User",
|
||||||
"dubbo.providers.my-provider.host=127.0.0.1",
|
"dubbo.providers.my-provider.host=127.0.0.1",
|
||||||
"dubbo.consumers.my-consumer.client=netty"
|
"dubbo.consumers.my-consumer.client=netty"
|
||||||
|
|
@ -81,19 +79,14 @@ import static org.apache.dubbo.common.constants.MetricsConstants.PROTOCOL_PROMET
|
||||||
@EnableDubbo
|
@EnableDubbo
|
||||||
public class SpringBootMultipleConfigPropsTest {
|
public class SpringBootMultipleConfigPropsTest {
|
||||||
|
|
||||||
private static RegistryCenter multipleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll() {
|
public static void beforeAll() {
|
||||||
multipleRegistryCenter = new ZookeeperMultipleRegistryCenter();
|
|
||||||
multipleRegistryCenter.startup();
|
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void afterAll() {
|
public static void afterAll() {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
multipleRegistryCenter.shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -137,13 +130,13 @@ public class SpringBootMultipleConfigPropsTest {
|
||||||
Collection<ConfigCenterConfig> configCenters = configManager.getConfigCenters();
|
Collection<ConfigCenterConfig> configCenters = configManager.getConfigCenters();
|
||||||
Assertions.assertEquals(1, configCenters.size());
|
Assertions.assertEquals(1, configCenters.size());
|
||||||
ConfigCenterConfig centerConfig = configCenters.iterator().next();
|
ConfigCenterConfig centerConfig = configCenters.iterator().next();
|
||||||
Assertions.assertEquals("zookeeper://127.0.0.1:2181", centerConfig.getAddress());
|
Assertions.assertEquals(ZookeeperRegistryCenterConfig.getConnectionAddress1(), centerConfig.getAddress());
|
||||||
Assertions.assertEquals("group1", centerConfig.getGroup());
|
Assertions.assertEquals("group1", centerConfig.getGroup());
|
||||||
|
|
||||||
Collection<MetadataReportConfig> metadataConfigs = configManager.getMetadataConfigs();
|
Collection<MetadataReportConfig> metadataConfigs = configManager.getMetadataConfigs();
|
||||||
Assertions.assertEquals(1, metadataConfigs.size());
|
Assertions.assertEquals(1, metadataConfigs.size());
|
||||||
MetadataReportConfig reportConfig = metadataConfigs.iterator().next();
|
MetadataReportConfig reportConfig = metadataConfigs.iterator().next();
|
||||||
Assertions.assertEquals("zookeeper://127.0.0.1:2182", reportConfig.getAddress());
|
Assertions.assertEquals(ZookeeperRegistryCenterConfig.getConnectionAddress2(), reportConfig.getAddress());
|
||||||
Assertions.assertEquals("User", reportConfig.getUsername());
|
Assertions.assertEquals("User", reportConfig.getUsername());
|
||||||
|
|
||||||
// module configs
|
// module configs
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@ package org.apache.dubbo.config.spring.boot.importxml;
|
||||||
|
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.config.spring.api.HelloService;
|
import org.apache.dubbo.config.spring.api.HelloService;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
@ -44,19 +42,14 @@ import org.springframework.context.annotation.ImportResource;
|
||||||
@ImportResource("classpath:/org/apache/dubbo/config/spring/boot/importxml/consumer/dubbo-consumer.xml")
|
@ImportResource("classpath:/org/apache/dubbo/config/spring/boot/importxml/consumer/dubbo-consumer.xml")
|
||||||
public class SpringBootImportDubboXmlTest {
|
public class SpringBootImportDubboXmlTest {
|
||||||
|
|
||||||
private static RegistryCenter singleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll(){
|
public static void beforeAll(){
|
||||||
singleRegistryCenter = new ZookeeperSingleRegistryCenter();
|
|
||||||
singleRegistryCenter.startup();
|
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void afterAll(){
|
public static void afterAll(){
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
singleRegistryCenter.shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,6 @@ import org.apache.dubbo.config.ProtocolConfig;
|
||||||
import org.apache.dubbo.config.RegistryConfig;
|
import org.apache.dubbo.config.RegistryConfig;
|
||||||
|
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
@ -83,20 +81,14 @@ public class DubboConfigConfigurationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMultiple() {
|
public void testMultiple() {
|
||||||
RegistryCenter singleRegistryCenter = new ZookeeperSingleRegistryCenter();
|
context.register(DubboConfigConfiguration.Multiple.class);
|
||||||
singleRegistryCenter.startup();
|
context.refresh();
|
||||||
try{
|
|
||||||
context.register(DubboConfigConfiguration.Multiple.class);
|
|
||||||
context.refresh();
|
|
||||||
|
|
||||||
RegistryConfig registry1 = context.getBean("registry1", RegistryConfig.class);
|
RegistryConfig registry1 = context.getBean("registry1", RegistryConfig.class);
|
||||||
Assertions.assertEquals(2181, registry1.getPort());
|
Assertions.assertEquals(2181, registry1.getPort());
|
||||||
|
|
||||||
RegistryConfig registry2 = context.getBean("registry2", RegistryConfig.class);
|
RegistryConfig registry2 = context.getBean("registry2", RegistryConfig.class);
|
||||||
Assertions.assertEquals(2182, registry2.getPort());
|
Assertions.assertEquals(2182, registry2.getPort());
|
||||||
}finally {
|
|
||||||
singleRegistryCenter.shutdown();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,6 @@ import org.apache.dubbo.config.ProviderConfig;
|
||||||
import org.apache.dubbo.config.RegistryConfig;
|
import org.apache.dubbo.config.RegistryConfig;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.config.context.ConfigManager;
|
import org.apache.dubbo.config.context.ConfigManager;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperMultipleRegistryCenter;
|
|
||||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||||
|
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
|
@ -48,19 +46,14 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
*/
|
*/
|
||||||
public class EnableDubboConfigTest {
|
public class EnableDubboConfigTest {
|
||||||
|
|
||||||
private RegistryCenter multipleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
multipleRegistryCenter = new ZookeeperMultipleRegistryCenter();
|
|
||||||
multipleRegistryCenter.startup();
|
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterEach
|
@AfterEach
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
multipleRegistryCenter.shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
//@Test
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,11 @@ import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.config.spring.SysProps;
|
import org.apache.dubbo.config.spring.SysProps;
|
||||||
import org.apache.dubbo.config.spring.api.HelloService;
|
import org.apache.dubbo.config.spring.api.HelloService;
|
||||||
import org.apache.dubbo.config.spring.context.DubboSpringInitCustomizerHolder;
|
import org.apache.dubbo.config.spring.context.DubboSpringInitCustomizerHolder;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||||
import org.apache.dubbo.rpc.model.FrameworkModel;
|
import org.apache.dubbo.rpc.model.FrameworkModel;
|
||||||
import org.apache.dubbo.rpc.model.ModuleModel;
|
import org.apache.dubbo.rpc.model.ModuleModel;
|
||||||
import org.apache.dubbo.rpc.model.ServiceDescriptor;
|
import org.apache.dubbo.rpc.model.ServiceDescriptor;
|
||||||
|
import org.apache.dubbo.test.check.registrycenter.config.ZookeeperRegistryCenterConfig;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
@ -34,22 +33,16 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
|
|
||||||
public class DubboSpringInitCustomizerTest {
|
public class DubboSpringInitCustomizerTest {
|
||||||
|
|
||||||
private static RegistryCenter singleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll() {
|
public static void beforeAll() {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
singleRegistryCenter = new ZookeeperSingleRegistryCenter();
|
SysProps.setProperty("dubbo.registry.address", ZookeeperRegistryCenterConfig.getConnectionAddress());
|
||||||
singleRegistryCenter.startup();
|
|
||||||
RegistryCenter.Instance registryCenterInstance = singleRegistryCenter.getRegistryCenterInstance().get(0);
|
|
||||||
SysProps.setProperty("dubbo.registry.address", registryCenterInstance.toURL());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void afterAll() {
|
public static void afterAll() {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
singleRegistryCenter.shutdown();
|
|
||||||
SysProps.clear();
|
SysProps.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,6 @@ package org.apache.dubbo.config.spring.issues.issue6000;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.apache.dubbo.config.spring.issues.issue6000.adubbo.HelloDubbo;
|
import org.apache.dubbo.config.spring.issues.issue6000.adubbo.HelloDubbo;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
|
|
@ -40,19 +38,14 @@ import org.springframework.context.annotation.PropertySource;
|
||||||
@PropertySource("classpath:/META-INF/issues/issue6000/config.properties")
|
@PropertySource("classpath:/META-INF/issues/issue6000/config.properties")
|
||||||
public class Issue6000Test {
|
public class Issue6000Test {
|
||||||
|
|
||||||
private static RegistryCenter singleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll() {
|
public static void beforeAll() {
|
||||||
singleRegistryCenter = new ZookeeperSingleRegistryCenter();
|
|
||||||
singleRegistryCenter.startup();
|
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void afterAll() {
|
public static void afterAll() {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
singleRegistryCenter.shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,8 @@ package org.apache.dubbo.config.spring.issues.issue6252;
|
||||||
|
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.api.DemoService;
|
import org.apache.dubbo.config.spring.api.DemoService;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperMultipleRegistryCenter;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
@ -39,19 +37,14 @@ import org.springframework.context.annotation.PropertySource;
|
||||||
@PropertySource("classpath:/META-INF/issues/issue6252/config.properties")
|
@PropertySource("classpath:/META-INF/issues/issue6252/config.properties")
|
||||||
public class Issue6252Test {
|
public class Issue6252Test {
|
||||||
|
|
||||||
private static RegistryCenter multipleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll() {
|
public static void beforeAll() {
|
||||||
multipleRegistryCenter = new ZookeeperMultipleRegistryCenter();
|
|
||||||
multipleRegistryCenter.startup();
|
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void afterAll() {
|
public static void afterAll() {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
multipleRegistryCenter.shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@DubboReference
|
@DubboReference
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,6 @@ import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.config.spring.ReferenceBean;
|
import org.apache.dubbo.config.spring.ReferenceBean;
|
||||||
import org.apache.dubbo.config.spring.api.HelloService;
|
import org.apache.dubbo.config.spring.api.HelloService;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
|
@ -49,19 +47,14 @@ import java.util.Map;
|
||||||
@PropertySource("classpath:/META-INF/issues/issue7003/config.properties")
|
@PropertySource("classpath:/META-INF/issues/issue7003/config.properties")
|
||||||
public class Issue7003Test {
|
public class Issue7003Test {
|
||||||
|
|
||||||
private static RegistryCenter singleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll() {
|
public static void beforeAll() {
|
||||||
singleRegistryCenter = new ZookeeperSingleRegistryCenter();
|
|
||||||
singleRegistryCenter.startup();
|
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void afterAll() {
|
public static void afterAll() {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
singleRegistryCenter.shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,9 @@ import org.apache.dubbo.config.spring.api.HelloService;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.apache.dubbo.config.spring.impl.DemoServiceImpl;
|
import org.apache.dubbo.config.spring.impl.DemoServiceImpl;
|
||||||
import org.apache.dubbo.config.spring.impl.HelloServiceImpl;
|
import org.apache.dubbo.config.spring.impl.HelloServiceImpl;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperMultipleRegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.util.DubboBeanUtils;
|
import org.apache.dubbo.config.spring.util.DubboBeanUtils;
|
||||||
import org.apache.dubbo.rpc.model.ModuleModel;
|
import org.apache.dubbo.rpc.model.ModuleModel;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
@ -41,21 +38,6 @@ import org.springframework.context.annotation.PropertySource;
|
||||||
*/
|
*/
|
||||||
public class MultipleConsumerAndProviderTest {
|
public class MultipleConsumerAndProviderTest {
|
||||||
|
|
||||||
private static ZookeeperMultipleRegistryCenter registryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
|
||||||
public static void setUp() {
|
|
||||||
registryCenter = new ZookeeperMultipleRegistryCenter();
|
|
||||||
registryCenter.startup();
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterAll
|
|
||||||
public static void tearDown() {
|
|
||||||
if (registryCenter != null) {
|
|
||||||
registryCenter.shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() {
|
public void test() {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,6 @@ package org.apache.dubbo.config.spring.propertyconfigurer.consumer;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.config.spring.api.HelloService;
|
import org.apache.dubbo.config.spring.api.HelloService;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
@ -34,19 +32,14 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
|
|
||||||
public class PropertyConfigurerTest {
|
public class PropertyConfigurerTest {
|
||||||
|
|
||||||
private static RegistryCenter singleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll() {
|
public static void beforeAll() {
|
||||||
singleRegistryCenter = new ZookeeperSingleRegistryCenter();
|
|
||||||
singleRegistryCenter.startup();
|
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void afterAll() {
|
public static void afterAll() {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
singleRegistryCenter.shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
dubbo.registry.address=zookeeper://127.0.0.1:2181?registry-type=service
|
dubbo.registry.address=${zookeeper.connection.address}?registry-type=service
|
||||||
biz.group=greeting
|
biz.group=greeting
|
||||||
biz.group2=group2
|
biz.group2=group2
|
||||||
dubbo.call-timeout=2000
|
dubbo.call-timeout=2000
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
<dubbo:application name="demo-consumer">
|
<dubbo:application name="demo-consumer">
|
||||||
</dubbo:application>
|
</dubbo:application>
|
||||||
|
|
||||||
<!-- <dubbo:metadata-report address="zookeeper://127.0.0.1:2181"/>-->
|
<!-- <dubbo:metadata-report address="${zookeeper.connection.address}"/>-->
|
||||||
|
|
||||||
<dubbo:registry address="${dubbo.registry.address}"/>
|
<dubbo:registry address="${dubbo.registry.address}"/>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@ import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.config.spring.api.HelloService;
|
import org.apache.dubbo.config.spring.api.HelloService;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.apache.dubbo.config.spring.propertyconfigurer.consumer.DemoBeanFactoryPostProcessor;
|
import org.apache.dubbo.config.spring.propertyconfigurer.consumer.DemoBeanFactoryPostProcessor;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
|
@ -35,19 +33,14 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
|
|
||||||
public class PropertySourcesConfigurerTest {
|
public class PropertySourcesConfigurerTest {
|
||||||
|
|
||||||
private static RegistryCenter singleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void beforeAll() {
|
public static void beforeAll() {
|
||||||
singleRegistryCenter = new ZookeeperSingleRegistryCenter();
|
|
||||||
singleRegistryCenter.startup();
|
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void afterAll() {
|
public static void afterAll() {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
singleRegistryCenter.shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
dubbo.registry.address=zookeeper://127.0.0.1:2181?registry-type=service
|
dubbo.registry.address=${zookeeper.connection.address}?registry-type=service
|
||||||
biz.group=greeting
|
biz.group=greeting
|
||||||
biz.group2=group2
|
biz.group2=group2
|
||||||
dubbo.call-timeout=2000
|
dubbo.call-timeout=2000
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
<dubbo:application name="demo-consumer">
|
<dubbo:application name="demo-consumer">
|
||||||
</dubbo:application>
|
</dubbo:application>
|
||||||
|
|
||||||
<!-- <dubbo:metadata-report address="zookeeper://127.0.0.1:2181"/>-->
|
<!-- <dubbo:metadata-report address="${zookeeper.connection.address}"/>-->
|
||||||
|
|
||||||
<dubbo:registry address="${dubbo.registry.address}"/>
|
<dubbo:registry address="${dubbo.registry.address}"/>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,8 @@ import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.config.spring.api.HelloService;
|
import org.apache.dubbo.config.spring.api.HelloService;
|
||||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||||
import org.apache.dubbo.config.spring.propertyconfigurer.consumer.DemoBeanFactoryPostProcessor;
|
import org.apache.dubbo.config.spring.propertyconfigurer.consumer.DemoBeanFactoryPostProcessor;
|
||||||
import org.apache.dubbo.config.spring.registrycenter.RegistryCenter;
|
|
||||||
import org.apache.dubbo.config.spring.registrycenter.ZookeeperSingleRegistryCenter;
|
|
||||||
import org.junit.jupiter.api.AfterAll;
|
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||||
|
|
@ -45,18 +41,6 @@ public class PropertySourcesInJavaConfigTest {
|
||||||
private static final String SCAN_PACKAGE_NAME = "org.apache.dubbo.config.spring.propertyconfigurer.consumer3.notexist";
|
private static final String SCAN_PACKAGE_NAME = "org.apache.dubbo.config.spring.propertyconfigurer.consumer3.notexist";
|
||||||
private static final String PACKAGE_PATH = "/org/apache/dubbo/config/spring/propertyconfigurer/consumer3";
|
private static final String PACKAGE_PATH = "/org/apache/dubbo/config/spring/propertyconfigurer/consumer3";
|
||||||
private static final String PROVIDER_CONFIG_PATH = "org/apache/dubbo/config/spring/propertyconfigurer/provider/dubbo-provider.xml";
|
private static final String PROVIDER_CONFIG_PATH = "org/apache/dubbo/config/spring/propertyconfigurer/provider/dubbo-provider.xml";
|
||||||
private static RegistryCenter singleRegistryCenter;
|
|
||||||
|
|
||||||
@BeforeAll
|
|
||||||
public static void beforeAll() {
|
|
||||||
singleRegistryCenter = new ZookeeperSingleRegistryCenter();
|
|
||||||
singleRegistryCenter.startup();
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterAll
|
|
||||||
public static void afterAll() {
|
|
||||||
singleRegistryCenter.shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
dubbo.registry.address=zookeeper://127.0.0.1:2181?registry-type=service
|
dubbo.registry.address=${zookeeper.connection.address}?registry-type=service
|
||||||
biz.group=greeting
|
biz.group=greeting
|
||||||
biz.group2=group2
|
biz.group2=group2
|
||||||
dubbo.call-timeout=2000
|
dubbo.call-timeout=2000
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
<dubbo:application name="demo-consumer">
|
<dubbo:application name="demo-consumer">
|
||||||
</dubbo:application>
|
</dubbo:application>
|
||||||
|
|
||||||
<!-- <dubbo:metadata-report address="zookeeper://127.0.0.1:2181"/>-->
|
<!-- <dubbo:metadata-report address="${zookeeper.connection.address}"/>-->
|
||||||
|
|
||||||
<dubbo:registry address="${dubbo.registry.address}"/>
|
<dubbo:registry address="${dubbo.registry.address}"/>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
dubbo.application.name=demo-provider
|
dubbo.application.name=demo-provider
|
||||||
dubbo.registry.address=zookeeper://127.0.0.1:2181?registry-type=service
|
dubbo.registry.address=${zookeeper.connection.address}?registry-type=service
|
||||||
dubbo.config-center.address=zookeeper://127.0.0.1:2181
|
dubbo.config-center.address=${zookeeper.connection.address}
|
||||||
dubbo.metadata-report.address=zookeeper://127.0.0.1:2181
|
dubbo.metadata-report.address=${zookeeper.connection.address}
|
||||||
biz.group=greeting
|
biz.group=greeting
|
||||||
biz.group2=group2
|
biz.group2=group2
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue