From 3111835077d3cf4232faa36aab03cdb194fd736a Mon Sep 17 00:00:00 2001 From: bao liu Date: Tue, 23 Feb 2021 11:55:11 +0800 Subject: [PATCH] [#81] support reading environment for configurations (#94) --- .../config/ConfigCenterConfiguration.java | 28 +++++++---- .../ConfigurationSpringInitializer.java | 23 +++++++-- .../dubbo/config/KieConfigConfiguration.java | 50 ++++++++++++------- .../dubbo/discovery/RegistrationListener.java | 18 +++++-- .../discovery/ServiceCenterConfiguration.java | 29 ++++++----- .../order-consumer/pom.xml | 18 +------ .../price-provider/pom.xml | 19 ++----- .../src/main/resources/application.yml | 21 +++++++- .../src/main/resources/dubbo.properties | 49 ------------------ integration-tests/discovery-tests/README.md | 7 +-- .../src/main/resources/application.yml | 2 +- .../discovery-tests/order-consumer/pom.xml | 12 +---- .../src/main/resources/dubbo.properties | 2 +- .../discovery-tests/price-provider/pom.xml | 14 +----- .../src/main/resources/dubbo.properties | 2 +- 15 files changed, 134 insertions(+), 160 deletions(-) diff --git a/config/servicecomb-config-center/src/main/java/com/huaweicloud/dubbo/config/ConfigCenterConfiguration.java b/config/servicecomb-config-center/src/main/java/com/huaweicloud/dubbo/config/ConfigCenterConfiguration.java index b438ab6..a0e4e94 100644 --- a/config/servicecomb-config-center/src/main/java/com/huaweicloud/dubbo/config/ConfigCenterConfiguration.java +++ b/config/servicecomb-config-center/src/main/java/com/huaweicloud/dubbo/config/ConfigCenterConfiguration.java @@ -26,26 +26,34 @@ import java.util.Arrays; +import org.apache.dubbo.common.utils.StringUtils; import org.apache.servicecomb.config.center.client.AddressManager; import org.apache.servicecomb.config.center.client.model.QueryConfigurationsRequest; - -import org.apache.dubbo.common.utils.ConfigUtils; +import org.springframework.core.env.Environment; public class ConfigCenterConfiguration { + private Environment environment; + + public ConfigCenterConfiguration(Environment environment) { + this.environment = environment; + } - public static AddressManager createAddressManager() { - String address = ConfigUtils.getProperty(KEY_CONFIG_ADDRESS, "http://127.0.0.1:30103"); - String project = ConfigUtils.getProperty(KEY_SERVICE_PROJECT, "default"); + public AddressManager createAddressManager() { + String address = environment.getProperty(KEY_CONFIG_ADDRESS, ""); + if (StringUtils.isEmpty(address)) { + return null; + } + String project = environment.getProperty(KEY_SERVICE_PROJECT, "default"); return new AddressManager(project, Arrays.asList(address.split(","))); } - public static QueryConfigurationsRequest createQueryConfigurationsRequest() { + public QueryConfigurationsRequest createQueryConfigurationsRequest() { QueryConfigurationsRequest request = new QueryConfigurationsRequest(); - request.setApplication(ConfigUtils.getProperty(KEY_SERVICE_APPLICATION, "default")); - request.setServiceName(ConfigUtils.getProperty(KEY_SERVICE_NAME, "defaultMicroserviceName")); - request.setVersion(ConfigUtils.getProperty(KEY_SERVICE_VERSION, "1.0.0.0")); - request.setEnvironment(ConfigUtils.getProperty(KEY_SERVICE_ENVIRONMENT, "")); + request.setApplication(environment.getProperty(KEY_SERVICE_APPLICATION, "default")); + request.setServiceName(environment.getProperty(KEY_SERVICE_NAME, "defaultMicroserviceName")); + request.setVersion(environment.getProperty(KEY_SERVICE_VERSION, "1.0.0.0")); + request.setEnvironment(environment.getProperty(KEY_SERVICE_ENVIRONMENT, "")); // 需要设置为 null, 并且 query 参数为 revision=null 才会返回 revision 信息。 revision = 是不行的。 request.setRevision(null); return request; diff --git a/config/servicecomb-config-center/src/main/java/com/huaweicloud/dubbo/config/ConfigurationSpringInitializer.java b/config/servicecomb-config-center/src/main/java/com/huaweicloud/dubbo/config/ConfigurationSpringInitializer.java index f31b4f2..128c2a0 100644 --- a/config/servicecomb-config-center/src/main/java/com/huaweicloud/dubbo/config/ConfigurationSpringInitializer.java +++ b/config/servicecomb-config-center/src/main/java/com/huaweicloud/dubbo/config/ConfigurationSpringInitializer.java @@ -84,6 +84,10 @@ public class ConfigurationSpringInitializer extends PropertyPlaceholderConfigure private int pollingWaitInSeconds = 0; + private ConfigCenterConfiguration configCenterConfiguration; + + private KieConfigConfiguration kieConfigConfiguration; + public ConfigurationSpringInitializer() { setOrder(Ordered.LOWEST_PRECEDENCE / 2); setIgnoreUnresolvablePlaceholders(true); @@ -91,9 +95,12 @@ public ConfigurationSpringInitializer() { @Override public void setEnvironment(Environment environment) { + configCenterConfiguration = new ConfigCenterConfiguration(environment); + kieConfigConfiguration = new KieConfigConfiguration(environment); if (!(environment instanceof ConfigurableEnvironment)) { return; } + ConfigurableEnvironment ce = (ConfigurableEnvironment) environment; addDubboProperties(ce); @@ -130,8 +137,12 @@ private void addDubboProperties(ConfigurableEnvironment ce) { } private void configCenterClient(ConfigurableEnvironment ce) { - queryConfigurationsRequest = ConfigCenterConfiguration.createQueryConfigurationsRequest(); - AddressManager addressManager = ConfigCenterConfiguration.createAddressManager(); + queryConfigurationsRequest = configCenterConfiguration.createQueryConfigurationsRequest(); + AddressManager addressManager = configCenterConfiguration.createAddressManager(); + if (addressManager == null) { + LOGGER.warn("Config center address is not configured and will not enable dynamic config."); + return; + } ConfigCenterClient configCenterClient = new ConfigCenterClient(addressManager, httpTransport); try { QueryConfigurationsResponse response = configCenterClient.queryConfigurations(queryConfigurationsRequest); @@ -151,8 +162,12 @@ private void configCenterClient(ConfigurableEnvironment ce) { //use KIE as config center private void configKieClient(ConfigurableEnvironment ce) { - configurationsRequest = KieConfigConfiguration.createConfigurationsRequest(); - KieAddressManager kieAddressManager = KieConfigConfiguration.createKieAddressManager(); + configurationsRequest = kieConfigConfiguration.createConfigurationsRequest(); + KieAddressManager kieAddressManager = kieConfigConfiguration.createKieAddressManager(); + if (kieAddressManager == null) { + LOGGER.warn("Kie address is not configured and will not enable dynamic config."); + return; + } KieConfigOperation kieClient = new KieClient(kieAddressManager, httpTransport); try { diff --git a/config/servicecomb-config-center/src/main/java/com/huaweicloud/dubbo/config/KieConfigConfiguration.java b/config/servicecomb-config-center/src/main/java/com/huaweicloud/dubbo/config/KieConfigConfiguration.java index c63e6a9..34ca559 100644 --- a/config/servicecomb-config-center/src/main/java/com/huaweicloud/dubbo/config/KieConfigConfiguration.java +++ b/config/servicecomb-config-center/src/main/java/com/huaweicloud/dubbo/config/KieConfigConfiguration.java @@ -20,47 +20,59 @@ import static com.huaweicloud.dubbo.common.CommonConfiguration.KEY_CONFIG_ADDRESS; import static com.huaweicloud.dubbo.common.CommonConfiguration.KEY_CONFIG_ADDRESSTYPE; import static com.huaweicloud.dubbo.common.CommonConfiguration.KEY_SERVICE_APPLICATION; +import static com.huaweicloud.dubbo.common.CommonConfiguration.KEY_SERVICE_ENABLELONGPOLLING; import static com.huaweicloud.dubbo.common.CommonConfiguration.KEY_SERVICE_ENVIRONMENT; import static com.huaweicloud.dubbo.common.CommonConfiguration.KEY_SERVICE_NAME; -import static com.huaweicloud.dubbo.common.CommonConfiguration.KEY_SERVICE_VERSION; -import static com.huaweicloud.dubbo.common.CommonConfiguration.KEY_SERVICE_ENABLELONGPOLLING; import static com.huaweicloud.dubbo.common.CommonConfiguration.KEY_SERVICE_POLLINGWAITSEC; import static com.huaweicloud.dubbo.common.CommonConfiguration.KEY_SERVICE_PROJECT; +import static com.huaweicloud.dubbo.common.CommonConfiguration.KEY_SERVICE_VERSION; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Properties; -import org.apache.dubbo.common.utils.ConfigUtils; +import org.apache.dubbo.common.utils.StringUtils; import org.apache.servicecomb.config.kie.client.model.ConfigConstants; -import org.apache.servicecomb.config.kie.client.model.KieAddressManager; import org.apache.servicecomb.config.kie.client.model.ConfigurationsRequest; +import org.apache.servicecomb.config.kie.client.model.KieAddressManager; +import org.springframework.core.env.Environment; public class KieConfigConfiguration { + private Environment environment; + + public KieConfigConfiguration(Environment environment) { + this.environment = environment; + } //初始化配置属性值,这里统一初始化,对于client模块,解耦对默认值的感知,屏蔽不同框架带来的配置项差异对KieAddressManager的影响 - public static KieAddressManager createKieAddressManager() { - Properties properties = ConfigUtils.getProperties(); + public KieAddressManager createKieAddressManager() { + String address = environment.getProperty(KEY_CONFIG_ADDRESS, ""); + if (StringUtils.isEmpty(address)) { + return null; + } + Properties properties = new Properties(); Map configKey = new HashMap<>(); - properties.setProperty(KEY_SERVICE_PROJECT,ConfigUtils.getProperty(KEY_SERVICE_PROJECT, "default")); - properties.setProperty(KEY_CONFIG_ADDRESSTYPE,ConfigUtils.getProperty(KEY_CONFIG_ADDRESSTYPE, "")); - properties.setProperty(KEY_SERVICE_ENABLELONGPOLLING,ConfigUtils.getProperty(KEY_SERVICE_ENABLELONGPOLLING, "true")); - properties.setProperty(KEY_SERVICE_POLLINGWAITSEC,ConfigUtils.getProperty(KEY_SERVICE_POLLINGWAITSEC, "30")); - String address = properties.getProperty(KEY_CONFIG_ADDRESS, "http://127.0.0.1:30110"); - configKey.put(ConfigConstants.KEY_PROJECT,KEY_SERVICE_PROJECT); - configKey.put(ConfigConstants.KEY_ENABLELONGPOLLING,KEY_SERVICE_ENABLELONGPOLLING); - configKey.put(ConfigConstants.KEY_POLLINGWAITSEC,KEY_SERVICE_POLLINGWAITSEC); + properties.setProperty(KEY_SERVICE_PROJECT, environment.getProperty(KEY_SERVICE_PROJECT, "default")); + properties.setProperty(KEY_CONFIG_ADDRESSTYPE, environment.getProperty(KEY_CONFIG_ADDRESSTYPE, "")); + properties + .setProperty(KEY_SERVICE_ENABLELONGPOLLING, environment.getProperty(KEY_SERVICE_ENABLELONGPOLLING, "true")); + properties.setProperty(KEY_SERVICE_POLLINGWAITSEC, environment.getProperty(KEY_SERVICE_POLLINGWAITSEC, "30")); + + configKey.put(ConfigConstants.KEY_PROJECT, KEY_SERVICE_PROJECT); + configKey.put(ConfigConstants.KEY_ENABLELONGPOLLING, KEY_SERVICE_ENABLELONGPOLLING); + configKey.put(ConfigConstants.KEY_POLLINGWAITSEC, KEY_SERVICE_POLLINGWAITSEC); + return new KieAddressManager(properties, Arrays.asList(address.split(",")), configKey); } - public static ConfigurationsRequest createConfigurationsRequest() { + public ConfigurationsRequest createConfigurationsRequest() { ConfigurationsRequest request = new ConfigurationsRequest(); - request.setApplication(ConfigUtils.getProperty(KEY_SERVICE_APPLICATION, "default")); - request.setServiceName(ConfigUtils.getProperty(KEY_SERVICE_NAME, "defaultMicroserviceName")); - request.setVersion(ConfigUtils.getProperty(KEY_SERVICE_VERSION, "1.0.0.0")); - request.setEnvironment(ConfigUtils.getProperty(KEY_SERVICE_ENVIRONMENT, "")); + request.setApplication(environment.getProperty(KEY_SERVICE_APPLICATION, "default")); + request.setServiceName(environment.getProperty(KEY_SERVICE_NAME, "defaultMicroserviceName")); + request.setVersion(environment.getProperty(KEY_SERVICE_VERSION, "1.0.0.0")); + request.setEnvironment(environment.getProperty(KEY_SERVICE_ENVIRONMENT, "")); // 需要设置为 null, 并且 query 参数为 revision=null 才会返回 revision 信息。 revision = 是不行的。 request.setRevision(null); return request; diff --git a/discovery/servicecomb-service-center/src/main/java/com/huaweicloud/dubbo/discovery/RegistrationListener.java b/discovery/servicecomb-service-center/src/main/java/com/huaweicloud/dubbo/discovery/RegistrationListener.java index f567976..05c37ed 100644 --- a/discovery/servicecomb-service-center/src/main/java/com/huaweicloud/dubbo/discovery/RegistrationListener.java +++ b/discovery/servicecomb-service-center/src/main/java/com/huaweicloud/dubbo/discovery/RegistrationListener.java @@ -50,7 +50,9 @@ import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisherAware; import org.springframework.context.ApplicationListener; +import org.springframework.context.EnvironmentAware; import org.springframework.context.event.ContextStartedEvent; +import org.springframework.core.env.Environment; import com.google.common.eventbus.Subscribe; import com.huaweicloud.dubbo.common.CommonConfiguration; @@ -61,7 +63,8 @@ import com.huaweicloud.dubbo.common.RegistrationReadyEvent; import com.huaweicloud.dubbo.common.SchemaInfo; -public class RegistrationListener implements ApplicationListener, ApplicationEventPublisherAware { +public class RegistrationListener implements ApplicationListener, ApplicationEventPublisherAware, + EnvironmentAware { static class SubscriptionKey { final String appId; @@ -136,6 +139,8 @@ static class SubscriptionData { private List pendingSubscribeEvent = new ArrayList<>(); + private ServiceCenterConfiguration serviceCenterConfiguration; + public RegistrationListener() { } @@ -160,23 +165,28 @@ public void shutdown() { } } + @Override + public void setEnvironment(Environment environment) { + serviceCenterConfiguration = new ServiceCenterConfiguration(environment); + } + @Override public void onApplicationEvent(ApplicationEvent applicationEvent) { if (applicationEvent instanceof ContextStartedEvent) { try { - AddressManager addressManager = ServiceCenterConfiguration.createAddressManager(); + AddressManager addressManager = serviceCenterConfiguration.createAddressManager(); SSLProperties sslProperties = CommonConfiguration.createSSLProperties(); RequestAuthHeaderProvider requestAuthHeaderProvider = CommonConfiguration.createRequestAuthHeaderProvider(); client = new ServiceCenterClient(addressManager, sslProperties, requestAuthHeaderProvider, "default", null); - microservice = ServiceCenterConfiguration.createMicroservice(); + microservice = serviceCenterConfiguration.createMicroservice(); if (registry != null) { // consumer: 如果没有 provider 接口, dubbo 启动的时候, 不会初始化 Registry。 调用接口的时候,才会初始化。 microservice .setSchemas(registry.getRegisters().stream().map(URL::getPath).collect(Collectors.toList())); } - instance = ServiceCenterConfiguration.createMicroserviceInstance(); + instance = serviceCenterConfiguration.createMicroserviceInstance(); List endpoints = new ArrayList<>(); if (registry != null) { endpoints.addAll(registry.getRegisters().stream() diff --git a/discovery/servicecomb-service-center/src/main/java/com/huaweicloud/dubbo/discovery/ServiceCenterConfiguration.java b/discovery/servicecomb-service-center/src/main/java/com/huaweicloud/dubbo/discovery/ServiceCenterConfiguration.java index e540d47..756b7a1 100644 --- a/discovery/servicecomb-service-center/src/main/java/com/huaweicloud/dubbo/discovery/ServiceCenterConfiguration.java +++ b/discovery/servicecomb-service-center/src/main/java/com/huaweicloud/dubbo/discovery/ServiceCenterConfiguration.java @@ -27,22 +27,27 @@ import java.util.Arrays; - -import org.apache.dubbo.common.utils.ConfigUtils; import org.apache.dubbo.registry.support.AbstractRegistryFactory; import org.apache.servicecomb.service.center.client.AddressManager; import org.apache.servicecomb.service.center.client.model.Framework; import org.apache.servicecomb.service.center.client.model.Microservice; import org.apache.servicecomb.service.center.client.model.MicroserviceInstance; import org.apache.servicecomb.service.center.client.model.MicroserviceInstanceStatus; +import org.springframework.core.env.Environment; public class ServiceCenterConfiguration { - public static Microservice createMicroservice() { + private Environment environment; + + public ServiceCenterConfiguration(Environment environment) { + this.environment = environment; + } + + public Microservice createMicroservice() { Microservice microservice = new Microservice(); - microservice.setAppId(ConfigUtils.getProperty(KEY_SERVICE_APPLICATION, "default")); - microservice.setServiceName(ConfigUtils.getProperty(KEY_SERVICE_NAME, "defaultMicroserviceName")); - microservice.setVersion(ConfigUtils.getProperty(KEY_SERVICE_VERSION, "1.0.0.0")); - microservice.setEnvironment(ConfigUtils.getProperty(KEY_SERVICE_ENVIRONMENT, "")); + microservice.setAppId(environment.getProperty(KEY_SERVICE_APPLICATION, "default")); + microservice.setServiceName(environment.getProperty(KEY_SERVICE_NAME, "defaultMicroserviceName")); + microservice.setVersion(environment.getProperty(KEY_SERVICE_VERSION, "1.0.0.0")); + microservice.setEnvironment(environment.getProperty(KEY_SERVICE_ENVIRONMENT, "")); Framework framework = new Framework(); framework.setName("DUBBO-SERVICECOMB"); StringBuilder version = new StringBuilder(); @@ -56,15 +61,15 @@ public static Microservice createMicroservice() { return microservice; } - public static MicroserviceInstance createMicroserviceInstance() { + public MicroserviceInstance createMicroserviceInstance() { MicroserviceInstance instance = new MicroserviceInstance(); - instance.setStatus(MicroserviceInstanceStatus.valueOf(ConfigUtils.getProperty(KEY_INSTANCE_ENVIRONMENT, "UP"))); + instance.setStatus(MicroserviceInstanceStatus.valueOf(environment.getProperty(KEY_INSTANCE_ENVIRONMENT, "UP"))); return instance; } - public static AddressManager createAddressManager() { - String address = ConfigUtils.getProperty(KEY_REGISTRY_ADDRESS, "http://127.0.0.1:30100"); - String project = ConfigUtils.getProperty(KEY_SERVICE_PROJECT, "default"); + public AddressManager createAddressManager() { + String address = environment.getProperty(KEY_REGISTRY_ADDRESS, "http://127.0.0.1:30100"); + String project = environment.getProperty(KEY_SERVICE_PROJECT, "default"); return new AddressManager(project, Arrays.asList(address.split(","))); } } diff --git a/integration-tests/discovery-tests-spring-boot/order-consumer/pom.xml b/integration-tests/discovery-tests-spring-boot/order-consumer/pom.xml index 59da5de..417e451 100644 --- a/integration-tests/discovery-tests-spring-boot/order-consumer/pom.xml +++ b/integration-tests/discovery-tests-spring-boot/order-consumer/pom.xml @@ -46,24 +46,10 @@ spring-boot-discovery-common-api ${project.version} + com.huaweicloud.dubbo-servicecomb - dubbo-servicecomb-service-center - ${project.version} - - - com.huaweicloud.dubbo-servicecomb - dubbo-servicecomb-governance-center - ${project.version} - - - com.huaweicloud.dubbo-servicecomb - dubbo-servicecomb-config-center - ${project.version} - - - com.huaweicloud.dubbo-servicecomb - dubbo-servicecomb-spring-boot + dubbo-servicecomb-solution-spring-boot ${project.version} diff --git a/integration-tests/discovery-tests-spring-boot/price-provider/pom.xml b/integration-tests/discovery-tests-spring-boot/price-provider/pom.xml index 33ca6cd..5f6ea35 100644 --- a/integration-tests/discovery-tests-spring-boot/price-provider/pom.xml +++ b/integration-tests/discovery-tests-spring-boot/price-provider/pom.xml @@ -46,26 +46,13 @@ spring-boot-discovery-common-api ${project.version} + com.huaweicloud.dubbo-servicecomb - dubbo-servicecomb-service-center - ${project.version} - - - com.huaweicloud.dubbo-servicecomb - dubbo-servicecomb-config-center - ${project.version} - - - com.huaweicloud.dubbo-servicecomb - dubbo-servicecomb-governance-center - ${project.version} - - - com.huaweicloud.dubbo-servicecomb - dubbo-servicecomb-spring-boot + dubbo-servicecomb-solution-spring-boot ${project.version} + org.apache.dubbo dubbo-config-spring diff --git a/integration-tests/discovery-tests-spring-boot/price-provider/src/main/resources/application.yml b/integration-tests/discovery-tests-spring-boot/price-provider/src/main/resources/application.yml index af6fe4c..4480335 100644 --- a/integration-tests/discovery-tests-spring-boot/price-provider/src/main/resources/application.yml +++ b/integration-tests/discovery-tests-spring-boot/price-provider/src/main/resources/application.yml @@ -16,4 +16,23 @@ ## --------------------------------------------------------------------------- server: - port: 8084 \ No newline at end of file + port: 8084 + +PAAS_CSE_SC_ENDPOINT: http://127.0.0.1:30100 +PAAS_CSE_CC_ENDPOINT: http://127.0.0.1:30113 +#### 服务配置信息 #### +dubbo: + servicecomb: + service: + application: discovery # 所属应用。 + name: price-provider # 服务名称。 + version: 1.0.0 # 版本。默认为 1.0.0.0 + # environmen: production # 环境。默认为空。可选值:development, testing, acceptance, production + # project: # project。 默认为 default + # instance: + # initialStatus: UP # 实例初始状态。可选值: UP, DOWN, STARTING, OUTOFSERVICE + + registry: + address: ${PAAS_CSE_SC_ENDPOINT} + config: + address: ${PAAS_CSE_CC_ENDPOINT} \ No newline at end of file diff --git a/integration-tests/discovery-tests-spring-boot/price-provider/src/main/resources/dubbo.properties b/integration-tests/discovery-tests-spring-boot/price-provider/src/main/resources/dubbo.properties index b51e3a0..7ca60bf 100644 --- a/integration-tests/discovery-tests-spring-boot/price-provider/src/main/resources/dubbo.properties +++ b/integration-tests/discovery-tests-spring-boot/price-provider/src/main/resources/dubbo.properties @@ -16,52 +16,3 @@ ## --------------------------------------------------------------------------- dubbo.application.qos.port=22222 - -#### Ϣ #### -# Ӧá -dubbo.servicecomb.service.application=discovery -# ơ -dubbo.servicecomb.service.name=price-provider -# 汾ĬΪ 1.0.0.0 -dubbo.servicecomb.service.version=1.0.0 -# ĬΪաѡֵdevelopment, testing, acceptance, production -# dubbo.servicecomb.service.environment=production -# project ĬΪ default -# dubbo.servicecomb.service.project= -#### END - -#### ʵϢ #### -# ʵʼ״̬ѡֵ UP, DOWN, STARTING, OUTOFSERVICE -# dubbo.servicecomb.instance.initialStatus=UP -#### END - -#### Ϣ #### -dubbo.servicecomb.registry.address=http://127.0.0.1:30100 - -#### Ϣ #### -dubbo.servicecomb.config.address=http://127.0.0.1:30113 - -#### SSL Ϣ #### -#dubbo.servicecomb.ssl.enabled=true -# ssl engine. ĬΪ JDK ѡ OPENSSL -#dubbo.servicecomb.ssl.engine= -# ssl protocols Ĭ TLSv1.2 -#dubbo.servicecomb.ssl.protocols= -# ssl ciphersĬ TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 -#dubbo.servicecomb.ssl.ciphers= -#dubbo.servicecomb.ssl.authPeer=false -#dubbo.servicecomb.ssl.trustStore= -#dubbo.servicecomb.ssl.trustStoreType= -#dubbo.servicecomb.ssl.trustStoreValue= -#dubbo.servicecomb.ssl.keyStore= -#dubbo.servicecomb.ssl.keyStoreType= -#dubbo.servicecomb.ssl.keyStoreValue= -#dubbo.servicecomb.ssl.crl= -#dubbo.servicecomb.ssl.sslCustomClass= - -#### AK/SK ֤ #### -#dubbo.servicecomb.credentials.enabled=true -#dubbo.servicecomb.credentials.accessKey= -#dubbo.servicecomb.credentials.secretKey= -#dubbo.servicecomb.credentials.cipher= -#dubbo.servicecomb.credentials.project=cn-south-1 diff --git a/integration-tests/discovery-tests/README.md b/integration-tests/discovery-tests/README.md index 82334dc..fd6d4e3 100644 --- a/integration-tests/discovery-tests/README.md +++ b/integration-tests/discovery-tests/README.md @@ -1,13 +1,14 @@ 运行测试的步骤: 1. 安装本地微服务引擎并启动 -2. 运行 PriceApplication -3. 运行 OrderApplication -4. 配置中心下发配置项: +2. 配置中心下发配置项: [全局配置] dubbo.servicecomb.test.configuration: peizhi [服务配置:price-provider] dubbo.servicecomb.test.configurationService: peizhi_service [全局配置] dubbo.servicecomb.governance: {"providerInfos":[{"serviceName":"price-provider","schemaInfos":[{"schemaId":"com.huaweicloud.it.price.PriceService","parameters":{"timeout":5000}}]}]} +3. 运行 PriceApplication +4. 运行 OrderApplication + 5. 运行 PortalApplication 查看测试结果, 如果成功,输出 `running all test cases successfully` diff --git a/integration-tests/discovery-tests/discovery-tests-client/src/main/resources/application.yml b/integration-tests/discovery-tests/discovery-tests-client/src/main/resources/application.yml index 6633a4b..214116b 100644 --- a/integration-tests/discovery-tests/discovery-tests-client/src/main/resources/application.yml +++ b/integration-tests/discovery-tests/discovery-tests-client/src/main/resources/application.yml @@ -26,6 +26,6 @@ spring: discovery: enabled: true address: http://127.0.0.1:30100 - appName: discovery + appName: discovery-spring serviceName: portal-consumer version: 0.0.1 \ No newline at end of file diff --git a/integration-tests/discovery-tests/order-consumer/pom.xml b/integration-tests/discovery-tests/order-consumer/pom.xml index e2fc12d..1233480 100644 --- a/integration-tests/discovery-tests/order-consumer/pom.xml +++ b/integration-tests/discovery-tests/order-consumer/pom.xml @@ -36,17 +36,7 @@ com.huaweicloud.dubbo-servicecomb - dubbo-servicecomb-service-center - ${project.version} - - - com.huaweicloud.dubbo-servicecomb - dubbo-servicecomb-config-center - ${project.version} - - - com.huaweicloud.dubbo-servicecomb - dubbo-servicecomb-governance-center + dubbo-servicecomb-solution-spring ${project.version} diff --git a/integration-tests/discovery-tests/order-consumer/src/main/resources/dubbo.properties b/integration-tests/discovery-tests/order-consumer/src/main/resources/dubbo.properties index 404c63e..25bc61d 100644 --- a/integration-tests/discovery-tests/order-consumer/src/main/resources/dubbo.properties +++ b/integration-tests/discovery-tests/order-consumer/src/main/resources/dubbo.properties @@ -17,7 +17,7 @@ dubbo.application.qos.port=33333 -dubbo.servicecomb.service.application=discovery +dubbo.servicecomb.service.application=discovery-spring dubbo.servicecomb.service.name=order-consumer dubbo.servicecomb.service.version=1.0.0 diff --git a/integration-tests/discovery-tests/price-provider/pom.xml b/integration-tests/discovery-tests/price-provider/pom.xml index b5e950f..6f3dd83 100644 --- a/integration-tests/discovery-tests/price-provider/pom.xml +++ b/integration-tests/discovery-tests/price-provider/pom.xml @@ -34,19 +34,9 @@ discovery-common-api ${project.version} - - com.huaweicloud.dubbo-servicecomb - dubbo-servicecomb-service-center - ${project.version} - - - com.huaweicloud.dubbo-servicecomb - dubbo-servicecomb-config-center - ${project.version} - - + com.huaweicloud.dubbo-servicecomb - dubbo-servicecomb-governance-center + dubbo-servicecomb-solution-spring ${project.version} diff --git a/integration-tests/discovery-tests/price-provider/src/main/resources/dubbo.properties b/integration-tests/discovery-tests/price-provider/src/main/resources/dubbo.properties index b51e3a0..5c1a55d 100644 --- a/integration-tests/discovery-tests/price-provider/src/main/resources/dubbo.properties +++ b/integration-tests/discovery-tests/price-provider/src/main/resources/dubbo.properties @@ -19,7 +19,7 @@ dubbo.application.qos.port=22222 #### Ϣ #### # Ӧá -dubbo.servicecomb.service.application=discovery +dubbo.servicecomb.service.application=discovery-spring # ơ dubbo.servicecomb.service.name=price-provider # 汾ĬΪ 1.0.0.0