This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 64f67c6 remove apollo configCenter support (#9577)
64f67c6 is described below
commit 64f67c6ee769a05fcb9dcf77439857ec458feaba
Author: xiaoyu <[email protected]>
AuthorDate: Wed Mar 3 19:39:44 2021 +0800
remove apollo configCenter support (#9577)
---
.../repository/GovernanceRepositoryFacade.java | 15 +-
.../yaml/config/YamlGovernanceConfiguration.java | 2 -
.../GovernanceConfigurationYamlSwapper.java | 11 +-
.../repository/GovernanceRepositoryFacadeTest.java | 43 ------
.../GovernanceConfigurationYamlSwapperTest.java | 23 +--
.../api/config/GovernanceConfiguration.java | 17 ---
.../pom.xml | 1 -
.../pom.xml | 60 --------
.../repository/apollo/ApolloProperties.java | 32 -----
.../repository/apollo/ApolloPropertyKey.java | 78 ----------
.../repository/apollo/ApolloRepository.java | 134 ------------------
.../apollo/wrapper/ApolloConfigWrapper.java | 82 -----------
.../apollo/wrapper/ApolloOpenApiWrapper.java | 107 --------------
...vernance.repository.api.ConfigurationRepository | 18 ---
.../repository/apollo/ApolloPropertiesTest.java | 63 ---------
.../repository/apollo/ApolloRepositoryTest.java | 157 ---------------------
.../apollo/wrapper/ApolloConfigWrapperTest.java | 89 ------------
.../apollo/wrapper/ApolloOpenApiWrapperTest.java | 100 -------------
.../src/test/resources/logback-test.xml | 36 -----
.../test/resources/mockdata-governance.properties | 22 ---
...vernanceRepositoryConfigurationSwapperUtil.java | 6 +-
.../GovernanceShardingSphereDataSourceTest.java | 8 +-
.../configWithReplicaQueryDataSourceWithProps.yaml | 8 --
...nfigWithReplicaQueryDataSourceWithoutProps.yaml | 8 --
.../sharding/configWithDataSourceWithProps.yaml | 8 --
.../sharding/configWithDataSourceWithoutProps.yaml | 8 --
.../sharding/configWithoutDataSourceWithProps.yaml | 8 --
.../configWithoutDataSourceWithoutProps.yaml | 8 --
.../configWithDataSourceWithProps.yaml | 8 --
.../configWithDataSourceWithoutProps.yaml | 8 --
.../configWithDataSourceWithoutRules.yaml | 8 --
.../configWithoutDataSourceWithProps.yaml | 8 --
.../configWithoutDataSourceWithoutProps.yaml | 8 --
.../src/test/resources/yaml/unit/sharding.yaml | 4 -
.../ShardingSphereGovernanceAutoConfiguration.java | 6 +-
.../constants/DataSourceBeanDefinitionTag.java | 2 -
...rnanceCenterConfigurationBeanDefinitionTag.java | 2 -
.../handler/GovernanceNamespaceHandler.java | 1 -
.../parser/DataSourceBeanDefinitionParser.java | 3 -
.../resources/META-INF/namespace/governance.xsd | 11 --
.../src/test/resources/conf/local/server.yaml | 8 --
.../src/test/resources/conf/reg_center/server.yaml | 8 --
.../swapper/YamlProxyConfigurationSwapperTest.java | 12 --
43 files changed, 7 insertions(+), 1242 deletions(-)
diff --git
a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/facade/repository/GovernanceRepositoryFacade.java
b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/facade/repository/GovernanceRepositoryFacade.java
index 671cd7d..ef9014d 100644
---
a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/facade/repository/GovernanceRepositoryFacade.java
+++
b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/facade/repository/GovernanceRepositoryFacade.java
@@ -43,7 +43,7 @@ public final class GovernanceRepositoryFacade implements
AutoCloseable {
public GovernanceRepositoryFacade(final GovernanceConfiguration config) {
registryRepository = createRegistryRepository(config);
- configurationRepository = createConfigurationRepository(config);
+ configurationRepository = (ConfigurationRepository) registryRepository;
}
private RegistryRepository createRegistryRepository(final
GovernanceConfiguration config) {
@@ -54,19 +54,6 @@ public final class GovernanceRepositoryFacade implements
AutoCloseable {
return result;
}
- private ConfigurationRepository createConfigurationRepository(final
GovernanceConfiguration config) {
- if (config.getAdditionalConfigCenterConfiguration().isPresent()) {
- GovernanceCenterConfiguration additionalConfigCenterConfig =
config.getAdditionalConfigCenterConfiguration().get();
- ConfigurationRepository result =
TypedSPIRegistry.getRegisteredService(ConfigurationRepository.class,
additionalConfigCenterConfig.getType(),
additionalConfigCenterConfig.getProps());
- result.init(config.getName(), additionalConfigCenterConfig);
- return result;
- }
- if (registryRepository instanceof ConfigurationRepository) {
- return (ConfigurationRepository) registryRepository;
- }
- throw new IllegalArgumentException("Registry repository is not
suitable for config center and no additional config center configuration
provided.");
- }
-
@Override
public void close() {
registryRepository.close();
diff --git
a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/yaml/config/YamlGovernanceConfiguration.java
b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/yaml/config/YamlGovernanceConfiguration.java
index b9736cb..4af1cc0 100644
---
a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/yaml/config/YamlGovernanceConfiguration.java
+++
b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/yaml/config/YamlGovernanceConfiguration.java
@@ -32,7 +32,5 @@ public final class YamlGovernanceConfiguration implements
YamlConfiguration {
private YamlGovernanceCenterConfiguration registryCenter;
- private YamlGovernanceCenterConfiguration additionalConfigCenter;
-
private boolean overwrite;
}
diff --git
a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/yaml/swapper/GovernanceConfigurationYamlSwapper.java
b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/yaml/swapper/GovernanceConfigurationYamlSwapper.java
index e302f6a..722c555 100644
---
a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/yaml/swapper/GovernanceConfigurationYamlSwapper.java
+++
b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/yaml/swapper/GovernanceConfigurationYamlSwapper.java
@@ -34,19 +34,12 @@ public final class GovernanceConfigurationYamlSwapper
implements YamlConfigurati
YamlGovernanceConfiguration result = new YamlGovernanceConfiguration();
result.setName(data.getName());
result.setRegistryCenter(governanceCenterConfigurationSwapper.swapToYamlConfiguration(data.getRegistryCenterConfiguration()));
- if (data.getAdditionalConfigCenterConfiguration().isPresent()) {
-
result.setAdditionalConfigCenter(governanceCenterConfigurationSwapper.swapToYamlConfiguration(data.getAdditionalConfigCenterConfiguration().get()));
- }
return result;
}
@Override
public GovernanceConfiguration swapToObject(final
YamlGovernanceConfiguration yamlConfig) {
- GovernanceCenterConfiguration registryCenter =
governanceCenterConfigurationSwapper.swapToObject(yamlConfig.getRegistryCenter());
- if (null == yamlConfig.getAdditionalConfigCenter()) {
- return new GovernanceConfiguration(yamlConfig.getName(),
registryCenter, yamlConfig.isOverwrite());
- }
- GovernanceCenterConfiguration additionalConfigCenter =
governanceCenterConfigurationSwapper.swapToObject(yamlConfig.getAdditionalConfigCenter());
- return new GovernanceConfiguration(yamlConfig.getName(),
registryCenter, additionalConfigCenter, yamlConfig.isOverwrite());
+ GovernanceCenterConfiguration governanceCenterConfiguration =
governanceCenterConfigurationSwapper.swapToObject(yamlConfig.getRegistryCenter());
+ return new GovernanceConfiguration(yamlConfig.getName(),
governanceCenterConfiguration, yamlConfig.isOverwrite());
}
}
diff --git
a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/facade/repository/GovernanceRepositoryFacadeTest.java
b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/facade/repository/GovernanceRepositoryFacadeTest.java
index 92f7376..aed0728 100644
---
a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/facade/repository/GovernanceRepositoryFacadeTest.java
+++
b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/facade/repository/GovernanceRepositoryFacadeTest.java
@@ -17,10 +17,6 @@
package org.apache.shardingsphere.governance.core.facade.repository;
-import
org.apache.shardingsphere.governance.core.facade.fixture.TestAllRepository;
-import org.apache.shardingsphere.governance.core.facade.util.FieldUtil;
-import
org.apache.shardingsphere.governance.repository.api.ConfigurationRepository;
-import org.apache.shardingsphere.governance.repository.api.RegistryRepository;
import
org.apache.shardingsphere.governance.repository.api.config.GovernanceCenterConfiguration;
import
org.apache.shardingsphere.governance.repository.api.config.GovernanceConfiguration;
import org.junit.Test;
@@ -28,10 +24,7 @@ import org.junit.Test;
import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
public final class GovernanceRepositoryFacadeTest {
@@ -41,40 +34,4 @@ public final class GovernanceRepositoryFacadeTest {
new GovernanceConfiguration("test", new
GovernanceCenterConfiguration("ALL", "127.0.0.1:8888", new Properties()),
true));
assertThat(actual.getRegistryRepository(),
is(actual.getConfigurationRepository()));
}
-
- @Test
- public void assertNewWithAdditionalConfigurationRepository() {
- GovernanceRepositoryFacade actual = new GovernanceRepositoryFacade(new
GovernanceConfiguration("test",
- new GovernanceCenterConfiguration("ALL", "127.0.0.1:8888", new
Properties()), new GovernanceCenterConfiguration("CONFIG", "127.0.0.1:9999",
new Properties()), true));
- assertThat(actual.getRegistryRepository(),
not(actual.getConfigurationRepository()));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void
assertNewWithoutAdditionalConfigurationRepositoryAndInvalidRegistryRepository()
{
- new GovernanceRepositoryFacade(new GovernanceConfiguration("test", new
GovernanceCenterConfiguration("REG", "127.0.0.1:8888", new Properties()),
true));
- }
-
- @Test
- public void assertCloseWithoutAdditionalConfigurationRepository() {
- GovernanceRepositoryFacade actual = new GovernanceRepositoryFacade(
- new GovernanceConfiguration("test", new
GovernanceCenterConfiguration("ALL", "127.0.0.1:8888", new Properties()),
true));
- TestAllRepository repository = mock(TestAllRepository.class);
- FieldUtil.setField(actual, "registryRepository", repository);
- FieldUtil.setField(actual, "configurationRepository", repository);
- actual.close();
- verify(repository).close();
- }
-
- @Test
- public void assertCloseWithAdditionalConfigurationRepository() {
- GovernanceRepositoryFacade actual = new GovernanceRepositoryFacade(new
GovernanceConfiguration("test",
- new GovernanceCenterConfiguration("ALL", "127.0.0.1:8888", new
Properties()), new GovernanceCenterConfiguration("CONFIG", "127.0.0.1:9999",
new Properties()), true));
- RegistryRepository registryRepository = mock(RegistryRepository.class);
- ConfigurationRepository configurationRepository =
mock(ConfigurationRepository.class);
- FieldUtil.setField(actual, "registryRepository", registryRepository);
- FieldUtil.setField(actual, "configurationRepository",
configurationRepository);
- actual.close();
- verify(registryRepository).close();
- verify(configurationRepository).close();
- }
}
diff --git
a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/yaml/swapper/GovernanceConfigurationYamlSwapperTest.java
b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/yaml/swapper/GovernanceConfigurationYamlSwapperTest.java
index ba8a86b..1feaa11 100644
---
a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/yaml/swapper/GovernanceConfigurationYamlSwapperTest.java
+++
b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/yaml/swapper/GovernanceConfigurationYamlSwapperTest.java
@@ -26,9 +26,7 @@ import org.junit.Test;
import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
public final class GovernanceConfigurationYamlSwapperTest {
@@ -41,7 +39,6 @@ public final class GovernanceConfigurationYamlSwapperTest {
assertThat(actual.getRegistryCenter().getType(),
is(expected.getRegistryCenterConfiguration().getType()));
assertThat(actual.getRegistryCenter().getServerLists(),
is(expected.getRegistryCenterConfiguration().getServerLists()));
assertThat(actual.getRegistryCenter().getProps(),
is(expected.getRegistryCenterConfiguration().getProps()));
-
assertFalse(expected.getAdditionalConfigCenterConfiguration().isPresent());
}
private GovernanceConfiguration
createGovernanceConfigurationWithoutAdditionalConfigCenterConfiguration() {
@@ -57,15 +54,11 @@ public final class GovernanceConfigurationYamlSwapperTest {
assertThat(actual.getRegistryCenter().getType(),
is(expected.getRegistryCenterConfiguration().getType()));
assertThat(actual.getRegistryCenter().getServerLists(),
is(expected.getRegistryCenterConfiguration().getServerLists()));
assertThat(actual.getRegistryCenter().getProps(),
is(expected.getRegistryCenterConfiguration().getProps()));
-
assertTrue(expected.getAdditionalConfigCenterConfiguration().isPresent());
- assertThat(actual.getAdditionalConfigCenter().getType(),
is(expected.getAdditionalConfigCenterConfiguration().get().getType()));
- assertThat(actual.getAdditionalConfigCenter().getServerLists(),
is(expected.getAdditionalConfigCenterConfiguration().get().getServerLists()));
- assertThat(actual.getAdditionalConfigCenter().getProps(),
is(expected.getAdditionalConfigCenterConfiguration().get().getProps()));
}
private GovernanceConfiguration
createGovernanceConfigurationWithAdditionalConfigCenterConfiguration() {
return new GovernanceConfiguration("logic_schema",
- new GovernanceCenterConfiguration("TEST", "127.0.0.1:2181",
new Properties()), new GovernanceCenterConfiguration("ADDITIONAL",
"127.0.0.1:2181", new Properties()), false);
+ new GovernanceCenterConfiguration("TEST", "127.0.0.1:2181",
new Properties()), false);
}
@Test
@@ -77,7 +70,6 @@ public final class GovernanceConfigurationYamlSwapperTest {
assertThat(actual.getRegistryCenterConfiguration().getType(),
is(expected.getRegistryCenter().getType()));
assertThat(actual.getRegistryCenterConfiguration().getServerLists(),
is(expected.getRegistryCenter().getServerLists()));
assertThat(actual.getRegistryCenterConfiguration().getProps(),
is(expected.getRegistryCenter().getProps()));
-
assertFalse(actual.getAdditionalConfigCenterConfiguration().isPresent());
}
private YamlGovernanceConfiguration
createYamlGovernanceConfigurationWithoutAdditionalConfigCenterConfiguration() {
@@ -96,17 +88,12 @@ public final class GovernanceConfigurationYamlSwapperTest {
assertThat(actual.getRegistryCenterConfiguration().getType(),
is(expected.getRegistryCenter().getType()));
assertThat(actual.getRegistryCenterConfiguration().getServerLists(),
is(expected.getRegistryCenter().getServerLists()));
assertThat(actual.getRegistryCenterConfiguration().getProps(),
is(expected.getRegistryCenter().getProps()));
-
assertTrue(actual.getAdditionalConfigCenterConfiguration().isPresent());
-
assertThat(actual.getAdditionalConfigCenterConfiguration().get().getType(),
is(expected.getAdditionalConfigCenter().getType()));
-
assertThat(actual.getAdditionalConfigCenterConfiguration().get().getServerLists(),
is(expected.getAdditionalConfigCenter().getServerLists()));
-
assertThat(actual.getAdditionalConfigCenterConfiguration().get().getProps(),
is(expected.getAdditionalConfigCenter().getProps()));
}
private YamlGovernanceConfiguration
createYamlGovernanceConfigurationWithAdditionalConfigCenterConfiguration() {
YamlGovernanceConfiguration result = new YamlGovernanceConfiguration();
result.setName("logic_schema");
result.setRegistryCenter(createYamlRegistryCenterConfiguration());
-
result.setAdditionalConfigCenter(createYamlAdditionalConfigCenterConfiguration());
return result;
}
@@ -117,12 +104,4 @@ public final class GovernanceConfigurationYamlSwapperTest {
result.setServerLists("127.0.0.1:2181");
return result;
}
-
- private YamlGovernanceCenterConfiguration
createYamlAdditionalConfigCenterConfiguration() {
- YamlGovernanceCenterConfiguration result = new
YamlGovernanceCenterConfiguration();
- result.setType("ADDITIONAL");
- result.setProps(new Properties());
- result.setServerLists("127.0.0.1:2182");
- return result;
- }
}
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/GovernanceConfiguration.java
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/GovernanceConfiguration.java
index 03dd985..a7fb013 100644
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/GovernanceConfiguration.java
+++
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-api/src/main/java/org/apache/shardingsphere/governance/repository/api/config/GovernanceConfiguration.java
@@ -20,8 +20,6 @@ package
org.apache.shardingsphere.governance.repository.api.config;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import java.util.Optional;
-
/**
* Governance configuration.
*/
@@ -33,20 +31,5 @@ public final class GovernanceConfiguration {
private final GovernanceCenterConfiguration registryCenterConfiguration;
- private final GovernanceCenterConfiguration
additionalConfigCenterConfiguration;
-
private final boolean overwrite;
-
- public GovernanceConfiguration(final String name, final
GovernanceCenterConfiguration governanceCenterConfig, final boolean overwrite) {
- this(name, governanceCenterConfig, null, overwrite);
- }
-
- /**
- * Get additional config center configuration.
- *
- * @return additional config center configuration
- */
- public Optional<GovernanceCenterConfiguration>
getAdditionalConfigCenterConfiguration() {
- return Optional.ofNullable(additionalConfigCenterConfiguration);
- }
}
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/pom.xml
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/pom.xml
index cab2dc1..bd9fd63 100644
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/pom.xml
+++
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/pom.xml
@@ -31,6 +31,5 @@
<module>shardingsphere-governance-repository-zookeeper-curator</module>
<module>shardingsphere-governance-repository-etcd</module>
<module>shardingsphere-governance-repository-nacos</module>
- <module>shardingsphere-governance-repository-apollo</module>
</modules>
</project>
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/pom.xml
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/pom.xml
deleted file mode 100644
index 4a2989c..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/pom.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-governance-repository-provider</artifactId>
- <version>5.0.0-RC1-SNAPSHOT</version>
- </parent>
- <artifactId>shardingsphere-governance-repository-apollo</artifactId>
- <name>${project.artifactId}</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-governance-repository-api</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.ctrip.framework.apollo</groupId>
- <artifactId>apollo-client</artifactId>
- <version>${apollo.client.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.ctrip.framework.apollo</groupId>
- <artifactId>apollo-openapi</artifactId>
- <version>${apollo.client.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jul-to-slf4j</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.ctrip.framework.apollo</groupId>
- <artifactId>apollo-mockserver</artifactId>
- <version>${apollo.client.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/ApolloProperties.java
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/ApolloProper
[...]
deleted file mode 100644
index 471be39..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/ApolloProperties.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.governance.repository.apollo;
-
-import org.apache.shardingsphere.infra.properties.TypedProperties;
-
-import java.util.Properties;
-
-/**
- * Typed properties of Apollo.
- */
-public final class ApolloProperties extends TypedProperties<ApolloPropertyKey>
{
-
- public ApolloProperties(final Properties props) {
- super(ApolloPropertyKey.class, props);
- }
-}
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/ApolloPropertyKey.java
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/ApolloPrope
[...]
deleted file mode 100644
index db9a43e..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/ApolloPropertyKey.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.governance.repository.apollo;
-
-import com.ctrip.framework.apollo.core.ConfigConsts;
-import
com.ctrip.framework.apollo.openapi.client.constant.ApolloOpenApiConstants;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.properties.TypedPropertyKey;
-
-/**
- * Typed property key of Apollo.
- */
-@RequiredArgsConstructor
-@Getter
-public enum ApolloPropertyKey implements TypedPropertyKey {
-
- /**
- * Apollo config client app id param.
- */
- APP_ID("appId", "APOLLO_SHARDINGSPHERE", String.class),
-
- /**
- * Apollo system environment param.
- */
- ENV("env", "DEV", String.class),
-
- /**
- * Apollo system cluster name.
- */
- CLUSTER_NAME("clusterName", ConfigConsts.CLUSTER_NAME_DEFAULT,
String.class),
-
- /**
- * The administrator's name within the right of modify data for apollo
open api client.
- */
- ADMINISTRATOR("administrator", "", String.class),
-
- /**
- * The token value for apollo open api client.
- */
- TOKEN("token", "", String.class),
-
- /**
- * The portal url for apollo open api client.
- */
- PORTAL_URL("portalUrl", "", String.class),
-
- /**
- * The connection timeout value for apollo open api client.
- */
- CONNECT_TIMEOUT("connectTimeout",
String.valueOf(ApolloOpenApiConstants.DEFAULT_CONNECT_TIMEOUT), int.class),
-
- /**
- * The read timeout value for apollo open api client.
- */
- READ_TIMEOUT("readTimeout",
String.valueOf(ApolloOpenApiConstants.DEFAULT_READ_TIMEOUT), int.class);
-
- private final String key;
-
- private final String defaultValue;
-
- private final Class<?> type;
-}
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/ApolloRepository.java
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/ApolloReposi
[...]
deleted file mode 100644
index ada2f6b..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/ApolloRepository.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.governance.repository.apollo;
-
-import com.ctrip.framework.apollo.ConfigChangeListener;
-import com.ctrip.framework.apollo.enums.PropertyChangeType;
-import com.ctrip.framework.apollo.model.ConfigChange;
-import com.google.common.base.Strings;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.extern.slf4j.Slf4j;
-import
org.apache.shardingsphere.governance.repository.api.ConfigurationRepository;
-import
org.apache.shardingsphere.governance.repository.api.config.GovernanceCenterConfiguration;
-import
org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent;
-import
org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent.Type;
-import
org.apache.shardingsphere.governance.repository.api.listener.DataChangedEventListener;
-import
org.apache.shardingsphere.governance.repository.apollo.wrapper.ApolloConfigWrapper;
-import
org.apache.shardingsphere.governance.repository.apollo.wrapper.ApolloOpenApiWrapper;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * Configuration repository for Apollo.
- */
-@Slf4j
-public final class ApolloRepository implements ConfigurationRepository {
-
- private final Map<String, DataChangedEventListener> caches = new
HashMap<>();
-
- private ApolloConfigWrapper configWrapper;
-
- private ApolloOpenApiWrapper openApiWrapper;
-
- @Getter
- @Setter
- private Properties props = new Properties();
-
- @Override
- public void init(final String name, final GovernanceCenterConfiguration
config) {
- ApolloProperties apolloProperties = new ApolloProperties(props);
- configWrapper = new ApolloConfigWrapper(name, config,
apolloProperties);
- openApiWrapper = new ApolloOpenApiWrapper(name, apolloProperties);
- }
-
- @Override
- public String get(final String key) {
- String value = configWrapper.getProperty(pathToKey(key));
- return Strings.isNullOrEmpty(value) ?
openApiWrapper.getValue(pathToKey(key)) : value;
- }
-
- @Override
- public List<String> getChildrenKeys(final String key) {
- return null;
- }
-
- @Override
- public void persist(final String key, final String value) {
- openApiWrapper.persist(pathToKey(key), value);
- }
-
- @Override
- public void delete(final String key) {
- openApiWrapper.remove(pathToKey(key));
- }
-
- @Override
- public void watch(final String key, final DataChangedEventListener
dataChangedEventListener) {
- String apolloKey = pathToKey(key);
- caches.put(apolloKey, dataChangedEventListener);
- ConfigChangeListener listener = changeEvent -> {
- for (String changeKey : changeEvent.changedKeys()) {
- ConfigChange change = changeEvent.getChange(changeKey);
- Type type = getChangedType(change.getChangeType());
- if (Type.IGNORED == type) {
- continue;
- }
- if (!caches.containsKey(changeKey)) {
- continue;
- }
- caches.get(changeKey).onChange(new
DataChangedEvent(keyToPath(changeKey), change.getNewValue(), type));
- }
- };
- configWrapper.addChangeListener(listener,
Collections.singleton(apolloKey), Collections.singleton(apolloKey));
- }
-
- private Type getChangedType(final PropertyChangeType changeType) {
- switch (changeType) {
- case ADDED:
- case MODIFIED:
- return Type.UPDATED;
- case DELETED:
- return Type.DELETED;
- default:
- return Type.IGNORED;
- }
- }
-
- private String pathToKey(final String path) {
- String key = path.replace(PATH_SEPARATOR, DOT_SEPARATOR);
- return key.substring(key.indexOf(DOT_SEPARATOR) + 1);
- }
-
- private String keyToPath(final String key) {
- return PATH_SEPARATOR + key.replace(DOT_SEPARATOR, PATH_SEPARATOR);
- }
-
- @Override
- public void close() {
- }
-
- @Override
- public String getType() {
- return "Apollo";
- }
-}
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/wrapper/ApolloConfigWrapper.java
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/w
[...]
deleted file mode 100644
index c4d67a7..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/wrapper/ApolloConfigWrapper.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.governance.repository.apollo.wrapper;
-
-import com.ctrip.framework.apollo.Config;
-import com.ctrip.framework.apollo.ConfigChangeListener;
-import com.ctrip.framework.apollo.ConfigService;
-import com.ctrip.framework.apollo.core.ConfigConsts;
-import org.apache.shardingsphere.governance.repository.apollo.ApolloProperties;
-import
org.apache.shardingsphere.governance.repository.apollo.ApolloPropertyKey;
-import
org.apache.shardingsphere.governance.repository.api.config.GovernanceCenterConfiguration;
-
-import java.util.Set;
-
-/**
- * Apollo config wrapper.
- */
-public final class ApolloConfigWrapper {
-
- private static final String APOLLO_KEY_APP_ID = "app.id";
-
- private static final String APOLLO_KEY_ENV = "env";
-
- private final Config apolloConfig;
-
- public ApolloConfigWrapper(final String namespace, final
GovernanceCenterConfiguration config, final ApolloProperties props) {
- String appId = props.getValue(ApolloPropertyKey.APP_ID);
- String env = props.getValue(ApolloPropertyKey.ENV);
- String clusterName = props.getValue(ApolloPropertyKey.CLUSTER_NAME);
- System.setProperty(APOLLO_KEY_APP_ID, appId);
- System.setProperty(APOLLO_KEY_ENV, env);
- System.setProperty(ConfigConsts.APOLLO_CLUSTER_KEY, clusterName);
- System.setProperty(ConfigConsts.APOLLO_META_KEY,
config.getServerLists());
- apolloConfig = ConfigService.getConfig(namespace);
- }
-
- /**
- * Get property.
- *
- * @param key key
- * @return value
- */
- public String getProperty(final String key) {
- return apolloConfig.getProperty(key, "");
- }
-
- /**
- * Add config change listener.
- *
- * @param listener listener
- * @param interestedKeys monitor keys
- */
- public void addChangeListener(final ConfigChangeListener listener, final
Set<String> interestedKeys) {
- apolloConfig.addChangeListener(listener, interestedKeys);
- }
-
- /**
- * Add config change listener.
- *
- * @param listener listener
- * @param interestedKeys monitor keys
- * @param interestedKeyPrefixes monitor key prefixes
- */
- public void addChangeListener(final ConfigChangeListener listener, final
Set<String> interestedKeys, final Set<String> interestedKeyPrefixes) {
- apolloConfig.addChangeListener(listener, interestedKeys,
interestedKeyPrefixes);
- }
-}
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/wrapper/ApolloOpenApiWrapper.java
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/
[...]
deleted file mode 100644
index fd160f6..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/java/org/apache/shardingsphere/governance/repository/apollo/wrapper/ApolloOpenApiWrapper.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.governance.repository.apollo.wrapper;
-
-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 org.apache.shardingsphere.governance.repository.apollo.ApolloProperties;
-import
org.apache.shardingsphere.governance.repository.apollo.ApolloPropertyKey;
-
-/**
- * Apollo open API client wrapper.
- */
-public final class ApolloOpenApiWrapper {
-
- private final String namespace;
-
- private final String appId;
-
- private final String env;
-
- private final String clusterName;
-
- private final String administrator;
-
- 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);
- administrator = props.getValue(ApolloPropertyKey.ADMINISTRATOR);
- String apolloToken = props.getValue(ApolloPropertyKey.TOKEN);
- String portalUrl = props.getValue(ApolloPropertyKey.PORTAL_URL);
- Integer connectTimeout =
props.getValue(ApolloPropertyKey.CONNECT_TIMEOUT);
- Integer readTimeout = props.getValue(ApolloPropertyKey.READ_TIMEOUT);
- client =
ApolloOpenApiClient.newBuilder().withPortalUrl(portalUrl).withConnectTimeout(connectTimeout).withReadTimeout(readTimeout).withToken(apolloToken).build();
- }
-
- /**
- * Get config value by key.
- *
- * @param key key
- * @return value
- */
- public String getValue(final String key) {
- OpenItemDTO itemDTO = client.getItem(appId, env, clusterName,
namespace, key);
- if (itemDTO == null) {
- return null;
- }
- return itemDTO.getValue();
- }
-
- /**
- * Persist config.
- *
- * @param key key
- * @param value value
- */
- public void persist(final String key, final String value) {
- updateKey(key, value);
- publishNamespace();
- }
-
- /**
- * Remove config.
- *
- * @param key key
- */
- public void remove(final String key) {
- client.removeItem(appId, env, clusterName, namespace, key,
administrator);
- }
-
- private void updateKey(final String key, final String value) {
- OpenItemDTO openItem = new OpenItemDTO();
- openItem.setKey(key);
- openItem.setValue(value);
- openItem.setComment("ShardingSphere create or update config");
- openItem.setDataChangeCreatedBy(administrator);
- client.createOrUpdateItem(appId, env, clusterName, namespace,
openItem);
- }
-
- private void publishNamespace() {
- NamespaceReleaseDTO release = new NamespaceReleaseDTO();
- release.setReleaseTitle("ShardingSphere namespace release");
- release.setReleaseComment("ShardingSphere namespace release");
- release.setReleasedBy(administrator);
- release.setEmergencyPublish(true);
- client.publishNamespace(appId, env, clusterName, namespace, release);
- }
-}
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/resources/META-INF/services/org.apache.shardingsphere.governance.repository.api.ConfigurationRepository
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/resources/META-INF/services/org.apache.shardingsph
[...]
deleted file mode 100644
index 94dcf32..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/main/resources/META-INF/services/org.apache.shardingsphere.governance.repository.api.ConfigurationRepository
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.shardingsphere.governance.repository.apollo.ApolloRepository
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/java/org/apache/shardingsphere/governance/repository/apollo/ApolloPropertiesTest.java
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/java/org/apache/shardingsphere/governance/repository/apollo/ApolloPr
[...]
deleted file mode 100644
index f57c8d1..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/java/org/apache/shardingsphere/governance/repository/apollo/ApolloPropertiesTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.governance.repository.apollo;
-
-import org.junit.Test;
-
-import java.util.Properties;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-public final class ApolloPropertiesTest {
-
- @Test
- public void assertGetValue() {
- Properties props = new Properties();
- props.setProperty(ApolloPropertyKey.APP_ID.getKey(),
"APOLLO_SHARDINGSPHERE_TEST");
- props.setProperty(ApolloPropertyKey.ENV.getKey(), "PROD");
- props.setProperty(ApolloPropertyKey.CLUSTER_NAME.getKey(), "sit");
- props.setProperty(ApolloPropertyKey.ADMINISTRATOR.getKey(), "guest");
- props.setProperty(ApolloPropertyKey.TOKEN.getKey(),
"this-is-a-test-token");
- props.setProperty(ApolloPropertyKey.PORTAL_URL.getKey(),
"http://config-service-url");
- props.setProperty(ApolloPropertyKey.CONNECT_TIMEOUT.getKey(), "3000");
- props.setProperty(ApolloPropertyKey.READ_TIMEOUT.getKey(), "6000");
- ApolloProperties actual = new ApolloProperties(props);
- assertThat(actual.getValue(ApolloPropertyKey.APP_ID),
is("APOLLO_SHARDINGSPHERE_TEST"));
- assertThat(actual.getValue(ApolloPropertyKey.ENV), is("PROD"));
- assertThat(actual.getValue(ApolloPropertyKey.CLUSTER_NAME), is("sit"));
- assertThat(actual.getValue(ApolloPropertyKey.ADMINISTRATOR),
is("guest"));
- assertThat(actual.getValue(ApolloPropertyKey.TOKEN),
is("this-is-a-test-token"));
- assertThat(actual.getValue(ApolloPropertyKey.PORTAL_URL),
is("http://config-service-url"));
- assertThat(actual.getValue(ApolloPropertyKey.CONNECT_TIMEOUT),
is(3000));
- assertThat(actual.getValue(ApolloPropertyKey.READ_TIMEOUT), is(6000));
- }
-
- @Test
- public void assertGetDefaultValue() {
- ApolloProperties actual = new ApolloProperties(new Properties());
- assertThat(actual.getValue(ApolloPropertyKey.APP_ID),
is(ApolloPropertyKey.APP_ID.getDefaultValue()));
- assertThat(actual.getValue(ApolloPropertyKey.ENV),
is(ApolloPropertyKey.ENV.getDefaultValue()));
- assertThat(actual.getValue(ApolloPropertyKey.CLUSTER_NAME),
is(ApolloPropertyKey.CLUSTER_NAME.getDefaultValue()));
- assertThat(actual.getValue(ApolloPropertyKey.ADMINISTRATOR),
is(ApolloPropertyKey.ADMINISTRATOR.getDefaultValue()));
- assertThat(actual.getValue(ApolloPropertyKey.TOKEN),
is(ApolloPropertyKey.TOKEN.getDefaultValue()));
- assertThat(actual.getValue(ApolloPropertyKey.PORTAL_URL),
is(ApolloPropertyKey.PORTAL_URL.getDefaultValue()));
- assertThat(actual.getValue(ApolloPropertyKey.CONNECT_TIMEOUT),
is(Integer.parseInt(ApolloPropertyKey.CONNECT_TIMEOUT.getDefaultValue())));
- assertThat(actual.getValue(ApolloPropertyKey.READ_TIMEOUT),
is(Integer.parseInt(ApolloPropertyKey.READ_TIMEOUT.getDefaultValue())));
- }
-}
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/java/org/apache/shardingsphere/governance/repository/apollo/ApolloRepositoryTest.java
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/java/org/apache/shardingsphere/governance/repository/apollo/ApolloRe
[...]
deleted file mode 100644
index 79355ca..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/java/org/apache/shardingsphere/governance/repository/apollo/ApolloRepositoryTest.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.governance.repository.apollo;
-
-import com.ctrip.framework.apollo.mockserver.EmbeddedApollo;
-import com.google.common.util.concurrent.SettableFuture;
-import lombok.SneakyThrows;
-import
org.apache.shardingsphere.governance.repository.api.ConfigurationRepository;
-import
org.apache.shardingsphere.governance.repository.api.config.GovernanceCenterConfiguration;
-import
org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent;
-import
org.apache.shardingsphere.governance.repository.api.listener.DataChangedEvent.Type;
-import
org.apache.shardingsphere.governance.repository.apollo.wrapper.ApolloConfigWrapper;
-import
org.apache.shardingsphere.governance.repository.apollo.wrapper.ApolloOpenApiWrapper;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.mockito.internal.util.reflection.FieldSetter;
-import org.slf4j.bridge.SLF4JBridgeHandler;
-
-import java.util.Properties;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-public final class ApolloRepositoryTest {
-
- static {
- SLF4JBridgeHandler.removeHandlersForRootLogger();
- SLF4JBridgeHandler.install();
- }
-
- @ClassRule
- public static EmbeddedApollo embeddedApollo = new EmbeddedApollo();
-
- private static final ConfigurationRepository REPOSITORY = new
ApolloRepository();
-
- private static final ApolloOpenApiWrapper OPEN_API_WRAPPER =
mock(ApolloOpenApiWrapper.class);
-
- private static final String PORTAL_URL = "http://127.0.0.1";
-
- private static final String TOKEN = "testToken";
-
- @SneakyThrows(ReflectiveOperationException.class)
- @BeforeClass
- public static void init() {
-
- Properties props = new Properties();
- props.setProperty(ApolloPropertyKey.PORTAL_URL.getKey(), PORTAL_URL);
- props.setProperty(ApolloPropertyKey.TOKEN.getKey(), TOKEN);
- GovernanceCenterConfiguration config = new
GovernanceCenterConfiguration("Apollo", "http://config-service-url", props);
- REPOSITORY.setProps(props);
- REPOSITORY.init("governance", config);
- ApolloConfigWrapper configWrapper = new
ApolloConfigWrapper("governance", config, new ApolloProperties(props));
- FieldSetter.setField(REPOSITORY,
ApolloRepository.class.getDeclaredField("configWrapper"), configWrapper);
- FieldSetter.setField(REPOSITORY,
ApolloRepository.class.getDeclaredField("openApiWrapper"), OPEN_API_WRAPPER);
- }
-
- @Test
- public void assertGet() {
- assertThat(REPOSITORY.get("/test/children/0"), is("value0"));
- }
-
- @Test
- public void assertGetByOpenApi() {
- assertNull(REPOSITORY.get("/test/children/6"));
- }
-
- @Test
- public void assertWatch() throws InterruptedException, ExecutionException,
TimeoutException {
- assertWatchUpdateChangedType("/test/children/1", "test.children.1",
"newValue");
- }
-
- @Test
- public void assertGetWithNonExistentKey() {
- assertNull(REPOSITORY.get("/test/nonExistentKey"));
- }
-
- @Test
- public void assertWatchUpdateChangedTypeWithExistedKey() throws
InterruptedException, ExecutionException, TimeoutException {
- assertWatchUpdateChangedType("/test/children/4", "test.children.4",
"newValue4");
- assertThat(REPOSITORY.get("/test/children/4"), is("newValue4"));
- }
-
- @Test
- public void assertWatchUpdateChangedTypeWithNotExistedKey() throws
InterruptedException, ExecutionException, TimeoutException {
- assertWatchUpdateChangedType("/test/children/newKey",
"test.children.newKey", "newValue");
- }
-
- private void assertWatchUpdateChangedType(final String path, final String
key, final String newValue) throws InterruptedException, ExecutionException,
TimeoutException {
- SettableFuture<DataChangedEvent> future = SettableFuture.create();
- REPOSITORY.watch(path, future::set);
- embeddedApollo.addOrModifyProperty("governance", key, newValue);
- DataChangedEvent changeEvent = future.get(5, TimeUnit.SECONDS);
- assertThat(changeEvent.getKey(), is(path));
- assertThat(changeEvent.getValue(), is(newValue));
- assertThat(changeEvent.getType(), is(Type.UPDATED));
- }
-
- @Test
- public void assertWatchDeletedChangedTypeWithExistedKey() throws
InterruptedException, ExecutionException, TimeoutException {
- assertWatchDeletedChangedType("/test/children/3", "test.children.3");
- }
-
- private void assertWatchDeletedChangedType(final String path, final String
key) throws InterruptedException, ExecutionException, TimeoutException {
- SettableFuture<DataChangedEvent> future = SettableFuture.create();
- REPOSITORY.watch(path, future::set);
- embeddedApollo.deleteProperty("governance", key);
- DataChangedEvent changeEvent = future.get(5, TimeUnit.SECONDS);
- assertThat(changeEvent.getKey(), is(path));
- assertNull(changeEvent.getValue());
- assertThat(changeEvent.getType(), is(Type.DELETED));
- assertNull(REPOSITORY.get(path));
- }
-
- @Test
- public void assertDelete() {
- REPOSITORY.delete("/test/children/2");
- verify(OPEN_API_WRAPPER).remove("test.children.2");
- }
-
- @Test
- public void assertGetChildrenKeys() {
- assertNull(REPOSITORY.getChildrenKeys("/test/children"));
- }
-
- @Test
- public void assertPersist() {
- REPOSITORY.persist("/test/children/6", "value6");
- verify(OPEN_API_WRAPPER).persist("test.children.6", "value6");
- }
-
- @Test
- public void assertGetType() {
- assertThat(REPOSITORY.getType(), is("Apollo"));
- }
-}
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/java/org/apache/shardingsphere/governance/repository/apollo/wrapper/ApolloConfigWrapperTest.java
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/java/org/apache/shardingsphere/governance/repository/apol
[...]
deleted file mode 100644
index 557f7e9..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/java/org/apache/shardingsphere/governance/repository/apollo/wrapper/ApolloConfigWrapperTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.governance.repository.apollo.wrapper;
-
-import com.ctrip.framework.apollo.ConfigChangeListener;
-import com.ctrip.framework.apollo.enums.PropertyChangeType;
-import com.ctrip.framework.apollo.mockserver.EmbeddedApollo;
-import com.ctrip.framework.apollo.model.ConfigChangeEvent;
-import com.google.common.util.concurrent.SettableFuture;
-import
org.apache.shardingsphere.governance.repository.api.config.GovernanceCenterConfiguration;
-import org.apache.shardingsphere.governance.repository.apollo.ApolloProperties;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.slf4j.bridge.SLF4JBridgeHandler;
-
-import java.util.Collections;
-import java.util.Properties;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-public final class ApolloConfigWrapperTest {
-
- static {
- SLF4JBridgeHandler.removeHandlersForRootLogger();
- SLF4JBridgeHandler.install();
- }
-
- @ClassRule
- public static EmbeddedApollo embeddedApollo = new EmbeddedApollo();
-
- private ApolloConfigWrapper configWrapper;
-
- @Before
- public void setup() {
- configWrapper = new ApolloConfigWrapper(
- "governance", new GovernanceCenterConfiguration("Apollo",
"http://config-service-url", new Properties()), new ApolloProperties(new
Properties()));
- }
-
- @Test
- public void assertGetProperty() {
- assertThat(configWrapper.getProperty("test.children.1"), is("value1"));
- }
-
- @Test
- public void assertAddChangeListener() throws InterruptedException,
TimeoutException, ExecutionException {
- SettableFuture<ConfigChangeEvent> future = SettableFuture.create();
- ConfigChangeListener listener = future::set;
- configWrapper.addChangeListener(listener,
Collections.singleton("test.children.2"));
- embeddedApollo.addOrModifyProperty("governance", "test.children.2",
"value3");
- ConfigChangeEvent changeEvent = future.get(5, TimeUnit.SECONDS);
- assertTrue(changeEvent.isChanged("test.children.2"));
- assertThat(changeEvent.getChange("test.children.2").getOldValue(),
is("value2"));
- assertThat(changeEvent.getChange("test.children.2").getNewValue(),
is("value3"));
- assertThat(changeEvent.getChange("test.children.2").getChangeType(),
is(PropertyChangeType.MODIFIED));
- }
-
- @Test
- public void assertAddChangeListenerWithInterestedKeyPrefixes() throws
InterruptedException, TimeoutException, ExecutionException {
- SettableFuture<ConfigChangeEvent> future = SettableFuture.create();
- ConfigChangeListener listener = future::set;
- configWrapper.addChangeListener(listener,
Collections.singleton("test.children.1"),
Collections.singleton("test.children.2"));
- embeddedApollo.addOrModifyProperty("governance", "test.children.2.1",
"value4");
- ConfigChangeEvent changeEvent = future.get(5, TimeUnit.SECONDS);
- assertTrue(changeEvent.isChanged("test.children.2.1"));
- assertThat(changeEvent.getChange("test.children.2.1").getNewValue(),
is("value4"));
- assertThat(changeEvent.getChange("test.children.2.1").getChangeType(),
is(PropertyChangeType.ADDED));
- }
-}
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/java/org/apache/shardingsphere/governance/repository/apollo/wrapper/ApolloOpenApiWrapperTest.java
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/java/org/apache/shardingsphere/governance/repository/apo
[...]
deleted file mode 100644
index cc31ebc..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/java/org/apache/shardingsphere/governance/repository/apollo/wrapper/ApolloOpenApiWrapperTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.governance.repository.apollo.wrapper;
-
-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.governance.repository.apollo.ApolloProperties;
-import
org.apache.shardingsphere.governance.repository.apollo.ApolloPropertyKey;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.internal.util.reflection.FieldSetter;
-import org.mockito.junit.MockitoJUnitRunner;
-
-import java.util.Properties;
-
-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;
-
-@RunWith(MockitoJUnitRunner.class)
-public final class ApolloOpenApiWrapperTest {
-
- private static final String NAME_SPACE = "governance";
-
- private static final String PORTAL_URL = "http://127.0.0.1";
-
- private static final String TOKEN = "testToken";
-
- @Mock
- private ApolloOpenApiClient client;
-
- @Mock
- private OpenItemDTO openItemDTO;
-
- private ApolloOpenApiWrapper apolloOpenApiWrapper;
-
- @SneakyThrows({NoSuchFieldException.class, SecurityException.class})
- @Before
- public void setUp() {
- Properties props = new Properties();
- props.setProperty(ApolloPropertyKey.PORTAL_URL.getKey(), PORTAL_URL);
- props.setProperty(ApolloPropertyKey.TOKEN.getKey(), TOKEN);
- 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());
- FieldSetter.setField(apolloOpenApiWrapper,
ApolloOpenApiWrapper.class.getDeclaredField("env"),
ApolloPropertyKey.ENV.getDefaultValue());
- FieldSetter.setField(apolloOpenApiWrapper,
ApolloOpenApiWrapper.class.getDeclaredField("clusterName"),
ApolloPropertyKey.CLUSTER_NAME.getDefaultValue());
- FieldSetter.setField(apolloOpenApiWrapper,
ApolloOpenApiWrapper.class.getDeclaredField("administrator"),
ApolloPropertyKey.ADMINISTRATOR.getDefaultValue());
- }
-
- @Test
- public void getValue() {
- apolloOpenApiWrapper.getValue("test.children.0");
- verify(client).getItem(ApolloPropertyKey.APP_ID.getDefaultValue(),
ApolloPropertyKey.ENV.getDefaultValue(),
- ApolloPropertyKey.CLUSTER_NAME.getDefaultValue(), NAME_SPACE,
"test.children.0");
- }
-
- @Test
- public void getValueNotNull() {
- when(client.getItem(ApolloPropertyKey.APP_ID.getDefaultValue(),
ApolloPropertyKey.ENV.getDefaultValue(),
- ApolloPropertyKey.CLUSTER_NAME.getDefaultValue(), NAME_SPACE,
"test.children.0")).thenReturn(openItemDTO);
- assertNull(apolloOpenApiWrapper.getValue("test.children.0"));
- }
-
- @Test
- public void persist() {
- apolloOpenApiWrapper.persist("test.children.0", "value0");
- verify(client).createOrUpdateItem(anyString(), anyString(),
anyString(), anyString(), any(OpenItemDTO.class));
- verify(client).publishNamespace(anyString(), anyString(), anyString(),
anyString(), any(NamespaceReleaseDTO.class));
- }
-
- @Test
- public void remove() {
- apolloOpenApiWrapper.remove("test.children.0");
- verify(client).removeItem(anyString(), anyString(), anyString(),
anyString(), eq("test.children.0"), anyString());
- }
-}
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/resources/logback-test.xml
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/resources/logback-test.xml
deleted file mode 100644
index b4b7aca..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<configuration>
- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread]
%logger{36} - %msg%n</pattern>
- </encoder>
- </appender>
- <logger name="com.ctrip.framework.apollo" level="error" additivity="false">
- <appender-ref ref="console" />
- </logger>
- <logger name="okhttp3.mockwebserver" level="warn" additivity="false">
- <appender-ref ref="console" />
- </logger>
-
- <root>
- <level value="error" />
- <appender-ref ref="console" />
- </root>
-</configuration>
diff --git
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/resources/mockdata-governance.properties
b/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/resources/mockdata-governance.properties
deleted file mode 100644
index da1e23f..0000000
---
a/shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-apollo/src/test/resources/mockdata-governance.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-test.children.0=value0
-test.children.1=value1
-test.children.2=value2
-test.children.3=value3
-test.children.4=value4
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/util/YamlGovernanceRepositoryConfigurationSwapperUtil.java
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/util/YamlGovernanceRepositoryConfigurationSwapperUtil.java
index 9ed0b02..c0a9932 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/util/YamlGovernanceRepositoryConfigurationSwapperUtil.java
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/internal/util/YamlGovernanceRepositoryConfigurationSwapperUtil.java
@@ -38,10 +38,6 @@ public final class
YamlGovernanceRepositoryConfigurationSwapperUtil {
* @return governance repository configuration map
*/
public static GovernanceConfiguration marshal(final
YamlGovernanceConfiguration governance) {
- if (null == governance.getAdditionalConfigCenter()) {
- return new GovernanceConfiguration(governance.getName(),
SWAPPER.swapToObject(governance.getRegistryCenter()), governance.isOverwrite());
- }
- return new GovernanceConfiguration(governance.getName(),
- SWAPPER.swapToObject(governance.getRegistryCenter()),
SWAPPER.swapToObject(governance.getAdditionalConfigCenter()),
governance.isOverwrite());
+ return new GovernanceConfiguration(governance.getName(),
SWAPPER.swapToObject(governance.getRegistryCenter()), governance.isOverwrite());
}
}
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/datasource/GovernanceShardingSphereDataSourceTest.java
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/datasource/GovernanceShardingSphereDataSourceTest.java
index 9c5754b..880b79a 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/datasource/GovernanceShardingSphereDataSourceTest.java
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/datasource/GovernanceShardingSphereDataSourceTest.java
@@ -70,7 +70,7 @@ public final class GovernanceShardingSphereDataSourceTest {
}
private static GovernanceConfiguration getGovernanceConfiguration() {
- return new GovernanceConfiguration("test_name",
getRegistryCenterConfiguration(), getConfigCenterConfiguration(), true);
+ return new GovernanceConfiguration("test_name",
getRegistryCenterConfiguration(), true);
}
private static GovernanceCenterConfiguration
getRegistryCenterConfiguration() {
@@ -79,12 +79,6 @@ public final class GovernanceShardingSphereDataSourceTest {
return new GovernanceCenterConfiguration("REG_TEST", "localhost:3181",
properties);
}
- private static GovernanceCenterConfiguration
getConfigCenterConfiguration() {
- Properties properties = new Properties();
- properties.setProperty("overwrite", "true");
- return new GovernanceCenterConfiguration("CONFIG_TEST",
"localhost:3181", properties);
- }
-
@Test
public void assertInitializeGovernanceShardingSphereDataSource() throws
SQLException {
assertThat(new
GovernanceShardingSphereDataSource(getGovernanceConfiguration()).getConnection(),
instanceOf(Connection.class));
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/replica_query/configWithReplicaQueryDataSourceWithProps.yaml
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/replica_query/configWithReplicaQueryDataSourceWithProps.yaml
index 2166874..f9022ab 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/replica_query/configWithReplicaQueryDataSourceWithProps.yaml
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/replica_query/configWithReplicaQueryDataSourceWithProps.yaml
@@ -58,12 +58,4 @@ governance:
timeToLiveSeconds: 10
maxRetries: 10
operationTimeoutMilliseconds: 10
- additionalConfigCenter:
- type: CONFIG_TEST
- serverLists: localhost:3181
- props:
- retryIntervalMilliseconds: 10
- timeToLiveSeconds: 10
- maxRetries: 10
- operationTimeoutMilliseconds: 10
overwrite: true
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/replica_query/configWithReplicaQueryDataSourceWithoutProps.yaml
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/replica_query/configWithReplicaQueryDataSourceWithoutProps.yaml
index 9d2d033..c63c24c 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/replica_query/configWithReplicaQueryDataSourceWithoutProps.yaml
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/replica_query/configWithReplicaQueryDataSourceWithoutProps.yaml
@@ -58,12 +58,4 @@ governance:
timeToLiveSeconds: 10
maxRetries: 10
operationTimeoutMilliseconds: 10
- additionalConfigCenter:
- type: CONFIG_TEST
- serverLists: localhost:3181
- props:
- retryIntervalMilliseconds: 10
- timeToLiveSeconds: 10
- maxRetries: 10
- operationTimeoutMilliseconds: 10
overwrite: true
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
index c0837e0..2071902 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
@@ -96,12 +96,4 @@ governance:
timeToLiveSeconds: 10
maxRetries: 10
operationTimeoutMilliseconds: 10
- additionalConfigCenter:
- type: CONFIG_TEST
- serverLists: localhost:3181
- props:
- retryIntervalMilliseconds: 10
- timeToLiveSeconds: 10
- maxRetries: 10
- operationTimeoutMilliseconds: 10
overwrite: true
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
index c6e7281..2ac9d6d 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
@@ -96,12 +96,4 @@ governance:
timeToLiveSeconds: 10
maxRetries: 10
operationTimeoutMilliseconds: 10
- additionalConfigCenter:
- type: CONFIG_TEST
- serverLists: localhost:3181
- props:
- retryIntervalMilliseconds: 10
- timeToLiveSeconds: 10
- maxRetries: 10
- operationTimeoutMilliseconds: 10
overwrite: true
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
index 613c5fc..c06b6a7 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
@@ -78,12 +78,4 @@ governance:
timeToLiveSeconds: 10
maxRetries: 10
operationTimeoutMilliseconds: 10
- additionalConfigCenter:
- type: CONFIG_TEST
- serverLists: localhost:3181
- props:
- retryIntervalMilliseconds: 10
- timeToLiveSeconds: 10
- maxRetries: 10
- operationTimeoutMilliseconds: 10
overwrite: true
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
index 54adaa9..42841af 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
@@ -80,12 +80,4 @@ governance:
timeToLiveSeconds: 10
maxRetries: 10
operationTimeoutMilliseconds: 10
- additionalConfigCenter:
- type: CONFIG_TEST
- serverLists: localhost:3181
- props:
- retryIntervalMilliseconds: 10
- timeToLiveSeconds: 10
- maxRetries: 10
- operationTimeoutMilliseconds: 10
overwrite: true
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithDataSourceWithProps.yaml
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithDataSourceWithProps.yaml
index a7317cc..542eaa5 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithDataSourceWithProps.yaml
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithDataSourceWithProps.yaml
@@ -132,12 +132,4 @@ governance:
timeToLiveSeconds: 10
maxRetries: 10
operationTimeoutMilliseconds: 10
- additionalConfigCenter:
- type: CONFIG_TEST
- serverLists: localhost:3181
- props:
- retryIntervalMilliseconds: 10
- timeToLiveSeconds: 10
- maxRetries: 10
- operationTimeoutMilliseconds: 10
overwrite: true
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithDataSourceWithoutProps.yaml
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithDataSourceWithoutProps.yaml
index c0144a9..ef46174 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithDataSourceWithoutProps.yaml
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithDataSourceWithoutProps.yaml
@@ -134,12 +134,4 @@ governance:
timeToLiveSeconds: 10
maxRetries: 10
operationTimeoutMilliseconds: 10
- additionalConfigCenter:
- type: CONFIG_TEST
- serverLists: localhost:3181
- props:
- retryIntervalMilliseconds: 10
- timeToLiveSeconds: 10
- maxRetries: 10
- operationTimeoutMilliseconds: 10
overwrite: true
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithDataSourceWithoutRules.yaml
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithDataSourceWithoutRules.yaml
index 56cadce..cfc28f7 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithDataSourceWithoutRules.yaml
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithDataSourceWithoutRules.yaml
@@ -55,12 +55,4 @@ governance:
timeToLiveSeconds: 10
maxRetries: 10
operationTimeoutMilliseconds: 10
- additionalConfigCenter:
- type: CONFIG_TEST
- serverLists: localhost:3181
- props:
- retryIntervalMilliseconds: 10
- timeToLiveSeconds: 10
- maxRetries: 10
- operationTimeoutMilliseconds: 10
overwrite: true
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithoutDataSourceWithProps.yaml
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithoutDataSourceWithProps.yaml
index 5818755..cfdc74f 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithoutDataSourceWithProps.yaml
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithoutDataSourceWithProps.yaml
@@ -91,12 +91,4 @@ governance:
timeToLiveSeconds: 10
maxRetries: 10
operationTimeoutMilliseconds: 10
- additionalConfigCenter:
- type: CONFIG_TEST
- serverLists: localhost:3181
- props:
- retryIntervalMilliseconds: 10
- timeToLiveSeconds: 10
- maxRetries: 10
- operationTimeoutMilliseconds: 10
overwrite: true
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithoutDataSourceWithoutProps.yaml
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithoutDataSourceWithoutProps.yaml
index 2d135bc..93e734c 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithoutDataSourceWithoutProps.yaml
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_replica_query/configWithoutDataSourceWithoutProps.yaml
@@ -95,12 +95,4 @@ governance:
timeToLiveSeconds: 10
maxRetries: 10
operationTimeoutMilliseconds: 10
- additionalConfigCenter:
- type: CONFIG_TEST
- serverLists: localhost:3181
- props:
- retryIntervalMilliseconds: 10
- timeToLiveSeconds: 10
- maxRetries: 10
- operationTimeoutMilliseconds: 10
overwrite: true
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/unit/sharding.yaml
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/unit/sharding.yaml
index 3ef6f1f..51a1145 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/unit/sharding.yaml
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/unit/sharding.yaml
@@ -20,9 +20,6 @@ governance:
registryCenter:
type: REG_TEST
serverLists: localhost:3181
- additionalConfigCenter:
- type: CONFIG_TEST
- serverLists: localhost:3181
overwrite: true
dataSources:
@@ -103,6 +100,5 @@ rules:
primaryDataSourceName: primary_ds
replicaDataSourceNames:
- replica_ds
-
props:
sql-show: false
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/main/java/org/apache/shardingsphere/spring/boot/governance/ShardingSphereGovernanceAutoConfiguration.java
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/main/java/org/apache/shardingsphere/spring/boot/governance/ShardingSphereGovernanceAutoConfi
[...]
index 4d07479..3e8c280 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/main/java/org/apache/shardingsphere/spring/boot/governance/ShardingSphereGovernanceAutoConfiguration.java
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/main/java/org/apache/shardingsphere/spring/boot/governance/ShardingSphereGovernanceAutoConfiguration.java
@@ -74,11 +74,7 @@ public class ShardingSphereGovernanceAutoConfiguration
implements EnvironmentAwa
@Bean
public GovernanceConfiguration governanceConfiguration() {
Preconditions.checkState(Objects.nonNull(root.getGovernance()), "The
governance configuration is invalid, please configure governance");
- if (null == root.getGovernance().getAdditionalConfigCenter()) {
- return new GovernanceConfiguration(root.getGovernance().getName(),
swapper.swapToObject(root.getGovernance().getRegistryCenter()),
root.getGovernance().isOverwrite());
- }
- return new GovernanceConfiguration(root.getGovernance().getName(),
-
swapper.swapToObject(root.getGovernance().getRegistryCenter()),
swapper.swapToObject(root.getGovernance().getAdditionalConfigCenter()),
root.getGovernance().isOverwrite());
+ return new GovernanceConfiguration(root.getGovernance().getName(),
swapper.swapToObject(root.getGovernance().getRegistryCenter()),
root.getGovernance().isOverwrite());
}
/**
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/DataSourceBeanDefinitionTag.java
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/DataSourceBeanDefinitio
[...]
index 4e5885c..61505b4 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/DataSourceBeanDefinitionTag.java
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/DataSourceBeanDefinitionTag.java
@@ -38,7 +38,5 @@ public final class DataSourceBeanDefinitionTag {
public static final String REG_CENTER_REF_ATTRIBUTE = "reg-center-ref";
- public static final String CONFIG_CENTER_REF_ATTRIBUTE =
"config-center-ref";
-
public static final String OVERWRITE_ATTRIBUTE = "overwrite";
}
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/GovernanceCenterConfigurationBeanDefinitionTag.java
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/Gove
[...]
index 707c021..6e1b447 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/GovernanceCenterConfigurationBeanDefinitionTag.java
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/constants/GovernanceCenterConfigurationBeanDefinitionTag.java
@@ -28,8 +28,6 @@ public final class
GovernanceCenterConfigurationBeanDefinitionTag {
public static final String REG_CENTER_ROOT_TAG = "reg-center";
- public static final String CONFIG_CENTER_ROOT_TAG = "config-center";
-
public static final String TYPE_ATTRIBUTE = "type";
public static final String SERVER_LISTS_ATTRIBUTE = "server-lists";
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/handler/GovernanceNamespaceHandler.java
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/handler/GovernanceNamespaceHandler.java
index f9ab91d..5756ecd 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/handler/GovernanceNamespaceHandler.java
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/handler/GovernanceNamespaceHandler.java
@@ -31,7 +31,6 @@ public final class GovernanceNamespaceHandler extends
NamespaceHandlerSupport {
@Override
public void init() {
registerBeanDefinitionParser(GovernanceCenterConfigurationBeanDefinitionTag.REG_CENTER_ROOT_TAG,
new GovernanceCenterConfigurationBeanDefinitionParser());
-
registerBeanDefinitionParser(GovernanceCenterConfigurationBeanDefinitionTag.CONFIG_CENTER_ROOT_TAG,
new GovernanceCenterConfigurationBeanDefinitionParser());
registerBeanDefinitionParser(DataSourceBeanDefinitionTag.ROOT_TAG, new
DataSourceBeanDefinitionParser());
}
}
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/parser/DataSourceBeanDefinitionParser.java
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/parser/DataSourceBeanDefinitionPa
[...]
index da5d186..a8a2245 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/parser/DataSourceBeanDefinitionParser.java
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/java/org/apache/shardingsphere/spring/namespace/governance/parser/DataSourceBeanDefinitionParser.java
@@ -88,9 +88,6 @@ public final class DataSourceBeanDefinitionParser extends
AbstractBeanDefinition
BeanDefinitionBuilder factory =
BeanDefinitionBuilder.rootBeanDefinition(GovernanceConfiguration.class);
factory.addConstructorArgValue(element.getAttribute(DataSourceBeanDefinitionTag.ID_ATTRIBUTE));
factory.addConstructorArgReference(element.getAttribute(DataSourceBeanDefinitionTag.REG_CENTER_REF_ATTRIBUTE));
- if
(!Strings.isNullOrEmpty(element.getAttribute(DataSourceBeanDefinitionTag.CONFIG_CENTER_REF_ATTRIBUTE)))
{
-
factory.addConstructorArgReference(element.getAttribute(DataSourceBeanDefinitionTag.CONFIG_CENTER_REF_ATTRIBUTE));
- }
factory.addConstructorArgValue(element.getAttribute(DataSourceBeanDefinitionTag.OVERWRITE_ATTRIBUTE));
return factory.getBeanDefinition();
}
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/namespace/governance.xsd
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/namespace/governance.xsd
index 8dfd2ad..66ec49c 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/namespace/governance.xsd
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/main/resources/META-INF/namespace/governance.xsd
@@ -47,15 +47,4 @@
<xsd:attribute name="server-lists" type="xsd:string"
use="required" />
</xsd:complexType>
</xsd:element>
-
- <xsd:element name="config-center">
- <xsd:complexType>
- <xsd:all>
- <xsd:element ref="beans:props" minOccurs="0" />
- </xsd:all>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="type" type="xsd:string" use="required" />
- <xsd:attribute name="server-lists" type="xsd:string"
use="required" />
- </xsd:complexType>
- </xsd:element>
</xsd:schema>
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/conf/local/server.yaml
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/conf/local/server.yaml
index 418d103..e611a3f 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/conf/local/server.yaml
+++
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/conf/local/server.yaml
@@ -25,14 +25,6 @@ governance:
timeToLiveSeconds: 60
maxRetries: 3
operationTimeoutMilliseconds: 500
- additionalConfigCenter:
- type: CONFIG_FIXTURE
- serverLists: localhost:3181
- props:
- retryIntervalMilliseconds: 10
- timeToLiveSeconds: 10
- maxRetries: 10
- operationTimeoutMilliseconds: 10
overwrite: false
authentication:
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/conf/reg_center/server.yaml
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/conf/reg_center/server.yaml
index 15ba252..e8bbed9 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/conf/reg_center/server.yaml
+++
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/resources/conf/reg_center/server.yaml
@@ -25,12 +25,4 @@ governance:
timeToLiveSeconds: 60
maxRetries: 3
operationTimeoutMilliseconds: 500
- additionalConfigCenter:
- type: CONFIG_FIXTURE
- serverLists: localhost:3181
- props:
- retryIntervalMilliseconds: 10
- timeToLiveSeconds: 10
- maxRetries: 10
- operationTimeoutMilliseconds: 10
overwrite: false
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
b/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
index 1322025..e923610 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-common/src/test/java/org/apache/shardingsphere/proxy/config/yaml/swapper/YamlProxyConfigurationSwapperTest.java
@@ -117,7 +117,6 @@ public final class YamlProxyConfigurationSwapperTest {
prepareAuthentication(yamlProxyServerConfig);
YamlGovernanceConfiguration yamlGovernanceConfig =
prepareGovernance(yamlProxyServerConfig);
prepareRegistryCenter(yamlGovernanceConfig);
- prepareAdditionalConfigCenter(yamlGovernanceConfig);
prepareProps(yamlProxyServerConfig);
YamlProxyRuleConfiguration yamlProxyRuleConfig =
prepareRuleConfigurations(result);
when(yamlProxyRuleConfig.getSchemaName()).thenReturn("ruleConfigSchema1");
@@ -181,17 +180,6 @@ public final class YamlProxyConfigurationSwapperTest {
when(yamlProxyServerConfig.getProps()).thenReturn(props);
}
- private void prepareAdditionalConfigCenter(final
YamlGovernanceConfiguration yamlGovernanceConfig) {
- YamlGovernanceCenterConfiguration additionalConfigCenterConfig =
mock(YamlGovernanceCenterConfiguration.class);
-
when(yamlGovernanceConfig.getAdditionalConfigCenter()).thenReturn(additionalConfigCenterConfig);
- when(additionalConfigCenterConfig.getType()).thenReturn("typeTwo");
-
when(additionalConfigCenterConfig.getServerLists()).thenReturn("serverLists2");
- Properties props = new Properties();
- props.setProperty("key2", "value2");
- when(additionalConfigCenterConfig.getProps()).thenReturn(props);
- when(yamlGovernanceConfig.isOverwrite()).thenReturn(true);
- }
-
private void prepareRegistryCenter(final YamlGovernanceConfiguration
yamlGovernanceConfig) {
YamlGovernanceCenterConfiguration registryCenterConfig =
mock(YamlGovernanceCenterConfiguration.class);
when(yamlGovernanceConfig.getRegistryCenter()).thenReturn(registryCenterConfig);