You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ki...@apache.org on 2020/07/27 12:55:40 UTC
[shardingsphere] branch master updated: Merge orchestration
instance name and namespace (#6470)
This is an automated email from the ASF dual-hosted git repository.
kimmking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 3bead8e Merge orchestration instance name and namespace (#6470)
3bead8e is described below
commit 3bead8ea0d07fff6060f80f6caa49707866cdd34
Author: Liang Zhang <te...@163.com>
AuthorDate: Mon Jul 27 20:55:29 2020 +0800
Merge orchestration instance name and namespace (#6470)
---
.../sharding-proxy/sharding/conf/server.yaml | 3 +-
.../OrchestrationRepositoryConfigurationUtil.java | 10 ++----
.../resources/META-INF/nacos/cloud/encrypt.yaml | 4 +--
.../META-INF/nacos/cloud/master-slave.yaml | 2 +-
.../resources/META-INF/nacos/cloud/shadow.yaml | 2 +-
.../nacos/cloud/sharding-databases-tables.yaml | 3 +-
.../resources/META-INF/nacos/local/encrypt.yaml | 4 +--
.../META-INF/nacos/local/master-slave.yaml | 2 +-
.../resources/META-INF/nacos/local/shadow.yaml | 2 +-
.../nacos/local/sharding-databases-tables.yaml | 2 +-
.../META-INF/zookeeper/cloud/encrypt.yaml | 3 +-
.../META-INF/zookeeper/cloud/master-slave.yaml | 3 +-
.../resources/META-INF/zookeeper/cloud/shadow.yaml | 3 +-
.../zookeeper/cloud/sharding-databases-tables.yaml | 3 +-
.../META-INF/zookeeper/local/encrypt.yaml | 3 +-
.../META-INF/zookeeper/local/master-slave.yaml | 3 +-
.../resources/META-INF/zookeeper/local/shadow.yaml | 3 +-
.../zookeeper/local/sharding-databases-tables.yaml | 3 +-
.../src/main/resources/conf/server.yaml | 3 +-
.../src/main/resources/conf/server.yaml | 3 +-
.../core/facade/OrchestrationFacade.java | 23 ++++++------
.../core/facade/OrchestrationFacadeTest.java | 4 +--
.../fixture/TestConfigurationRepository.java | 2 +-
.../facade/fixture/TestRegistryRepository.java | 2 +-
.../repository/api/OrchestrationRepository.java | 3 +-
.../config/OrchestrationCenterConfiguration.java | 5 +--
.../api/config/OrchestrationConfiguration.java | 6 ++--
.../api/fixture/TestConfigurationRepository.java | 2 +-
...a => YamlOrchestrationCenterConfiguration.java} | 6 ++--
.../config/YamlOrchestrationConfiguration.java | 6 ++--
...chestrationCenterConfigurationYamlSwapper.java} | 15 ++++----
.../OrchestrationConfigurationYamlSwapper.java | 8 ++---
.../OrchestrationConfigurationYamlSwapperTest.java | 11 +++---
...tionRepositoryConfigurationYamlSwapperTest.java | 17 ++++-----
.../repository/apollo/ApolloRepository.java | 6 ++--
.../apollo/wrapper/ApolloConfigWrapper.java | 3 +-
.../apollo/wrapper/ApolloOpenApiWrapper.java | 11 +++---
.../repository/apollo/ApolloRepositoryTest.java | 6 ++--
.../apollo/wrapper/ApolloConfigWrapperTest.java | 2 +-
.../apollo/wrapper/ApolloOpenApiWrapperTest.java | 9 +++--
.../repository/etcd/EtcdRepository.java | 2 +-
.../repository/nacos/NacosRepository.java | 4 +--
.../repository/nacos/NacosRepositoryTest.java | 4 +--
.../zookeeper/CuratorZookeeperRepository.java | 8 ++---
.../zookeeper/CuratorZookeeperRepositoryTest.java | 22 ++++++------
.../src/main/resources/conf/server.yaml | 3 +-
.../test/resources/docker/proxy/conf/server.yaml | 3 +-
...strationRepositoryConfigurationSwapperUtil.java | 8 ++---
.../fixture/TestConfigurationRepository.java | 2 +-
.../fixture/TestRegistryRepository.java | 2 +-
.../OrchestrationShardingSphereDataSourceTest.java | 8 ++---
.../YamlInstanceConfigurationSwapperUtilTest.java | 41 +++++++++++-----------
.../configWithMasterSlaveDataSourceWithProps.yaml | 4 +--
...onfigWithMasterSlaveDataSourceWithoutProps.yaml | 4 +--
.../sharding/configWithDataSourceWithProps.yaml | 4 +--
.../sharding/configWithDataSourceWithoutProps.yaml | 4 +--
.../sharding/configWithoutDataSourceWithProps.yaml | 4 +--
.../configWithoutDataSourceWithoutProps.yaml | 4 +--
.../sharding_ms/configWithDataSourceWithProps.yaml | 4 +--
.../configWithDataSourceWithoutProps.yaml | 4 +--
.../configWithDataSourceWithoutRules.yaml | 4 +--
.../configWithoutDataSourceWithProps.yaml | 4 +--
.../configWithoutDataSourceWithoutProps.yaml | 4 +--
.../yaml/unit/encryptWithRegistryCenter.yaml | 4 +--
.../src/test/resources/yaml/unit/noRule.yaml | 4 +--
.../OrchestrationSpringBootConfiguration.java | 4 +--
.../additional-spring-configuration-metadata.json | 2 +-
.../registry/TestOrchestrationRepository.java | 2 +-
...rationCenterConfigurationBeanDefinitionTag.java | 2 --
...ionCenterConfigurationBeanDefinitionParser.java | 1 -
.../registry/TestOrchestrationRepository.java | 2 +-
.../src/main/resources/conf/server.yaml | 3 +-
.../config/ShardingConfigurationLoaderTest.java | 10 +-----
.../src/test/resources/conf/server.yaml | 3 +-
.../resume/ZookeeperResumablePositionManager.java | 6 ++--
75 files changed, 163 insertions(+), 242 deletions(-)
diff --git a/examples/docker/sharding-proxy/sharding/conf/server.yaml b/examples/docker/sharding-proxy/sharding/conf/server.yaml
index 4eda46b..eb7951c 100644
--- a/examples/docker/sharding-proxy/sharding/conf/server.yaml
+++ b/examples/docker/sharding-proxy/sharding/conf/server.yaml
@@ -22,11 +22,10 @@
######################################################################################################
#orchestration:
-# name: orchestration_ds
+# namespace: orchestration_ds
# registryCenter:
# type: zookeeper
# serverLists: localhost:2181
-# namespace: orchestration
# overwrite: false
authentication:
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/OrchestrationRepositoryConfigurationUtil.java b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/OrchestrationRepositoryConfigurationUtil.java
index feb3865..a0b83b2 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/OrchestrationRepositoryConfigurationUtil.java
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/java/org/apache/shardingsphere/example/orchestration/raw/jdbc/config/OrchestrationRepositoryConfigurationUtil.java
@@ -27,14 +27,10 @@ public final class OrchestrationRepositoryConfigurationUtil {
private static final String ZOOKEEPER_CONNECTION_STRING = "localhost:2181";
- private static final String NAMESPACE = "orchestration-java-demo";
-
private static final String NACOS_CONNECTION_STRING = "localhost:8848";
- private static final String NACOS_NAMESPACE = "";
-
public static OrchestrationConfiguration getZooKeeperConfiguration(final boolean overwrite, final ShardingType shardingType) {
- OrchestrationCenterConfiguration orchestrationCenterConfig = new OrchestrationCenterConfiguration("zookeeper", ZOOKEEPER_CONNECTION_STRING, NAMESPACE, new Properties());
+ OrchestrationCenterConfiguration orchestrationCenterConfig = new OrchestrationCenterConfiguration("zookeeper", ZOOKEEPER_CONNECTION_STRING, new Properties());
switch (shardingType) {
case SHARDING_DATABASES_AND_TABLES:
return new OrchestrationConfiguration("orchestration-sharding-data-source", orchestrationCenterConfig, overwrite);
@@ -53,9 +49,9 @@ public final class OrchestrationRepositoryConfigurationUtil {
Properties nacosProperties = new Properties();
nacosProperties.setProperty("group", "SHARDING_SPHERE_DEFAULT_GROUP");
nacosProperties.setProperty("timeout", "3000");
- OrchestrationCenterConfiguration nacosConfig = new OrchestrationCenterConfiguration("nacos", NACOS_CONNECTION_STRING, NACOS_NAMESPACE, nacosProperties);
+ OrchestrationCenterConfiguration nacosConfig = new OrchestrationCenterConfiguration("nacos", NACOS_CONNECTION_STRING, nacosProperties);
Properties zookeeperProperties = new Properties();
- OrchestrationCenterConfiguration zookeeperConfig = new OrchestrationCenterConfiguration("zookeeper", ZOOKEEPER_CONNECTION_STRING, NAMESPACE, zookeeperProperties);
+ OrchestrationCenterConfiguration zookeeperConfig = new OrchestrationCenterConfiguration("zookeeper", ZOOKEEPER_CONNECTION_STRING, zookeeperProperties);
switch (shardingType) {
case SHARDING_DATABASES_AND_TABLES:
return new OrchestrationConfiguration("orchestration-zookeeper-sharding-data-source", zookeeperConfig, nacosConfig, overwrite);
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/encrypt.yaml b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/encrypt.yaml
index 81eef4c..5d7945e 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/encrypt.yaml
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/encrypt.yaml
@@ -16,15 +16,13 @@
#
orchestration:
- name: demo_zookeeper_yaml_ds_encrypt
+ namespace: demo_zookeeper_yaml_ds_encrypt
registryCenter:
type: zookeeper
serverLists: localhost:2181
- namespace: orchestration-yaml-demo
additionalConfigCenter:
type: nacos
serverLists: localhost:8848
- namespace:
props:
group: SHARDING_SPHERE_DEFAULT_GROUP
timeout: 3000
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/master-slave.yaml b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/master-slave.yaml
index fee2147..96512a6 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/master-slave.yaml
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/master-slave.yaml
@@ -16,7 +16,7 @@
#
orchestration:
- name: demo_zookeeper_yaml_ds_ms
+ namespace: demo_zookeeper_yaml_ds_ms
registryCenter:
type: zookeeper
serverLists: localhost:2181
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/shadow.yaml b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/shadow.yaml
index d8c85fa..9e313ac 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/shadow.yaml
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/shadow.yaml
@@ -16,7 +16,7 @@
#
orchestration:
- name: demo_zookeeper_yaml_ds_shadow
+ namespace: demo_zookeeper_yaml_ds_shadow
registryCenter:
type: zookeeper
serverLists: localhost:2181
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/sharding-databases-tables.yaml b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/sharding-databases-tables.yaml
index 930ae75..7070372 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/sharding-databases-tables.yaml
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/cloud/sharding-databases-tables.yaml
@@ -16,11 +16,10 @@
#
orchestration:
- name: demo_zookeeper_yaml_ds_sharding
+ namespace: demo_zookeeper_yaml_ds_sharding
registryCenter:
type: zookeeper
serverLists: localhost:2181
- namespace:
additionalConfigCenter:
type: nacos
serverLists: localhost:8848
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/encrypt.yaml b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/encrypt.yaml
index 036c578..f805aa8 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/encrypt.yaml
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/encrypt.yaml
@@ -41,15 +41,13 @@ props:
sql.show: false
orchestration:
- name: demo_zookeeper_yaml_ds_encrypt
+ namespace: demo_zookeeper_yaml_ds_encrypt
registryCenter:
type: zookeeper
serverLists: localhost:2181
- namespace: orchestration-yaml-demo
additionalConfigCenter:
type: nacos
serverLists: localhost:8848
- namespace:
props:
group: SHARDING_SPHERE_DEFAULT_GROUP
timeout: 3000
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/master-slave.yaml b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/master-slave.yaml
index 6b94c2b..a3ad78d 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/master-slave.yaml
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/master-slave.yaml
@@ -44,7 +44,7 @@ props:
sql.show: true
orchestration:
- name: demo_zookeeper_yaml_ds_ms
+ namespace: demo_zookeeper_yaml_ds_ms
registryCenter:
type: zookeeper
serverLists: localhost:2181
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/shadow.yaml b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/shadow.yaml
index 92774e8..dbe0a18 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/shadow.yaml
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/shadow.yaml
@@ -16,7 +16,7 @@
#
orchestration:
- name: demo_zookeeper_yaml_ds_shadow
+ namespace: demo_zookeeper_yaml_ds_shadow
registryCenter:
type: zookeeper
serverLists: localhost:2181
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/sharding-databases-tables.yaml b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/sharding-databases-tables.yaml
index 08f181e..7a71105 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/sharding-databases-tables.yaml
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/nacos/local/sharding-databases-tables.yaml
@@ -81,7 +81,7 @@ props:
sql.show: true
orchestration:
- name: demo_zookeeper_yaml_ds_sharding
+ namespace: demo_zookeeper_yaml_ds_sharding
registryCenter:
type: zookeeper
serverLists: localhost:2181
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/encrypt.yaml b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/encrypt.yaml
index 0458beb..ed72567 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/encrypt.yaml
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/encrypt.yaml
@@ -16,9 +16,8 @@
#
orchestration:
- name: demo_yaml_ds_encrypt
+ namespace: demo_yaml_ds_encrypt
registryCenter:
type: zookeeper
serverLists: localhost:2181
- namespace: orchestration-yaml-demo
overwrite: false
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/master-slave.yaml b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/master-slave.yaml
index 4329046..d3e1b60 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/master-slave.yaml
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/master-slave.yaml
@@ -16,9 +16,8 @@
#
orchestration:
- name: demo_yaml_ds_ms
+ namespace: demo_yaml_ds_ms
registryCenter:
type: zookeeper
serverLists: localhost:2181
- namespace: orchestration-yaml-demo
overwrite: false
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/shadow.yaml b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/shadow.yaml
index f2ab7a4..7ec3c75 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/shadow.yaml
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/shadow.yaml
@@ -16,9 +16,8 @@
#
orchestration:
- name: demo_yaml_ds_shadow
+ namespace: demo_yaml_ds_shadow
registryCenter:
type: zookeeper
serverLists: localhost:2181
- namespace: orchestration-yaml-demo
overwrite: false
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/sharding-databases-tables.yaml b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/sharding-databases-tables.yaml
index ffcff79..d55c6cd 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/sharding-databases-tables.yaml
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/sharding-databases-tables.yaml
@@ -16,9 +16,8 @@
#
orchestration:
- name: demo_yaml_ds_sharding
+ namespace: demo_yaml_ds_sharding
registryCenter:
type: zookeeper
serverLists: localhost:2181
- namespace: orchestration-yaml-demo
overwrite: false
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/encrypt.yaml b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/encrypt.yaml
index 2618c25..0a2fb24 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/encrypt.yaml
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/encrypt.yaml
@@ -16,11 +16,10 @@
#
orchestration:
- name: demo_yaml_ds_encrypt
+ namespace: demo_yaml_ds_encrypt
registryCenter:
type: zookeeper
serverLists: localhost:2181
- namespace: orchestration-yaml-demo
overwrite: true
dataSources:
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/master-slave.yaml b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/master-slave.yaml
index 3774e29..a6d1b13 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/master-slave.yaml
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/master-slave.yaml
@@ -16,11 +16,10 @@
#
orchestration:
- name: demo_yaml_ds_ms
+ namespace: demo_yaml_ds_ms
registryCenter:
type: zookeeper
serverLists: localhost:2181
- namespace: orchestration-yaml-demo
overwrite: true
dataSources:
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/shadow.yaml b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/shadow.yaml
index b39f5cd..67e65fd 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/shadow.yaml
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/shadow.yaml
@@ -16,11 +16,10 @@
#
orchestration:
- name: demo_yaml_ds_shadow
+ namespace: demo_yaml_ds_shadow
registryCenter:
type: zookeeper
serverLists: localhost:2181
- namespace: orchestration-yaml-demo
overwrite: true
dataSources:
diff --git a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/sharding-databases-tables.yaml b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/sharding-databases-tables.yaml
index 2d9cfa6..eb06beb 100644
--- a/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/sharding-databases-tables.yaml
+++ b/examples/shardingsphere-jdbc-example/orchestration-example/orchestration-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/sharding-databases-tables.yaml
@@ -16,11 +16,10 @@
#
orchestration:
- name: demo_yaml_ds_sharding
+ namespace: demo_yaml_ds_sharding
registryCenter:
type: zookeeper
serverLists: localhost:2181
- namespace: orchestration-yaml-demo
overwrite: true
dataSources:
diff --git a/examples/shardingsphere-proxy-example/shardingsphere-proxy-boot-mybatis-example/src/main/resources/conf/server.yaml b/examples/shardingsphere-proxy-example/shardingsphere-proxy-boot-mybatis-example/src/main/resources/conf/server.yaml
index 9fb0ea5..d7b5f19 100644
--- a/examples/shardingsphere-proxy-example/shardingsphere-proxy-boot-mybatis-example/src/main/resources/conf/server.yaml
+++ b/examples/shardingsphere-proxy-example/shardingsphere-proxy-boot-mybatis-example/src/main/resources/conf/server.yaml
@@ -22,11 +22,10 @@
######################################################################################################
#
#orchestration:
-# name: orchestration_ds
+# namespace: orchestration_ds
# registryCenter:
# type: zookeeper
# serverLists: localhost:2181
-# namespace: orchestration
# props:
# retryIntervalMilliseconds: 500
# timeToLiveSeconds: 60
diff --git a/examples/shardingsphere-proxy-example/shardingsphere-proxy-hint-example/src/main/resources/conf/server.yaml b/examples/shardingsphere-proxy-example/shardingsphere-proxy-hint-example/src/main/resources/conf/server.yaml
index 8971e2e..0be5557 100644
--- a/examples/shardingsphere-proxy-example/shardingsphere-proxy-hint-example/src/main/resources/conf/server.yaml
+++ b/examples/shardingsphere-proxy-example/shardingsphere-proxy-hint-example/src/main/resources/conf/server.yaml
@@ -22,11 +22,10 @@
######################################################################################################
#
#orchestration:
-# name: orchestration_ds
+# namespace: orchestration_ds
# registryCenter:
# type: zookeeper
# serverLists: localhost:2181
-# namespace: orchestration
# props:
# retryIntervalMilliseconds: 500
# timeToLiveSeconds: 60
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/main/java/org/apache/shardingsphere/orchestration/core/facade/OrchestrationFacade.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/main/java/org/apache/shardingsphere/orchestration/core/facade/OrchestrationFacade.java
index 16102e1..a6bef3d 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/main/java/org/apache/shardingsphere/orchestration/core/facade/OrchestrationFacade.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/main/java/org/apache/shardingsphere/orchestration/core/facade/OrchestrationFacade.java
@@ -53,8 +53,6 @@ public final class OrchestrationFacade implements AutoCloseable {
ShardingSphereServiceLoader.register(RegistryRepository.class);
}
- private String name;
-
private RegistryRepository registryRepository;
private ConfigurationRepository configurationRepository;
@@ -79,37 +77,36 @@ public final class OrchestrationFacade implements AutoCloseable {
* @param shardingSchemaNames sharding schema names
*/
public void init(final OrchestrationConfiguration orchestrationConfig, final Collection<String> shardingSchemaNames) {
- name = orchestrationConfig.getName();
isOverwrite = orchestrationConfig.isOverwrite();
initRegistryCenter(orchestrationConfig);
initConfigCenter(orchestrationConfig);
- initMetaDataCenter();
- initListenerManager(shardingSchemaNames);
+ initMetaDataCenter(orchestrationConfig);
+ initListenerManager(orchestrationConfig, shardingSchemaNames);
}
private void initRegistryCenter(final OrchestrationConfiguration orchestrationConfig) {
OrchestrationCenterConfiguration registryCenterConfig = orchestrationConfig.getRegistryCenterConfiguration();
Preconditions.checkNotNull(registryCenterConfig, "Registry center configuration cannot be null.");
registryRepository = TypedSPIRegistry.getRegisteredService(RegistryRepository.class, registryCenterConfig.getType(), registryCenterConfig.getProps());
- registryRepository.init(registryCenterConfig);
- registryCenter = new RegistryCenter(name, registryRepository);
+ registryRepository.init(orchestrationConfig.getNamespace(), registryCenterConfig);
+ registryCenter = new RegistryCenter(orchestrationConfig.getNamespace(), registryRepository);
}
private void initConfigCenter(final OrchestrationConfiguration orchestrationConfig) {
OrchestrationCenterConfiguration additionalConfigCenterConfig = orchestrationConfig.getAdditionalConfigCenterConfiguration().orElse(orchestrationConfig.getRegistryCenterConfiguration());
Preconditions.checkNotNull(additionalConfigCenterConfig, "Config center configuration cannot be null.");
configurationRepository = TypedSPIRegistry.getRegisteredService(ConfigurationRepository.class, additionalConfigCenterConfig.getType(), additionalConfigCenterConfig.getProps());
- configurationRepository.init(additionalConfigCenterConfig);
- configCenter = new ConfigCenter(name, configurationRepository);
+ configurationRepository.init(orchestrationConfig.getNamespace(), additionalConfigCenterConfig);
+ configCenter = new ConfigCenter(orchestrationConfig.getNamespace(), configurationRepository);
}
- private void initMetaDataCenter() {
- metaDataCenter = new MetaDataCenter(name, configurationRepository);
+ private void initMetaDataCenter(final OrchestrationConfiguration orchestrationConfig) {
+ metaDataCenter = new MetaDataCenter(orchestrationConfig.getNamespace(), configurationRepository);
}
- private void initListenerManager(final Collection<String> shardingSchemaNames) {
+ private void initListenerManager(final OrchestrationConfiguration orchestrationConfig, final Collection<String> shardingSchemaNames) {
listenerManager = new OrchestrationListenerManager(
- name, registryRepository, configurationRepository, shardingSchemaNames.isEmpty() ? configCenter.getAllShardingSchemaNames() : shardingSchemaNames);
+ orchestrationConfig.getNamespace(), registryRepository, configurationRepository, shardingSchemaNames.isEmpty() ? configCenter.getAllShardingSchemaNames() : shardingSchemaNames);
}
/**
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/OrchestrationFacadeTest.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/OrchestrationFacadeTest.java
index dc751e5..18e09cb 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/OrchestrationFacadeTest.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/OrchestrationFacadeTest.java
@@ -68,8 +68,8 @@ public final class OrchestrationFacadeTest {
@Before
public void setUp() {
- OrchestrationCenterConfiguration regCenterConfig = new OrchestrationCenterConfiguration("REG_TEST", "127.0.0.1", "namespace_1", new Properties());
- OrchestrationCenterConfiguration additionalConfigCenterConfig = new OrchestrationCenterConfiguration("CONFIG_TEST", "127.0.0.1", "namespace_2", new Properties());
+ OrchestrationCenterConfiguration regCenterConfig = new OrchestrationCenterConfiguration("REG_TEST", "127.0.0.1", new Properties());
+ OrchestrationCenterConfiguration additionalConfigCenterConfig = new OrchestrationCenterConfiguration("CONFIG_TEST", "127.0.0.1", new Properties());
OrchestrationConfiguration orchestrationConfiguration = new OrchestrationConfiguration("test_name", regCenterConfig, additionalConfigCenterConfig, false);
orchestrationFacade.init(orchestrationConfiguration, Arrays.asList("sharding_db", "masterslave_db"));
FieldUtil.setField(orchestrationFacade, "registryRepository", registryRepository);
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestConfigurationRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestConfigurationRepository.java
index 0d8407c..52e73bc 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestConfigurationRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestConfigurationRepository.java
@@ -34,7 +34,7 @@ public final class TestConfigurationRepository implements ConfigurationRepositor
private Properties props = new Properties();
@Override
- public void init(final OrchestrationCenterConfiguration config) {
+ public void init(final String namespace, final OrchestrationCenterConfiguration config) {
}
@Override
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestRegistryRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestRegistryRepository.java
index c925616..19a7eac 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestRegistryRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestRegistryRepository.java
@@ -34,7 +34,7 @@ public final class TestRegistryRepository implements RegistryRepository {
private Properties props = new Properties();
@Override
- public void init(final OrchestrationCenterConfiguration config) {
+ public void init(final String namespace, final OrchestrationCenterConfiguration config) {
}
@Override
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/main/java/org/apache/shardingsphere/orchestration/repository/api/OrchestrationRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/main/java/org/apache/shardingsphere/orchestration/repository/api/OrchestrationRepository.java
index df64481..7a9e2b7 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/main/java/org/apache/shardingsphere/orchestration/repository/api/OrchestrationRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/main/java/org/apache/shardingsphere/orchestration/repository/api/OrchestrationRepository.java
@@ -31,9 +31,10 @@ public interface OrchestrationRepository extends TypedSPI {
/**
* Initialize orchestration center.
*
+ * @param namespace orchestration center namespace
* @param config orchestration center configuration
*/
- void init(OrchestrationCenterConfiguration config);
+ void init(String namespace, OrchestrationCenterConfiguration config);
/**
* Get data from config center.
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/main/java/org/apache/shardingsphere/orchestration/repository/api/config/OrchestrationCenterConfiguration.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/main/java/org/apache/shardingsphere/orchestration/repository/api/config/Orch [...]
index 29e4922..0253197 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/main/java/org/apache/shardingsphere/orchestration/repository/api/config/OrchestrationCenterConfiguration.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/main/java/org/apache/shardingsphere/orchestration/repository/api/config/OrchestrationCenterConfiguration.java
@@ -30,11 +30,8 @@ public final class OrchestrationCenterConfiguration extends TypedSPIConfiguratio
private final String serverLists;
- private final String namespace;
-
- public OrchestrationCenterConfiguration(final String type, final String serverLists, final String namespace, final Properties props) {
+ public OrchestrationCenterConfiguration(final String type, final String serverLists, final Properties props) {
super(type, props);
this.serverLists = serverLists;
- this.namespace = namespace;
}
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/main/java/org/apache/shardingsphere/orchestration/repository/api/config/OrchestrationConfiguration.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/main/java/org/apache/shardingsphere/orchestration/repository/api/config/Orchestrat [...]
index cd349f9..7613f14 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/main/java/org/apache/shardingsphere/orchestration/repository/api/config/OrchestrationConfiguration.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/main/java/org/apache/shardingsphere/orchestration/repository/api/config/OrchestrationConfiguration.java
@@ -29,7 +29,7 @@ import java.util.Optional;
@Getter
public final class OrchestrationConfiguration {
- private final String name;
+ private final String namespace;
private final OrchestrationCenterConfiguration registryCenterConfiguration;
@@ -37,8 +37,8 @@ public final class OrchestrationConfiguration {
private final boolean overwrite;
- public OrchestrationConfiguration(final String name, final OrchestrationCenterConfiguration orchestrationCenterConfig, final boolean overwrite) {
- this(name, orchestrationCenterConfig, null, overwrite);
+ public OrchestrationConfiguration(final String namespace, final OrchestrationCenterConfiguration orchestrationCenterConfig, final boolean overwrite) {
+ this(namespace, orchestrationCenterConfig, null, overwrite);
}
/**
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/test/java/org/apache/shardingsphere/orchestration/repository/api/fixture/TestConfigurationRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/test/java/org/apache/shardingsphere/orchestration/repository/api/fixture/TestCon [...]
index 50894cb..68e0b88 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/test/java/org/apache/shardingsphere/orchestration/repository/api/fixture/TestConfigurationRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/test/java/org/apache/shardingsphere/orchestration/repository/api/fixture/TestConfigurationRepository.java
@@ -35,7 +35,7 @@ public final class TestConfigurationRepository implements ConfigurationRepositor
private Properties props = new Properties();
@Override
- public void init(final OrchestrationCenterConfiguration config) {
+ public void init(final String namespace, final OrchestrationCenterConfiguration config) {
}
@Override
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repository/common/configuration/config/YamlOrchestrationRepositoryConfiguration.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestra [...]
similarity index 86%
rename from shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repository/common/configuration/config/YamlOrchestrationRepositoryConfiguration.java
rename to shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repository/common/configuration/config/YamlOrchestrationCenterConfiguration.java
index 3ddfcda..ce014c8 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repository/common/configuration/config/YamlOrchestrationRepositoryConfiguration.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repository/common/configuration/config/YamlOrchestrationCenterConfiguration.java
@@ -24,17 +24,15 @@ import org.apache.shardingsphere.infra.yaml.config.YamlConfiguration;
import java.util.Properties;
/**
- * Orchestration repository configuration for YAML.
+ * Orchestration center configuration for YAML.
*/
@Getter
@Setter
-public final class YamlOrchestrationRepositoryConfiguration implements YamlConfiguration {
+public final class YamlOrchestrationCenterConfiguration implements YamlConfiguration {
private String type;
private String serverLists;
- private String namespace;
-
private Properties props = new Properties();
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repository/common/configuration/config/YamlOrchestrationConfiguration.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repos [...]
index 589accb..56c0022 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repository/common/configuration/config/YamlOrchestrationConfiguration.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repository/common/configuration/config/YamlOrchestrationConfiguration.java
@@ -28,11 +28,11 @@ import org.apache.shardingsphere.infra.yaml.config.YamlConfiguration;
@Setter
public final class YamlOrchestrationConfiguration implements YamlConfiguration {
- private String name;
+ private String namespace;
- private YamlOrchestrationRepositoryConfiguration registryCenter;
+ private YamlOrchestrationCenterConfiguration registryCenter;
- private YamlOrchestrationRepositoryConfiguration additionalConfigCenter;
+ private YamlOrchestrationCenterConfiguration additionalConfigCenter;
private boolean overwrite;
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repository/common/configuration/swapper/OrchestrationRepositoryConfigurationYamlSwapper.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/o [...]
similarity index 67%
rename from shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repository/common/configuration/swapper/OrchestrationRepositoryConfigurationYamlSwapper.java
rename to shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repository/common/configuration/swapper/OrchestrationCenterConfigurationYamlSwapper.java
index c368f5f..8f2c8a9 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repository/common/configuration/swapper/OrchestrationRepositoryConfigurationYamlSwapper.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repository/common/configuration/swapper/OrchestrationCenterConfigurationYamlSwapper.java
@@ -17,27 +17,26 @@
package org.apache.shardingsphere.orchestration.repository.common.configuration.swapper;
-import org.apache.shardingsphere.orchestration.repository.common.configuration.config.YamlOrchestrationRepositoryConfiguration;
+import org.apache.shardingsphere.orchestration.repository.common.configuration.config.YamlOrchestrationCenterConfiguration;
import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationCenterConfiguration;
import org.apache.shardingsphere.infra.yaml.swapper.YamlSwapper;
/**
- * Orchestration repository configuration YAML swapper.
+ * Orchestration center configuration YAML swapper.
*/
-public final class OrchestrationRepositoryConfigurationYamlSwapper implements YamlSwapper<YamlOrchestrationRepositoryConfiguration, OrchestrationCenterConfiguration> {
+public final class OrchestrationCenterConfigurationYamlSwapper implements YamlSwapper<YamlOrchestrationCenterConfiguration, OrchestrationCenterConfiguration> {
@Override
- public YamlOrchestrationRepositoryConfiguration swapToYamlConfiguration(final OrchestrationCenterConfiguration config) {
- YamlOrchestrationRepositoryConfiguration result = new YamlOrchestrationRepositoryConfiguration();
+ public YamlOrchestrationCenterConfiguration swapToYamlConfiguration(final OrchestrationCenterConfiguration config) {
+ YamlOrchestrationCenterConfiguration result = new YamlOrchestrationCenterConfiguration();
result.setType(config.getType());
result.setServerLists(config.getServerLists());
- result.setNamespace(config.getNamespace());
result.setProps(config.getProps());
return result;
}
@Override
- public OrchestrationCenterConfiguration swapToObject(final YamlOrchestrationRepositoryConfiguration yamlConfig) {
- return new OrchestrationCenterConfiguration(yamlConfig.getType(), yamlConfig.getServerLists(), yamlConfig.getNamespace(), yamlConfig.getProps());
+ public OrchestrationCenterConfiguration swapToObject(final YamlOrchestrationCenterConfiguration yamlConfig) {
+ return new OrchestrationCenterConfiguration(yamlConfig.getType(), yamlConfig.getServerLists(), yamlConfig.getProps());
}
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repository/common/configuration/swapper/OrchestrationConfigurationYamlSwapper.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestrati [...]
index bed016b..948134c 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repository/common/configuration/swapper/OrchestrationConfigurationYamlSwapper.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/main/java/org/apache/shardingsphere/orchestration/repository/common/configuration/swapper/OrchestrationConfigurationYamlSwapper.java
@@ -26,12 +26,12 @@ import org.apache.shardingsphere.orchestration.repository.common.configuration.c
*/
public final class OrchestrationConfigurationYamlSwapper implements YamlSwapper<YamlOrchestrationConfiguration, OrchestrationConfiguration> {
- private final OrchestrationRepositoryConfigurationYamlSwapper swapper = new OrchestrationRepositoryConfigurationYamlSwapper();
+ private final OrchestrationCenterConfigurationYamlSwapper swapper = new OrchestrationCenterConfigurationYamlSwapper();
@Override
public YamlOrchestrationConfiguration swapToYamlConfiguration(final OrchestrationConfiguration configuration) {
YamlOrchestrationConfiguration result = new YamlOrchestrationConfiguration();
- result.setName(configuration.getName());
+ result.setNamespace(configuration.getNamespace());
result.setRegistryCenter(swapper.swapToYamlConfiguration(configuration.getRegistryCenterConfiguration()));
if (configuration.getAdditionalConfigCenterConfiguration().isPresent()) {
result.setAdditionalConfigCenter(swapper.swapToYamlConfiguration(configuration.getAdditionalConfigCenterConfiguration().get()));
@@ -42,9 +42,9 @@ public final class OrchestrationConfigurationYamlSwapper implements YamlSwapper<
@Override
public OrchestrationConfiguration swapToObject(final YamlOrchestrationConfiguration configuration) {
if (null != configuration.getAdditionalConfigCenter()) {
- return new OrchestrationConfiguration(configuration.getName(), swapper.swapToObject(configuration.getRegistryCenter()),
+ return new OrchestrationConfiguration(configuration.getNamespace(), swapper.swapToObject(configuration.getRegistryCenter()),
swapper.swapToObject(configuration.getAdditionalConfigCenter()), configuration.isOverwrite());
}
- return new OrchestrationConfiguration(configuration.getName(), swapper.swapToObject(configuration.getRegistryCenter()), configuration.isOverwrite());
+ return new OrchestrationConfiguration(configuration.getNamespace(), swapper.swapToObject(configuration.getRegistryCenter()), configuration.isOverwrite());
}
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/test/java/org/apache/shardingsphere/orchestration/repository/common/configuration/swapper/OrchestrationConfigurationYamlSwapperTest.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/test/java/org/apache/shardingsphere/orchest [...]
index 0ba648a..3fce79b 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/test/java/org/apache/shardingsphere/orchestration/repository/common/configuration/swapper/OrchestrationConfigurationYamlSwapperTest.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/test/java/org/apache/shardingsphere/orchestration/repository/common/configuration/swapper/OrchestrationConfigurationYamlSwapperTest.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.orchestration.repository.common.configuration.
import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationConfiguration;
import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationCenterConfiguration;
import org.apache.shardingsphere.orchestration.repository.common.configuration.config.YamlOrchestrationConfiguration;
-import org.apache.shardingsphere.orchestration.repository.common.configuration.config.YamlOrchestrationRepositoryConfiguration;
+import org.apache.shardingsphere.orchestration.repository.common.configuration.config.YamlOrchestrationCenterConfiguration;
import org.junit.Test;
import java.util.Properties;
@@ -37,13 +37,12 @@ public final class OrchestrationConfigurationYamlSwapperTest {
OrchestrationConfiguration data = getOrchestrationConfiguration();
YamlOrchestrationConfiguration result = new OrchestrationConfigurationYamlSwapper().swapToYamlConfiguration(data);
assertThat(result.getRegistryCenter().getType(), is(data.getRegistryCenterConfiguration().getType()));
- assertThat(result.getRegistryCenter().getNamespace(), is(data.getRegistryCenterConfiguration().getNamespace()));
assertThat(result.getRegistryCenter().getServerLists(), is(data.getRegistryCenterConfiguration().getServerLists()));
assertThat(result.getRegistryCenter().getProps(), is(data.getRegistryCenterConfiguration().getProps()));
}
private OrchestrationConfiguration getOrchestrationConfiguration() {
- return new OrchestrationConfiguration(LOGIC_SCHEMA, new OrchestrationCenterConfiguration("zookeeper", "127.0.0.1:2181,127.0.0.1:2182", "orchestration", new Properties()), false);
+ return new OrchestrationConfiguration(LOGIC_SCHEMA, new OrchestrationCenterConfiguration("zookeeper", "127.0.0.1:2181,127.0.0.1:2182", new Properties()), false);
}
@Test
@@ -51,19 +50,17 @@ public final class OrchestrationConfigurationYamlSwapperTest {
YamlOrchestrationConfiguration data = getYamlOrchestrationConfiguration();
OrchestrationConfiguration result = new OrchestrationConfigurationYamlSwapper().swapToObject(data);
assertThat(result.getRegistryCenterConfiguration().getType(), is(data.getRegistryCenter().getType()));
- assertThat(result.getRegistryCenterConfiguration().getNamespace(), is(data.getRegistryCenter().getNamespace()));
assertThat(result.getRegistryCenterConfiguration().getServerLists(), is(data.getRegistryCenter().getServerLists()));
assertThat(result.getRegistryCenterConfiguration().getProps(), is(data.getRegistryCenter().getProps()));
}
private YamlOrchestrationConfiguration getYamlOrchestrationConfiguration() {
- YamlOrchestrationRepositoryConfiguration registryCenterConfig = new YamlOrchestrationRepositoryConfiguration();
+ YamlOrchestrationCenterConfiguration registryCenterConfig = new YamlOrchestrationCenterConfiguration();
registryCenterConfig.setType("zookeeper");
registryCenterConfig.setProps(new Properties());
registryCenterConfig.setServerLists("127.0.0.1:2181,127.0.0.1:2182");
- registryCenterConfig.setNamespace("orchestration");
YamlOrchestrationConfiguration result = new YamlOrchestrationConfiguration();
- result.setName(LOGIC_SCHEMA);
+ result.setNamespace(LOGIC_SCHEMA);
result.setRegistryCenter(registryCenterConfig);
return result;
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/test/java/org/apache/shardingsphere/orchestration/repository/common/configuration/swapper/OrchestrationRepositoryConfigurationYamlSwapperTest.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/test/java/org/apache/shardingsphe [...]
index a4a0100..37139c8 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/test/java/org/apache/shardingsphere/orchestration/repository/common/configuration/swapper/OrchestrationRepositoryConfigurationYamlSwapperTest.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-common/src/test/java/org/apache/shardingsphere/orchestration/repository/common/configuration/swapper/OrchestrationRepositoryConfigurationYamlSwapperTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.orchestration.repository.common.configuration.swapper;
-import org.apache.shardingsphere.orchestration.repository.common.configuration.config.YamlOrchestrationRepositoryConfiguration;
+import org.apache.shardingsphere.orchestration.repository.common.configuration.config.YamlOrchestrationCenterConfiguration;
import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationCenterConfiguration;
import org.junit.Test;
@@ -30,30 +30,27 @@ public final class OrchestrationRepositoryConfigurationYamlSwapperTest {
@Test
public void assertToYamlConfiguration() {
- OrchestrationCenterConfiguration config = new OrchestrationCenterConfiguration("zookeeper", "127.0.0.1:2181,127.0.0.1:2182", "orchestration", new Properties());
- YamlOrchestrationRepositoryConfiguration yamlConfiguration = new OrchestrationRepositoryConfigurationYamlSwapper().swapToYamlConfiguration(config);
+ OrchestrationCenterConfiguration config = new OrchestrationCenterConfiguration("zookeeper", "127.0.0.1:2181,127.0.0.1:2182", new Properties());
+ YamlOrchestrationCenterConfiguration yamlConfiguration = new OrchestrationCenterConfigurationYamlSwapper().swapToYamlConfiguration(config);
assertThat(yamlConfiguration.getType(), is(config.getType()));
assertThat(yamlConfiguration.getServerLists(), is(config.getServerLists()));
- assertThat(yamlConfiguration.getNamespace(), is(config.getNamespace()));
assertThat(yamlConfiguration.getProps(), is(config.getProps()));
}
@Test
public void assertSwapToObject() {
- YamlOrchestrationRepositoryConfiguration yamlConfiguration = getYamlInstanceConfiguration();
- OrchestrationCenterConfiguration orchestrationCenterConfig = new OrchestrationRepositoryConfigurationYamlSwapper().swapToObject(yamlConfiguration);
+ YamlOrchestrationCenterConfiguration yamlConfiguration = getYamlInstanceConfiguration();
+ OrchestrationCenterConfiguration orchestrationCenterConfig = new OrchestrationCenterConfigurationYamlSwapper().swapToObject(yamlConfiguration);
assertThat(orchestrationCenterConfig.getType(), is(yamlConfiguration.getType()));
assertThat(orchestrationCenterConfig.getServerLists(), is(yamlConfiguration.getServerLists()));
- assertThat(orchestrationCenterConfig.getNamespace(), is(yamlConfiguration.getNamespace()));
assertThat(orchestrationCenterConfig.getProps(), is(yamlConfiguration.getProps()));
}
- private YamlOrchestrationRepositoryConfiguration getYamlInstanceConfiguration() {
- YamlOrchestrationRepositoryConfiguration result = new YamlOrchestrationRepositoryConfiguration();
+ private YamlOrchestrationCenterConfiguration getYamlInstanceConfiguration() {
+ YamlOrchestrationCenterConfiguration result = new YamlOrchestrationCenterConfiguration();
result.setType("zookeeper");
result.setProps(new Properties());
result.setServerLists("127.0.0.1:2181,127.0.0.1:2182");
- result.setNamespace("orchestration");
return result;
}
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/main/java/org/apache/shardingsphere/orchestration/repository/apollo/ApolloRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apo [...]
index 7ed1586..59eac2e 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/main/java/org/apache/shardingsphere/orchestration/repository/apollo/ApolloRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/main/java/org/apache/shardingsphere/orchestration/repository/apollo/ApolloRepository.java
@@ -55,10 +55,10 @@ public final class ApolloRepository implements ConfigurationRepository {
private Properties props = new Properties();
@Override
- public void init(final OrchestrationCenterConfiguration config) {
+ public void init(final String namespace, final OrchestrationCenterConfiguration config) {
ApolloProperties apolloProperties = new ApolloProperties(props);
- configWrapper = new ApolloConfigWrapper(config, apolloProperties);
- openApiWrapper = new ApolloOpenApiWrapper(config, apolloProperties);
+ configWrapper = new ApolloConfigWrapper(namespace, config, apolloProperties);
+ openApiWrapper = new ApolloOpenApiWrapper(namespace, apolloProperties);
}
@Override
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/main/java/org/apache/shardingsphere/orchestration/repository/apollo/wrapper/ApolloConfigWrapper.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-rep [...]
index 155f191..c987d57 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/main/java/org/apache/shardingsphere/orchestration/repository/apollo/wrapper/ApolloConfigWrapper.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/main/java/org/apache/shardingsphere/orchestration/repository/apollo/wrapper/ApolloConfigWrapper.java
@@ -38,7 +38,7 @@ public final class ApolloConfigWrapper {
private final Config apolloConfig;
- public ApolloConfigWrapper(final OrchestrationCenterConfiguration config, final ApolloProperties props) {
+ public ApolloConfigWrapper(final String namespace, final OrchestrationCenterConfiguration config, final ApolloProperties props) {
String appId = props.getValue(ApolloPropertyKey.APP_ID);
String env = props.getValue(ApolloPropertyKey.ENV);
String clusterName = props.getValue(ApolloPropertyKey.CLUSTER_NAME);
@@ -46,7 +46,6 @@ public final class ApolloConfigWrapper {
System.setProperty(APOLLO_KEY_ENV, env);
System.setProperty(ConfigConsts.APOLLO_CLUSTER_KEY, clusterName);
System.setProperty(ConfigConsts.APOLLO_META_KEY, config.getServerLists());
- String namespace = config.getNamespace();
apolloConfig = ConfigService.getConfig(namespace);
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/main/java/org/apache/shardingsphere/orchestration/repository/apollo/wrapper/ApolloOpenApiWrapper.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-re [...]
index d50ddeb..761360c 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/main/java/org/apache/shardingsphere/orchestration/repository/apollo/wrapper/ApolloOpenApiWrapper.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/main/java/org/apache/shardingsphere/orchestration/repository/apollo/wrapper/ApolloOpenApiWrapper.java
@@ -22,15 +22,12 @@ import com.ctrip.framework.apollo.openapi.dto.NamespaceReleaseDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenItemDTO;
import org.apache.shardingsphere.orchestration.repository.apollo.ApolloProperties;
import org.apache.shardingsphere.orchestration.repository.apollo.ApolloPropertyKey;
-import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationCenterConfiguration;
/**
- * Apollo open api client wrapper.
+ * Apollo open API client wrapper.
*/
public final class ApolloOpenApiWrapper {
- private final ApolloOpenApiClient client;
-
private final String namespace;
private final String appId;
@@ -41,8 +38,10 @@ public final class ApolloOpenApiWrapper {
private final String administrator;
- public ApolloOpenApiWrapper(final OrchestrationCenterConfiguration config, final ApolloProperties props) {
- namespace = config.getNamespace();
+ private final ApolloOpenApiClient client;
+
+ public ApolloOpenApiWrapper(final String namespace, final ApolloProperties props) {
+ this.namespace = namespace;
appId = props.getValue(ApolloPropertyKey.APP_ID);
env = props.getValue(ApolloPropertyKey.ENV);
clusterName = props.getValue(ApolloPropertyKey.CLUSTER_NAME);
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/test/java/org/apache/shardingsphere/orchestration/repository/apollo/ApolloRepositoryTest.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository [...]
index fd5d11c0..3e16bdc 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/test/java/org/apache/shardingsphere/orchestration/repository/apollo/ApolloRepositoryTest.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/test/java/org/apache/shardingsphere/orchestration/repository/apollo/ApolloRepositoryTest.java
@@ -68,10 +68,10 @@ public final class ApolloRepositoryTest {
Properties props = new Properties();
props.setProperty(ApolloPropertyKey.PORTAL_URL.getKey(), PORTAL_URL);
props.setProperty(ApolloPropertyKey.TOKEN.getKey(), TOKEN);
- OrchestrationCenterConfiguration config = new OrchestrationCenterConfiguration("apollo", "http://config-service-url", "orchestration", props);
+ OrchestrationCenterConfiguration config = new OrchestrationCenterConfiguration("apollo", "http://config-service-url", props);
REPOSITORY.setProps(props);
- REPOSITORY.init(config);
- ApolloConfigWrapper configWrapper = new ApolloConfigWrapper(config, new ApolloProperties(props));
+ REPOSITORY.init("orchestration", config);
+ ApolloConfigWrapper configWrapper = new ApolloConfigWrapper("orchestration", config, new ApolloProperties(props));
FieldSetter.setField(REPOSITORY, ApolloRepository.class.getDeclaredField("configWrapper"), configWrapper);
FieldSetter.setField(REPOSITORY, ApolloRepository.class.getDeclaredField("openApiWrapper"), OPEN_API_WRAPPER);
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/test/java/org/apache/shardingsphere/orchestration/repository/apollo/wrapper/ApolloConfigWrapperTest.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration [...]
index 7735d04..292b27c 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/test/java/org/apache/shardingsphere/orchestration/repository/apollo/wrapper/ApolloConfigWrapperTest.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/test/java/org/apache/shardingsphere/orchestration/repository/apollo/wrapper/ApolloConfigWrapperTest.java
@@ -52,7 +52,7 @@ public final class ApolloConfigWrapperTest {
@Before
public void setup() {
configWrapper = new ApolloConfigWrapper(
- new OrchestrationCenterConfiguration("apollo", "http://config-service-url", "orchestration", new Properties()), new ApolloProperties(new Properties()));
+ "orchestration", new OrchestrationCenterConfiguration("apollo", "http://config-service-url", new Properties()), new ApolloProperties(new Properties()));
}
@Test
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/test/java/org/apache/shardingsphere/orchestration/repository/apollo/wrapper/ApolloOpenApiWrapperTest.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestratio [...]
index 2d4e51e..037e407 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/test/java/org/apache/shardingsphere/orchestration/repository/apollo/wrapper/ApolloOpenApiWrapperTest.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/test/java/org/apache/shardingsphere/orchestration/repository/apollo/wrapper/ApolloOpenApiWrapperTest.java
@@ -21,10 +21,9 @@ import com.ctrip.framework.apollo.openapi.client.ApolloOpenApiClient;
import com.ctrip.framework.apollo.openapi.dto.NamespaceReleaseDTO;
import com.ctrip.framework.apollo.openapi.dto.OpenItemDTO;
import lombok.SneakyThrows;
-import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationCenterConfiguration;
+import org.apache.shardingsphere.orchestration.repository.api.util.ConfigKeyUtils;
import org.apache.shardingsphere.orchestration.repository.apollo.ApolloProperties;
import org.apache.shardingsphere.orchestration.repository.apollo.ApolloPropertyKey;
-import org.apache.shardingsphere.orchestration.repository.api.util.ConfigKeyUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,12 +33,12 @@ import org.mockito.junit.MockitoJUnitRunner;
import java.util.Properties;
-import static org.mockito.ArgumentMatchers.anyString;
+import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static org.junit.Assert.assertNull;
@RunWith(MockitoJUnitRunner.class)
public final class ApolloOpenApiWrapperTest {
@@ -64,7 +63,7 @@ public final class ApolloOpenApiWrapperTest {
Properties props = new Properties();
props.setProperty(ApolloPropertyKey.PORTAL_URL.getKey(), PORTAL_URL);
props.setProperty(ApolloPropertyKey.TOKEN.getKey(), TOKEN);
- apolloOpenApiWrapper = new ApolloOpenApiWrapper(new OrchestrationCenterConfiguration("apollo", "127.0.0.1", null, new Properties()), new ApolloProperties(props));
+ apolloOpenApiWrapper = new ApolloOpenApiWrapper("apollo_namespace", new ApolloProperties(props));
FieldSetter.setField(apolloOpenApiWrapper, ApolloOpenApiWrapper.class.getDeclaredField("client"), client);
FieldSetter.setField(apolloOpenApiWrapper, ApolloOpenApiWrapper.class.getDeclaredField("namespace"), NAME_SPACE);
FieldSetter.setField(apolloOpenApiWrapper, ApolloOpenApiWrapper.class.getDeclaredField("appId"), ApolloPropertyKey.APP_ID.getDefaultValue());
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/main/java/org/apache/shardingsphere/orchestration/repository/etcd/EtcdRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/ [...]
index 4ea2e21..56392fa 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/main/java/org/apache/shardingsphere/orchestration/repository/etcd/EtcdRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/main/java/org/apache/shardingsphere/orchestration/repository/etcd/EtcdRepository.java
@@ -56,7 +56,7 @@ public final class EtcdRepository implements ConfigurationRepository, RegistryRe
private EtcdProperties etcdProperties;
@Override
- public void init(final OrchestrationCenterConfiguration config) {
+ public void init(final String namespace, final OrchestrationCenterConfiguration config) {
this.etcdProperties = new EtcdProperties(props);
client = Client.builder().endpoints(Util.toURIs(Splitter.on(",").trimResults().splitToList(config.getServerLists()))).build();
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-nacos/src/main/java/org/apache/shardingsphere/orchestration/repository/nacos/NacosRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-nacos/ [...]
index bc6d6cf..4a09070 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-nacos/src/main/java/org/apache/shardingsphere/orchestration/repository/nacos/NacosRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-nacos/src/main/java/org/apache/shardingsphere/orchestration/repository/nacos/NacosRepository.java
@@ -55,12 +55,12 @@ public final class NacosRepository implements ConfigurationRepository {
* @param config config center configuration
*/
@Override
- public void init(final OrchestrationCenterConfiguration config) {
+ public void init(final String namespace, final OrchestrationCenterConfiguration config) {
try {
nacosProperties = new NacosProperties(props);
Properties props = new Properties();
props.put(PropertyKeyConst.SERVER_ADDR, config.getServerLists());
- props.put(PropertyKeyConst.NAMESPACE, null == config.getNamespace() ? "" : config.getNamespace());
+ props.put(PropertyKeyConst.NAMESPACE, null == namespace ? "" : namespace);
configService = NacosFactory.createConfigService(props);
} catch (final NacosException ex) {
log.error("Init nacos config center exception for: {}", ex.toString());
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-nacos/src/test/java/org/apache/shardingsphere/orchestration/repository/nacos/NacosRepositoryTest.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-na [...]
index b216d46..7ee679f 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-nacos/src/test/java/org/apache/shardingsphere/orchestration/repository/nacos/NacosRepositoryTest.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-nacos/src/test/java/org/apache/shardingsphere/orchestration/repository/nacos/NacosRepositoryTest.java
@@ -60,8 +60,8 @@ public final class NacosRepositoryTest {
Properties props = new Properties();
props.setProperty("group", group);
props.setProperty("timeout", "3000");
- OrchestrationCenterConfiguration config = new OrchestrationCenterConfiguration(REPOSITORY.getType(), "127.0.0.1:8848", "", props);
- REPOSITORY.init(config);
+ OrchestrationCenterConfiguration config = new OrchestrationCenterConfiguration(REPOSITORY.getType(), "127.0.0.1:8848", props);
+ REPOSITORY.init("orchestration", config);
setConfigService(configService);
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/orchestration/repository/zookeeper/CuratorZookeeperRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orch [...]
index 294c8e7..4130a77 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/orchestration/repository/zookeeper/CuratorZookeeperRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/orchestration/repository/zookeeper/CuratorZookeeperRepository.java
@@ -62,13 +62,13 @@ public final class CuratorZookeeperRepository implements ConfigurationRepository
private Properties props = new Properties();
@Override
- public void init(final OrchestrationCenterConfiguration config) {
+ public void init(final String namespace, final OrchestrationCenterConfiguration config) {
ZookeeperProperties zookeeperProperties = new ZookeeperProperties(props);
- client = buildCuratorClient(config, zookeeperProperties);
+ client = buildCuratorClient(namespace, config, zookeeperProperties);
initCuratorClient(zookeeperProperties);
}
- private CuratorFramework buildCuratorClient(final OrchestrationCenterConfiguration config, final ZookeeperProperties zookeeperProperties) {
+ private CuratorFramework buildCuratorClient(final String namespace, final OrchestrationCenterConfiguration config, final ZookeeperProperties zookeeperProperties) {
int retryIntervalMilliseconds = zookeeperProperties.getValue(ZookeeperPropertyKey.RETRY_INTERVAL_MILLISECONDS);
int maxRetries = zookeeperProperties.getValue(ZookeeperPropertyKey.MAX_RETRIES);
int timeToLiveSeconds = zookeeperProperties.getValue(ZookeeperPropertyKey.TIME_TO_LIVE_SECONDS);
@@ -77,7 +77,7 @@ public final class CuratorZookeeperRepository implements ConfigurationRepository
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder()
.connectString(config.getServerLists())
.retryPolicy(new ExponentialBackoffRetry(retryIntervalMilliseconds, maxRetries, retryIntervalMilliseconds * maxRetries))
- .namespace(config.getNamespace());
+ .namespace(namespace);
if (0 != timeToLiveSeconds) {
builder.sessionTimeoutMs(timeToLiveSeconds * 1000);
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-zookeeper-curator/src/test/java/org/apache/shardingsphere/orchestration/repository/zookeeper/CuratorZookeeperRepositoryTest.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere- [...]
index 4b90dbb..23b0b55 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-zookeeper-curator/src/test/java/org/apache/shardingsphere/orchestration/repository/zookeeper/CuratorZookeeperRepositoryTest.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-zookeeper-curator/src/test/java/org/apache/shardingsphere/orchestration/repository/zookeeper/CuratorZookeeperRepositoryTest.java
@@ -46,7 +46,7 @@ public final class CuratorZookeeperRepositoryTest {
public static void init() {
EmbedTestingServer.start();
serverLists = EmbedTestingServer.getTestingServerConnectionString();
- REPOSITORY.init(new OrchestrationCenterConfiguration(REPOSITORY.getType(), serverLists, null, new Properties()));
+ REPOSITORY.init("orchestration", new OrchestrationCenterConfiguration(REPOSITORY.getType(), serverLists, new Properties()));
}
@Test
@@ -134,9 +134,9 @@ public final class CuratorZookeeperRepositoryTest {
props.setProperty(ZookeeperPropertyKey.MAX_RETRIES.getKey(), "1");
props.setProperty(ZookeeperPropertyKey.TIME_TO_LIVE_SECONDS.getKey(), "1000");
props.setProperty(ZookeeperPropertyKey.OPERATION_TIMEOUT_MILLISECONDS.getKey(), "2000");
- OrchestrationCenterConfiguration config = new OrchestrationCenterConfiguration(repository.getType(), serverLists, null, new Properties());
+ OrchestrationCenterConfiguration config = new OrchestrationCenterConfiguration(repository.getType(), serverLists, new Properties());
repository.setProps(props);
- repository.init(config);
+ repository.init("orchestration", config);
assertThat(repository.getProps().getProperty(ZookeeperPropertyKey.RETRY_INTERVAL_MILLISECONDS.getKey()), is("1000"));
assertThat(repository.getProps().getProperty(ZookeeperPropertyKey.MAX_RETRIES.getKey()), is("1"));
assertThat(repository.getProps().getProperty(ZookeeperPropertyKey.TIME_TO_LIVE_SECONDS.getKey()), is("1000"));
@@ -150,9 +150,9 @@ public final class CuratorZookeeperRepositoryTest {
final CuratorZookeeperRepository repository = new CuratorZookeeperRepository();
Properties props = new Properties();
props.setProperty(ZookeeperPropertyKey.TIME_TO_LIVE_SECONDS.getKey(), "0");
- OrchestrationCenterConfiguration config = new OrchestrationCenterConfiguration(repository.getType(), serverLists, null, new Properties());
+ OrchestrationCenterConfiguration config = new OrchestrationCenterConfiguration(repository.getType(), serverLists, new Properties());
repository.setProps(props);
- repository.init(config);
+ repository.init("orchestration", config);
assertThat(repository.getProps().getProperty(ZookeeperPropertyKey.TIME_TO_LIVE_SECONDS.getKey()), is("0"));
repository.persist("/test/children/build/2", "value1");
assertThat(repository.get("/test/children/build/2"), is("value1"));
@@ -163,9 +163,9 @@ public final class CuratorZookeeperRepositoryTest {
final CuratorZookeeperRepository repository = new CuratorZookeeperRepository();
Properties props = new Properties();
props.setProperty(ZookeeperPropertyKey.OPERATION_TIMEOUT_MILLISECONDS.getKey(), "0");
- OrchestrationCenterConfiguration config = new OrchestrationCenterConfiguration(repository.getType(), serverLists, null, new Properties());
+ OrchestrationCenterConfiguration config = new OrchestrationCenterConfiguration(repository.getType(), serverLists, new Properties());
repository.setProps(props);
- repository.init(config);
+ repository.init("orchestration", config);
assertThat(repository.getProps().getProperty(ZookeeperPropertyKey.OPERATION_TIMEOUT_MILLISECONDS.getKey()), is("0"));
repository.persist("/test/children/build/3", "value1");
assertThat(repository.get("/test/children/build/3"), is("value1"));
@@ -176,9 +176,9 @@ public final class CuratorZookeeperRepositoryTest {
final CuratorZookeeperRepository repository = new CuratorZookeeperRepository();
Properties props = new Properties();
props.setProperty(ZookeeperPropertyKey.DIGEST.getKey(), "any");
- OrchestrationCenterConfiguration config = new OrchestrationCenterConfiguration(repository.getType(), serverLists, null, new Properties());
+ OrchestrationCenterConfiguration config = new OrchestrationCenterConfiguration(repository.getType(), serverLists, new Properties());
repository.setProps(props);
- repository.init(config);
+ repository.init("orchestration", config);
assertThat(repository.getProps().getProperty(ZookeeperPropertyKey.DIGEST.getKey()), is("any"));
repository.persist("/test/children/build/4", "value1");
assertThat(repository.get("/test/children/build/4"), is("value1"));
@@ -198,11 +198,11 @@ public final class CuratorZookeeperRepositoryTest {
@Test
public void assertZKCloseAndException() {
CuratorZookeeperRepository repository = new CuratorZookeeperRepository();
- OrchestrationCenterConfiguration config = new OrchestrationCenterConfiguration(repository.getType(), serverLists, null, new Properties());
+ OrchestrationCenterConfiguration config = new OrchestrationCenterConfiguration(repository.getType(), serverLists, new Properties());
Properties props = new Properties();
props.setProperty(ZookeeperPropertyKey.DIGEST.getKey(), "digest");
repository.setProps(props);
- repository.init(config);
+ repository.init("orchestration", config);
repository.close();
try {
repository.get("/test/children/1");
diff --git a/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/server.yaml b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/server.yaml
index f4d39cf..d4f00a2 100644
--- a/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/server.yaml
+++ b/shardingsphere-distribution/shardingsphere-proxy-distribution/src/main/resources/conf/server.yaml
@@ -22,11 +22,10 @@
######################################################################################################
#
#orchestration:
-# name: orchestration_ds
+# namespace: orchestration_ds
# registryCenter:
# type: zookeeper
# serverLists: localhost:2181
-# namespace: orchestration
# props:
# retryIntervalMilliseconds: 500
# timeToLiveSeconds: 60
diff --git a/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/proxy/conf/server.yaml b/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/proxy/conf/server.yaml
index f991c79..bc99698 100644
--- a/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/proxy/conf/server.yaml
+++ b/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/proxy/conf/server.yaml
@@ -22,11 +22,10 @@
######################################################################################################
#
#orchestration:
-# name: orchestration_ds
+# namespace: orchestration_ds
# registryCenter:
# type: zookeeper
# serverLists: localhost:2181
-# namespace: orchestration
# props:
# retryIntervalMilliseconds: 500
# timeToLiveSeconds: 60
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/main/java/org/apache/shardingsphere/driver/orchestration/internal/util/YamlOrchestrationRepositoryConfigurationSwapperUtil.java b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/main/java/org/apache/shardingsphere/driver/orchestration/internal/util/YamlOrchestrationRepositoryConfigurationSwapperUtil.java
index 2996a5e..0ecbf47 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/main/java/org/apache/shardingsphere/driver/orchestration/internal/util/YamlOrchestrationRepositoryConfigurationSwapperUtil.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/main/java/org/apache/shardingsphere/driver/orchestration/internal/util/YamlOrchestrationRepositoryConfigurationSwapperUtil.java
@@ -21,7 +21,7 @@ import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationConfiguration;
import org.apache.shardingsphere.orchestration.repository.common.configuration.config.YamlOrchestrationConfiguration;
-import org.apache.shardingsphere.orchestration.repository.common.configuration.swapper.OrchestrationRepositoryConfigurationYamlSwapper;
+import org.apache.shardingsphere.orchestration.repository.common.configuration.swapper.OrchestrationCenterConfigurationYamlSwapper;
/**
* YAML orchestration configuration swapper utility.
@@ -29,7 +29,7 @@ import org.apache.shardingsphere.orchestration.repository.common.configuration.s
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class YamlOrchestrationRepositoryConfigurationSwapperUtil {
- private static final OrchestrationRepositoryConfigurationYamlSwapper SWAPPER = new OrchestrationRepositoryConfigurationYamlSwapper();
+ private static final OrchestrationCenterConfigurationYamlSwapper SWAPPER = new OrchestrationCenterConfigurationYamlSwapper();
/**
* Marshal YAML orchestration repository configuration map to instance configuration map.
@@ -39,9 +39,9 @@ public final class YamlOrchestrationRepositoryConfigurationSwapperUtil {
*/
public static OrchestrationConfiguration marshal(final YamlOrchestrationConfiguration orchestration) {
if (null == orchestration.getAdditionalConfigCenter()) {
- return new OrchestrationConfiguration(orchestration.getName(), SWAPPER.swapToObject(orchestration.getRegistryCenter()), orchestration.isOverwrite());
+ return new OrchestrationConfiguration(orchestration.getNamespace(), SWAPPER.swapToObject(orchestration.getRegistryCenter()), orchestration.isOverwrite());
}
- return new OrchestrationConfiguration(orchestration.getName(),
+ return new OrchestrationConfiguration(orchestration.getNamespace(),
SWAPPER.swapToObject(orchestration.getRegistryCenter()), SWAPPER.swapToObject(orchestration.getAdditionalConfigCenter()), orchestration.isOverwrite());
}
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/fixture/TestConfigurationRepository.java b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/fixture/TestConfigurationRepository.java
index 6baf337..9c65e09 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/fixture/TestConfigurationRepository.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/fixture/TestConfigurationRepository.java
@@ -38,7 +38,7 @@ public final class TestConfigurationRepository implements ConfigurationRepositor
private Properties props = new Properties();
@Override
- public void init(final OrchestrationCenterConfiguration config) {
+ public void init(final String namespace, final OrchestrationCenterConfiguration config) {
}
@Override
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/fixture/TestRegistryRepository.java b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/fixture/TestRegistryRepository.java
index f09a268..48c8210 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/fixture/TestRegistryRepository.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/fixture/TestRegistryRepository.java
@@ -39,7 +39,7 @@ public final class TestRegistryRepository implements RegistryRepository, Configu
private Properties props = new Properties();
@Override
- public void init(final OrchestrationCenterConfiguration config) {
+ public void init(final String namespace, final OrchestrationCenterConfiguration config) {
}
@Override
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/internal/datasource/OrchestrationShardingSphereDataSourceTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/internal/datasource/OrchestrationShardingSphereDataSourceTest.java
index 83af4d3..dd2cd75 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/internal/datasource/OrchestrationShardingSphereDataSourceTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/internal/datasource/OrchestrationShardingSphereDataSourceTest.java
@@ -71,19 +71,19 @@ public final class OrchestrationShardingSphereDataSourceTest {
}
private static OrchestrationConfiguration getOrchestrationConfiguration() {
- return new OrchestrationConfiguration("test_name", getRegistryCenterConfiguration(), getConfigRepositoryConfiguration(), true);
+ return new OrchestrationConfiguration("test_name", getRegistryCenterConfiguration(), getConfigCenterConfiguration(), true);
}
private static OrchestrationCenterConfiguration getRegistryCenterConfiguration() {
Properties properties = new Properties();
properties.setProperty("overwrite", "true");
- return new OrchestrationCenterConfiguration("REG_TEST", "localhost:3181", "test_sharding_registry", properties);
+ return new OrchestrationCenterConfiguration("REG_TEST", "localhost:3181", properties);
}
- private static OrchestrationCenterConfiguration getConfigRepositoryConfiguration() {
+ private static OrchestrationCenterConfiguration getConfigCenterConfiguration() {
Properties properties = new Properties();
properties.setProperty("overwrite", "true");
- return new OrchestrationCenterConfiguration("CONFIG_TEST", "localhost:3181", "test_sharding_config", properties);
+ return new OrchestrationCenterConfiguration("CONFIG_TEST", "localhost:3181", properties);
}
@Test
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/internal/util/YamlInstanceConfigurationSwapperUtilTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/internal/util/YamlInstanceConfigurationSwapperUtilTest.java
index 480edc5..ac1b70a 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/internal/util/YamlInstanceConfigurationSwapperUtilTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/internal/util/YamlInstanceConfigurationSwapperUtilTest.java
@@ -17,38 +17,39 @@
package org.apache.shardingsphere.driver.orchestration.internal.util;
-import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationConfiguration;
import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationCenterConfiguration;
+import org.apache.shardingsphere.orchestration.repository.common.configuration.config.YamlOrchestrationCenterConfiguration;
import org.apache.shardingsphere.orchestration.repository.common.configuration.config.YamlOrchestrationConfiguration;
-import org.apache.shardingsphere.orchestration.repository.common.configuration.config.YamlOrchestrationRepositoryConfiguration;
import org.junit.Test;
import java.util.Properties;
-import static org.junit.Assert.assertEquals;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
public final class YamlInstanceConfigurationSwapperUtilTest {
@Test
public void marshal() {
- YamlOrchestrationRepositoryConfiguration yamlOrchestrationRepositoryConfiguration = getYamlOrchestrationRepositoryConfiguration();
- YamlOrchestrationConfiguration yamlConfiguration = new YamlOrchestrationConfiguration();
- yamlConfiguration.setName("test");
- yamlConfiguration.setRegistryCenter(yamlOrchestrationRepositoryConfiguration);
- OrchestrationConfiguration orchestrationConfiguration = YamlOrchestrationRepositoryConfigurationSwapperUtil.marshal(yamlConfiguration);
- OrchestrationCenterConfiguration config = orchestrationConfiguration.getRegistryCenterConfiguration();
- assertEquals(config.getType(), yamlOrchestrationRepositoryConfiguration.getType());
- assertEquals(config.getNamespace(), yamlOrchestrationRepositoryConfiguration.getNamespace());
- assertEquals(config.getServerLists(), yamlOrchestrationRepositoryConfiguration.getServerLists());
- assertEquals(config.getProps(), yamlOrchestrationRepositoryConfiguration.getProps());
+ YamlOrchestrationConfiguration expected = createExpectedYamlOrchestrationConfiguration();
+ OrchestrationCenterConfiguration actual = YamlOrchestrationRepositoryConfigurationSwapperUtil.marshal(expected).getRegistryCenterConfiguration();
+ assertThat(actual.getType(), is(expected.getRegistryCenter().getType()));
+ assertThat(actual.getServerLists(), is(expected.getRegistryCenter().getServerLists()));
+ assertThat(actual.getProps(), is(expected.getRegistryCenter().getProps()));
}
- private YamlOrchestrationRepositoryConfiguration getYamlOrchestrationRepositoryConfiguration() {
- YamlOrchestrationRepositoryConfiguration yamlConfiguration = new YamlOrchestrationRepositoryConfiguration();
- yamlConfiguration.setType("zookeeper");
- yamlConfiguration.setNamespace("test");
- yamlConfiguration.setServerLists("localhost:2181");
- yamlConfiguration.setProps(new Properties());
- return yamlConfiguration;
+ private YamlOrchestrationConfiguration createExpectedYamlOrchestrationConfiguration() {
+ YamlOrchestrationConfiguration result = new YamlOrchestrationConfiguration();
+ result.setNamespace("test");
+ result.setRegistryCenter(createYamlOrchestrationRepositoryConfiguration());
+ return result;
+ }
+
+ private YamlOrchestrationCenterConfiguration createYamlOrchestrationRepositoryConfiguration() {
+ YamlOrchestrationCenterConfiguration result = new YamlOrchestrationCenterConfiguration();
+ result.setType("zookeeper");
+ result.setServerLists("localhost:2181");
+ result.setProps(new Properties());
+ return result;
}
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/ms/configWithMasterSlaveDataSourceWithProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/ms/configWithMasterSlaveDataSourceWithProps.yaml
index 7f1e417..24e39a9 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/ms/configWithMasterSlaveDataSourceWithProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/ms/configWithMasterSlaveDataSourceWithProps.yaml
@@ -46,11 +46,10 @@ rules:
- db_slave_1
orchestration:
- name: test_ms_registry_name
+ namespace: test_ms_registry_name
registryCenter:
type: REG_TEST
serverLists: localhost:3181
- namespace: test_ms_registry
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
@@ -59,7 +58,6 @@ orchestration:
additionalConfigCenter:
type: CONFIG_TEST
serverLists: localhost:3181
- namespace: test_ms_config
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/ms/configWithMasterSlaveDataSourceWithoutProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/ms/configWithMasterSlaveDataSourceWithoutProps.yaml
index 1cbf992..24688c7 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/ms/configWithMasterSlaveDataSourceWithoutProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/ms/configWithMasterSlaveDataSourceWithoutProps.yaml
@@ -46,11 +46,10 @@ rules:
- db_slave_1
orchestration:
- name: test_ms_registry_name
+ namespace: test_ms_registry_name
registryCenter:
type: REG_TEST
serverLists: localhost:3181
- namespace: test_ms_registry
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
@@ -59,7 +58,6 @@ orchestration:
additionalConfigCenter:
type: CONFIG_TEST
serverLists: localhost:3181
- namespace: test_ms_center
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
index 61df224..77e5dc8 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
@@ -85,11 +85,10 @@ rules:
type: INCREMENT
orchestration:
- name: test_sharding_registry_name
+ namespace: test_sharding_registry_name
registryCenter:
type: REG_TEST
serverLists: localhost:3181
- namespace: test_sharding_registry
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
@@ -98,7 +97,6 @@ orchestration:
additionalConfigCenter:
type: CONFIG_TEST
serverLists: localhost:3181
- namespace: test_sharding_config
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
index 82c03f4..52bec14 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
@@ -85,11 +85,10 @@ rules:
type: INCREMENT
orchestration:
- name: test_sharding_registry_name
+ namespace: test_sharding_registry_name
registryCenter:
type: REG_TEST
serverLists: localhost:3181
- namespace: test_sharding_registry
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
@@ -98,7 +97,6 @@ orchestration:
additionalConfigCenter:
type: CONFIG_TEST
serverLists: localhost:3181
- namespace: test_sharding_config
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
index 33cba1f..b5f38f9 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
@@ -69,11 +69,10 @@ rules:
type: INCREMENT
orchestration:
- name: test_sharding_registry_name
+ namespace: test_sharding_registry_name
registryCenter:
type: REG_TEST
serverLists: localhost:3181
- namespace: test_sharding_registry
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
@@ -82,7 +81,6 @@ orchestration:
additionalConfigCenter:
type: CONFIG_TEST
serverLists: localhost:3181
- namespace: test_sharding_config
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
index 5cfa6d6..f5c0dc3 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
@@ -71,11 +71,10 @@ rules:
type: INCREMENT
orchestration:
- name: test_sharding_registry_name
+ namespace: test_sharding_registry_name
registryCenter:
type: REG_TEST
serverLists: localhost:3181
- namespace: test_sharding_registry
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
@@ -84,7 +83,6 @@ orchestration:
additionalConfigCenter:
type: CONFIG_TEST
serverLists: localhost:3181
- namespace: test_sharding_config
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithProps.yaml
index 8d8bdaa..fbac582 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithProps.yaml
@@ -119,11 +119,10 @@ rules:
type: ROUND_ROBIN
orchestration:
- name: test_sharding_ms_registry_name
+ namespace: test_sharding_ms_registry_name
registryCenter:
type: REG_TEST
serverLists: localhost:3181
- namespace: test_sharding_ms_registry
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
@@ -132,7 +131,6 @@ orchestration:
additionalConfigCenter:
type: CONFIG_TEST
serverLists: localhost:3181
- namespace: test_sharding_ms_config
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithoutProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithoutProps.yaml
index 4d5aa20e..9a606d1 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithoutProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithoutProps.yaml
@@ -121,11 +121,10 @@ rules:
type: ROUND_ROBIN
orchestration:
- name: test_sharding_ms_registry_name
+ namespace: test_sharding_ms_registry_name
registryCenter:
type: REG_TEST
serverLists: localhost:3181
- namespace: test_sharding_ms_registry
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
@@ -134,7 +133,6 @@ orchestration:
additionalConfigCenter:
type: CONFIG_TEST
serverLists: localhost:3181
- namespace: test_sharding_ms_config
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithoutRules.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithoutRules.yaml
index e5a00f9..5d122a9 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithoutRules.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithoutRules.yaml
@@ -42,11 +42,10 @@ dataSources:
maxTotal: 100
orchestration:
- name: test_sharding_ms_registry_name
+ namespace: test_sharding_ms_registry_name
registryCenter:
type: REG_TEST
serverLists: localhost:3181
- namespace: test_sharding_ms_registry
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
@@ -55,7 +54,6 @@ orchestration:
additionalConfigCenter:
type: CONFIG_TEST
serverLists: localhost:3181
- namespace: test_sharding_ms_config
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithProps.yaml
index 964aa64..dc3fbe2 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithProps.yaml
@@ -82,11 +82,10 @@ rules:
- db1_slave
orchestration:
- name: test_sharding_ms_registry_name
+ namespace: test_sharding_ms_registry_name
registryCenter:
type: REG_TEST
serverLists: localhost:3181
- namespace: test_sharding_ms_registry
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
@@ -95,7 +94,6 @@ orchestration:
additionalConfigCenter:
type: CONFIG_TEST
serverLists: localhost:3181
- namespace: test_sharding_ms_config
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithoutProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithoutProps.yaml
index 4246e88..212af1a 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithoutProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithoutProps.yaml
@@ -86,11 +86,10 @@ rules:
type: ROUND_ROBIN
orchestration:
- name: test_sharding_ms_registry_name
+ namespace: test_sharding_ms_registry_name
registryCenter:
type: REG_TEST
serverLists: localhost:3181
- namespace: test_sharding_ms_registry
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
@@ -99,7 +98,6 @@ orchestration:
additionalConfigCenter:
type: CONFIG_TEST
serverLists: localhost:3181
- namespace: test_sharding_ms_config
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/unit/encryptWithRegistryCenter.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/unit/encryptWithRegistryCenter.yaml
index b81a72e..4ef13d2 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/unit/encryptWithRegistryCenter.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/unit/encryptWithRegistryCenter.yaml
@@ -16,11 +16,10 @@
#
orchestration:
- name: test_encrypt_registry_name
+ namespace: test_encrypt_registry_name
registryCenter:
type: REG_TEST
serverLists: localhost:3181
- namespace: test_encrypt_registry
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
maxRetries: 10
@@ -28,7 +27,6 @@ orchestration:
additionalConfigCenter:
type: CONFIG_TEST
serverLists: localhost:3181
- namespace: test_encrypt_config
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
maxRetries: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/unit/noRule.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/unit/noRule.yaml
index 888f21f..f85c9d3 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/unit/noRule.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/resources/yaml/unit/noRule.yaml
@@ -16,11 +16,10 @@
#
orchestration:
- name: test_encrypt_registry_name
+ namespace: test_encrypt_registry_name
registryCenter:
type: REG_TEST
serverLists: localhost:3181
- namespace: test_encrypt_registry_no
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
@@ -29,7 +28,6 @@ orchestration:
additionalConfigCenter:
type: CONFIG_TEST
serverLists: localhost:3181
- namespace: test_encrypt_config_no
props:
retryIntervalMilliseconds: 10
timeToLiveSeconds: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/main/java/org/apache/shardingsphere/spring/boot/orchestration/OrchestrationSpringBootConfiguration.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/main/java/org/apache/shardingsphere/spring/boot/orchestration/OrchestrationSpringB [...]
index d3535d5..3d721e2 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/main/java/org/apache/shardingsphere/spring/boot/orchestration/OrchestrationSpringBootConfiguration.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/main/java/org/apache/shardingsphere/spring/boot/orchestration/OrchestrationSpringBootConfiguration.java
@@ -25,7 +25,7 @@ import org.apache.shardingsphere.driver.orchestration.internal.datasource.Orches
import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationConfiguration;
import org.apache.shardingsphere.orchestration.repository.common.configuration.config.YamlOrchestrationConfiguration;
-import org.apache.shardingsphere.orchestration.repository.common.configuration.swapper.OrchestrationRepositoryConfigurationYamlSwapper;
+import org.apache.shardingsphere.orchestration.repository.common.configuration.swapper.OrchestrationCenterConfigurationYamlSwapper;
import org.apache.shardingsphere.spring.boot.datasource.DataSourceMapSetter;
import org.apache.shardingsphere.spring.boot.orchestration.common.OrchestrationSpringBootRootConfiguration;
import org.apache.shardingsphere.spring.boot.orchestration.rule.LocalRulesCondition;
@@ -68,7 +68,7 @@ public class OrchestrationSpringBootConfiguration implements EnvironmentAware {
private final OrchestrationSpringBootRootConfiguration root;
- private final OrchestrationRepositoryConfigurationYamlSwapper swapper = new OrchestrationRepositoryConfigurationYamlSwapper();
+ private final OrchestrationCenterConfigurationYamlSwapper swapper = new OrchestrationCenterConfigurationYamlSwapper();
/**
* Get orchestration configuration.
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
index 43b325a..b21a4d9 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/main/resources/META-INF/additional-spring-configuration-metadata.json
@@ -77,7 +77,7 @@
},
{
"name": "spring.shardingsphere.orchestration",
- "type": "java.util.Map<java.lang.String,org.apache.shardingsphere.orchestration.repository.common.configuration.config.YamlOrchestrationRepositoryConfiguration>",
+ "type": "java.util.Map<java.lang.String,org.apache.shardingsphere.orchestration.repository.common.configuration.config.YamlOrchestrationCenterConfiguration>",
"sourceType": "org.apache.shardingsphere.spring.boot.orchestration.common.OrchestrationSpringBootRootConfiguration",
"description": "Customize ShardingSphere orchestration instance."
},
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/orchestration/registry/TestOrchestrationRepository.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/orchestration/registry/TestOrchest [...]
index e709553..3088c06 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/orchestration/registry/TestOrchestrationRepository.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/orchestration/registry/TestOrchestrationRepository.java
@@ -39,7 +39,7 @@ public final class TestOrchestrationRepository implements RegistryRepository, Co
private Properties props = new Properties();
@Override
- public void init(final OrchestrationCenterConfiguration config) {
+ public void init(final String namespace, final OrchestrationCenterConfiguration config) {
}
@Override
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/orchestration/constants/OrchestrationCenterConfigurationBeanDefinitionTag.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/orchest [...]
index 655eacd..5d219a6 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/orchestration/constants/OrchestrationCenterConfigurationBeanDefinitionTag.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/orchestration/constants/OrchestrationCenterConfigurationBeanDefinitionTag.java
@@ -32,7 +32,5 @@ public final class OrchestrationCenterConfigurationBeanDefinitionTag {
public static final String SERVER_LISTS_ATTRIBUTE = "server-lists";
- public static final String NAMESPACE_ATTRIBUTE = "namespace";
-
public static final String PROP_TAG = "props";
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/orchestration/parser/OrchestrationCenterConfigurationBeanDefinitionParser.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/orchest [...]
index 5b971f7..4cfdcef 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/orchestration/parser/OrchestrationCenterConfigurationBeanDefinitionParser.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/orchestration/parser/OrchestrationCenterConfigurationBeanDefinitionParser.java
@@ -38,7 +38,6 @@ public final class OrchestrationCenterConfigurationBeanDefinitionParser extends
BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(OrchestrationCenterConfiguration.class);
factory.addConstructorArgValue(element.getAttribute(OrchestrationCenterConfigurationBeanDefinitionTag.TYPE_ATTRIBUTE));
factory.addConstructorArgValue(element.getAttribute(OrchestrationCenterConfigurationBeanDefinitionTag.SERVER_LISTS_ATTRIBUTE));
- factory.addConstructorArgValue(element.getAttribute(OrchestrationCenterConfigurationBeanDefinitionTag.NAMESPACE_ATTRIBUTE));
factory.addConstructorArgValue(parseProperties(element, parserContext));
return factory.getBeanDefinition();
}
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/registry/TestOrchestrationRepository.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/registry/TestOrc [...]
index 5074e30..d84786e 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/registry/TestOrchestrationRepository.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/registry/TestOrchestrationRepository.java
@@ -35,7 +35,7 @@ public final class TestOrchestrationRepository implements RegistryRepository, Co
private Properties props = new Properties();
@Override
- public void init(final OrchestrationCenterConfiguration config) {
+ public void init(final String namespace, final OrchestrationCenterConfiguration config) {
}
@Override
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml
index 81dd39c..50c0ff9 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml
@@ -22,11 +22,10 @@
######################################################################################################
#
#orchestration:
-# name: orchestration_ds
+# namespace: orchestration_ds
# registryCenter:
# type: zookeeper
# serverLists: localhost:2181
-# namespace: orchestration
# props:
# retryIntervalMilliseconds: 500
# timeToLiveSeconds: 60
diff --git a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/ShardingConfigurationLoaderTest.java b/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/ShardingConfigurationLoaderTest.java
index ad40086..e69baa8 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/ShardingConfigurationLoaderTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/ShardingConfigurationLoaderTest.java
@@ -21,8 +21,6 @@ import org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguratio
import org.apache.shardingsphere.infra.yaml.config.algorithm.YamlShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.masterslave.yaml.config.YamlMasterSlaveRuleConfiguration;
import org.apache.shardingsphere.masterslave.yaml.config.rule.YamlMasterSlaveDataSourceRuleConfiguration;
-import org.apache.shardingsphere.orchestration.repository.common.configuration.config.YamlOrchestrationConfiguration;
-import org.apache.shardingsphere.orchestration.repository.common.configuration.config.YamlOrchestrationRepositoryConfiguration;
import org.apache.shardingsphere.proxy.config.yaml.YamlDataSourceParameter;
import org.apache.shardingsphere.proxy.config.yaml.YamlProxyRuleConfiguration;
import org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration;
@@ -44,19 +42,13 @@ public final class ShardingConfigurationLoaderTest {
@Test
public void assertLoad() throws IOException {
ShardingConfiguration actual = new ShardingConfigurationLoader().load("/conf/");
- assertOrchestrationConfiguration(actual.getServerConfiguration().getOrchestration());
+ assertThat(actual.getServerConfiguration().getOrchestration().getRegistryCenter().getServerLists(), is("localhost:2181"));
assertThat(actual.getRuleConfigurationMap().size(), is(3));
assertShardingRuleConfiguration(actual.getRuleConfigurationMap().get("sharding_db"));
assertMasterSlaveRuleConfiguration(actual.getRuleConfigurationMap().get("master_slave_db"));
assertEncryptRuleConfiguration(actual.getRuleConfigurationMap().get("encrypt_db"));
}
- private void assertOrchestrationConfiguration(final YamlOrchestrationConfiguration orchestration) {
- YamlOrchestrationRepositoryConfiguration actual = orchestration.getRegistryCenter();
- assertThat(actual.getNamespace(), is("test_namespace_1"));
- assertThat(actual.getServerLists(), is("localhost:2181"));
- }
-
private void assertShardingRuleConfiguration(final YamlProxyRuleConfiguration actual) {
assertThat(actual.getSchemaName(), is("sharding_db"));
assertThat(actual.getDataSources().size(), is(2));
diff --git a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/resources/conf/server.yaml b/shardingsphere-proxy/shardingsphere-proxy-common/src/test/resources/conf/server.yaml
index 9487642..2cba326 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/resources/conf/server.yaml
+++ b/shardingsphere-proxy/shardingsphere-proxy-common/src/test/resources/conf/server.yaml
@@ -16,11 +16,10 @@
#
orchestration:
- name: test_name_1
+ namespace: test_name_1
registryCenter:
type: zookeeper
serverLists: localhost:2181
- namespace: test_namespace_1
overwrite: false
authentication:
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/position/resume/ZookeeperResumablePositionManager.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/position/resume/ZookeeperResumablePositionManager.java
index 5f2f045..9d77ed6 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/position/resume/ZookeeperResumablePositionManager.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/position/resume/ZookeeperResumablePositionManager.java
@@ -49,7 +49,7 @@ public final class ZookeeperResumablePositionManager extends AbstractResumablePo
public ZookeeperResumablePositionManager() {
ResumeConfiguration resumeConfiguration = ScalingContext.getInstance().getServerConfiguration().getResumeConfiguration();
if (null != resumeConfiguration) {
- ZOOKEEPER.init(getCenterConfiguration(resumeConfiguration));
+ ZOOKEEPER.init(resumeConfiguration.getNamespace(), getCenterConfiguration(resumeConfiguration));
log.info("zookeeper resumable position manager is available.");
setAvailable(true);
}
@@ -67,9 +67,7 @@ public final class ZookeeperResumablePositionManager extends AbstractResumablePo
}
private OrchestrationCenterConfiguration getCenterConfiguration(final ResumeConfiguration resumeConfiguration) {
- OrchestrationCenterConfiguration centerConfiguration =
- new OrchestrationCenterConfiguration("zookeeper", resumeConfiguration.getServerLists(), resumeConfiguration.getNamespace(), new Properties());
- return centerConfiguration;
+ return new OrchestrationCenterConfiguration("zookeeper", resumeConfiguration.getServerLists(), new Properties());
}
@Override