You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2020/07/29 07:55:02 UTC
[shardingsphere] branch master updated: Use same repository if use
same orchestration config for reg center and config center (#6504)
This is an automated email from the ASF dual-hosted git repository.
panjuan 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 8d3e40b Use same repository if use same orchestration config for reg center and config center (#6504)
8d3e40b is described below
commit 8d3e40bc36d33a50e1edb5cb5950709f0303a191
Author: Liang Zhang <te...@163.com>
AuthorDate: Wed Jul 29 15:54:51 2020 +0800
Use same repository if use same orchestration config for reg center and config center (#6504)
* Revise java doc
* Refactor OrchestrationRepository
* Use same repository if use same orchestration config for reg center and config center
* Use same repository if use same orchestration config for reg center and config center
* Add OrchestrationRepositoryFacade
* Add test cases
---
.../control/panel/spi/ControlPanelFacade.java | 5 +-
.../control/panel/spi/FacadeConfiguration.java | 2 +-
.../core/facade/OrchestrationFacade.java | 62 +++--------------
.../repository/OrchestrationRepositoryFacade.java | 77 +++++++++++++++++++++
.../core/facade/OrchestrationFacadeTest.java | 24 ++-----
...istryRepository.java => TestAllRepository.java} | 11 +--
.../fixture/TestConfigurationRepository.java | 6 +-
.../facade/fixture/TestRegistryRepository.java | 8 +--
.../OrchestrationRepositoryFacadeTest.java | 80 ++++++++++++++++++++++
...orchestration.repository.api.RegistryRepository | 1 +
.../repository/api/OrchestrationRepository.java | 26 +++----
.../repository/apollo/ApolloRepository.java | 10 +--
.../repository/etcd/EtcdRepository.java | 10 +--
...stration.repository.api.ConfigurationRepository | 18 -----
.../repository/nacos/NacosRepository.java | 6 +-
.../zookeeper/CuratorZookeeperRepository.java | 44 ++++++------
...stration.repository.api.ConfigurationRepository | 18 -----
.../fixture/TestConfigurationRepository.java | 4 +-
.../fixture/TestRegistryRepository.java | 4 +-
.../registry/TestOrchestrationRepository.java | 5 +-
.../type/OrchestrationSpringBootEncryptTest.java | 4 +-
.../registry/TestOrchestrationRepository.java | 4 +-
22 files changed, 248 insertions(+), 181 deletions(-)
diff --git a/shardingsphere-control-panel/shardingsphere-control-panel-spi/src/main/java/org/apache/shardingsphere/control/panel/spi/ControlPanelFacade.java b/shardingsphere-control-panel/shardingsphere-control-panel-spi/src/main/java/org/apache/shardingsphere/control/panel/spi/ControlPanelFacade.java
index 94df872..f37f239 100644
--- a/shardingsphere-control-panel/shardingsphere-control-panel-spi/src/main/java/org/apache/shardingsphere/control/panel/spi/ControlPanelFacade.java
+++ b/shardingsphere-control-panel/shardingsphere-control-panel-spi/src/main/java/org/apache/shardingsphere/control/panel/spi/ControlPanelFacade.java
@@ -20,15 +20,14 @@ package org.apache.shardingsphere.control.panel.spi;
import org.apache.shardingsphere.infra.spi.order.OrderedSPI;
/**
- * Interface Control panel facade.
+ * Control panel facade.
*/
public interface ControlPanelFacade<T extends FacadeConfiguration> extends OrderedSPI<T> {
/**
- * Init.
+ * Initialize facade.
*
* @param configuration configuration
*/
void init(T configuration);
-
}
diff --git a/shardingsphere-control-panel/shardingsphere-control-panel-spi/src/main/java/org/apache/shardingsphere/control/panel/spi/FacadeConfiguration.java b/shardingsphere-control-panel/shardingsphere-control-panel-spi/src/main/java/org/apache/shardingsphere/control/panel/spi/FacadeConfiguration.java
index 85ff833..49f5e63 100644
--- a/shardingsphere-control-panel/shardingsphere-control-panel-spi/src/main/java/org/apache/shardingsphere/control/panel/spi/FacadeConfiguration.java
+++ b/shardingsphere-control-panel/shardingsphere-control-panel-spi/src/main/java/org/apache/shardingsphere/control/panel/spi/FacadeConfiguration.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.control.panel.spi;
/**
- * Interface Facade configuration.
+ * Facade configuration.
*/
public interface FacadeConfiguration {
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/main/java/org/apache/shardingsphere/orchestration/core/facade/OrchestrationFacade.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/main/java/org/apache/shardingsphere/orchestration/core/facade/OrchestrationFacade.java
index a9cdb8e..d993abd 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/main/java/org/apache/shardingsphere/orchestration/core/facade/OrchestrationFacade.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/main/java/org/apache/shardingsphere/orchestration/core/facade/OrchestrationFacade.java
@@ -17,23 +17,18 @@
package org.apache.shardingsphere.orchestration.core.facade;
-import com.google.common.base.Preconditions;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.cluster.configuration.config.ClusterConfiguration;
import org.apache.shardingsphere.infra.auth.Authentication;
import org.apache.shardingsphere.infra.config.DataSourceConfiguration;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
-import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
-import org.apache.shardingsphere.infra.spi.type.TypedSPIRegistry;
import org.apache.shardingsphere.metrics.configuration.config.MetricsConfiguration;
import org.apache.shardingsphere.orchestration.core.config.ConfigCenter;
import org.apache.shardingsphere.orchestration.core.facade.listener.OrchestrationListenerManager;
+import org.apache.shardingsphere.orchestration.core.facade.repository.OrchestrationRepositoryFacade;
import org.apache.shardingsphere.orchestration.core.metadata.MetaDataCenter;
import org.apache.shardingsphere.orchestration.core.registry.RegistryCenter;
-import org.apache.shardingsphere.orchestration.repository.api.ConfigurationRepository;
-import org.apache.shardingsphere.orchestration.repository.api.RegistryRepository;
-import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationCenterConfiguration;
import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationConfiguration;
import java.util.Collection;
@@ -47,18 +42,10 @@ import java.util.Properties;
@Slf4j
public final class OrchestrationFacade implements AutoCloseable {
- static {
- // TODO avoid multiple loading
- ShardingSphereServiceLoader.register(RegistryRepository.class);
- ShardingSphereServiceLoader.register(ConfigurationRepository.class);
- }
-
- private RegistryRepository registryRepository;
-
- private ConfigurationRepository configurationRepository;
-
private boolean isOverwrite;
+ private OrchestrationRepositoryFacade repositoryFacade;
+
@Getter
private ConfigCenter configCenter;
@@ -78,34 +65,12 @@ public final class OrchestrationFacade implements AutoCloseable {
*/
public void init(final OrchestrationConfiguration config, final Collection<String> schemaNames) {
isOverwrite = config.isOverwrite();
- initRegistryCenter(config);
- initConfigCenter(config);
- initMetaDataCenter(config);
- initListenerManager(config, schemaNames);
- }
-
- private void initRegistryCenter(final OrchestrationConfiguration config) {
- OrchestrationCenterConfiguration registryCenterConfig = config.getRegistryCenterConfiguration();
- Preconditions.checkNotNull(registryCenterConfig, "Registry center configuration cannot be null.");
- registryRepository = TypedSPIRegistry.getRegisteredService(RegistryRepository.class, registryCenterConfig.getType(), registryCenterConfig.getProps());
- registryRepository.init(config.getNamespace(), registryCenterConfig);
- registryCenter = new RegistryCenter(config.getNamespace(), registryRepository);
- }
-
- private void initConfigCenter(final OrchestrationConfiguration config) {
- OrchestrationCenterConfiguration additionalConfigCenterConfig = config.getAdditionalConfigCenterConfiguration().orElse(config.getRegistryCenterConfiguration());
- Preconditions.checkNotNull(additionalConfigCenterConfig, "Config center configuration cannot be null.");
- configurationRepository = TypedSPIRegistry.getRegisteredService(ConfigurationRepository.class, additionalConfigCenterConfig.getType(), additionalConfigCenterConfig.getProps());
- configurationRepository.init(config.getNamespace(), additionalConfigCenterConfig);
- configCenter = new ConfigCenter(config.getNamespace(), configurationRepository);
- }
-
- private void initMetaDataCenter(final OrchestrationConfiguration config) {
- metaDataCenter = new MetaDataCenter(config.getNamespace(), configurationRepository);
- }
-
- private void initListenerManager(final OrchestrationConfiguration config, final Collection<String> schemaNames) {
- listenerManager = new OrchestrationListenerManager(config.getNamespace(), registryRepository, configurationRepository, schemaNames.isEmpty() ? configCenter.getAllSchemaNames() : schemaNames);
+ repositoryFacade = new OrchestrationRepositoryFacade(config);
+ registryCenter = new RegistryCenter(config.getNamespace(), repositoryFacade.getRegistryRepository());
+ configCenter = new ConfigCenter(config.getNamespace(), repositoryFacade.getConfigurationRepository());
+ metaDataCenter = new MetaDataCenter(config.getNamespace(), repositoryFacade.getConfigurationRepository());
+ listenerManager = new OrchestrationListenerManager(config.getNamespace(),
+ repositoryFacade.getRegistryRepository(), repositoryFacade.getConfigurationRepository(), schemaNames.isEmpty() ? configCenter.getAllSchemaNames() : schemaNames);
}
/**
@@ -154,14 +119,7 @@ public final class OrchestrationFacade implements AutoCloseable {
@Override
public void close() {
- try {
- registryRepository.close();
- configurationRepository.close();
- // CHECKSTYLE:OFF
- } catch (final Exception ex) {
- // CHECKSTYLE:ON
- log.warn("RegCenter exception for: {}", ex.getMessage());
- }
+ repositoryFacade.close();
}
/**
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/main/java/org/apache/shardingsphere/orchestration/core/facade/repository/OrchestrationRepositoryFacade.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/main/java/org/apache/shardingsphere/orchestration/core/facade/repository/OrchestrationRepository [...]
new file mode 100644
index 0000000..6502a3f
--- /dev/null
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/main/java/org/apache/shardingsphere/orchestration/core/facade/repository/OrchestrationRepositoryFacade.java
@@ -0,0 +1,77 @@
+/*
+ * 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.orchestration.core.facade.repository;
+
+import com.google.common.base.Preconditions;
+import lombok.Getter;
+import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
+import org.apache.shardingsphere.infra.spi.type.TypedSPIRegistry;
+import org.apache.shardingsphere.orchestration.repository.api.ConfigurationRepository;
+import org.apache.shardingsphere.orchestration.repository.api.RegistryRepository;
+import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationCenterConfiguration;
+import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationConfiguration;
+
+/**
+ * Orchestration repository facade.
+ */
+@Getter
+public final class OrchestrationRepositoryFacade implements AutoCloseable {
+
+ static {
+ ShardingSphereServiceLoader.register(RegistryRepository.class);
+ ShardingSphereServiceLoader.register(ConfigurationRepository.class);
+ }
+
+ private final RegistryRepository registryRepository;
+
+ private final ConfigurationRepository configurationRepository;
+
+ public OrchestrationRepositoryFacade(final OrchestrationConfiguration config) {
+ registryRepository = createRegistryRepository(config);
+ configurationRepository = createConfigurationRepository(config);
+ }
+
+ private RegistryRepository createRegistryRepository(final OrchestrationConfiguration config) {
+ OrchestrationCenterConfiguration registryCenterConfig = config.getRegistryCenterConfiguration();
+ Preconditions.checkNotNull(registryCenterConfig, "Registry center configuration cannot be null.");
+ RegistryRepository result = TypedSPIRegistry.getRegisteredService(RegistryRepository.class, registryCenterConfig.getType(), registryCenterConfig.getProps());
+ result.init(config.getNamespace(), registryCenterConfig);
+ return result;
+ }
+
+ private ConfigurationRepository createConfigurationRepository(final OrchestrationConfiguration config) {
+ if (config.getAdditionalConfigCenterConfiguration().isPresent()) {
+ OrchestrationCenterConfiguration additionalConfigCenterConfig = config.getAdditionalConfigCenterConfiguration().get();
+ ConfigurationRepository result = TypedSPIRegistry.getRegisteredService(ConfigurationRepository.class, additionalConfigCenterConfig.getType(), additionalConfigCenterConfig.getProps());
+ result.init(config.getNamespace(), 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();
+ if (registryRepository != configurationRepository) {
+ configurationRepository.close();
+ }
+ }
+}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/OrchestrationFacadeTest.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/OrchestrationFacadeTest.java
index db490a1..55d064a 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/OrchestrationFacadeTest.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/OrchestrationFacadeTest.java
@@ -24,12 +24,12 @@ import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.metrics.configuration.config.MetricsConfiguration;
import org.apache.shardingsphere.orchestration.core.config.ConfigCenter;
import org.apache.shardingsphere.orchestration.core.facade.listener.OrchestrationListenerManager;
+import org.apache.shardingsphere.orchestration.core.facade.repository.OrchestrationRepositoryFacade;
import org.apache.shardingsphere.orchestration.core.facade.util.FieldUtil;
import org.apache.shardingsphere.orchestration.core.metadata.MetaDataCenter;
import org.apache.shardingsphere.orchestration.core.registry.RegistryCenter;
-import org.apache.shardingsphere.orchestration.repository.api.RegistryRepository;
-import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationConfiguration;
import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationCenterConfiguration;
+import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationConfiguration;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -42,7 +42,6 @@ import java.util.Collections;
import java.util.Map;
import java.util.Properties;
-import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@@ -52,7 +51,7 @@ public final class OrchestrationFacadeTest {
private final OrchestrationFacade orchestrationFacade = OrchestrationFacade.getInstance();
@Mock
- private RegistryRepository registryRepository;
+ private OrchestrationRepositoryFacade repositoryFacade;
@Mock
private ConfigCenter configCenter;
@@ -68,11 +67,9 @@ public final class OrchestrationFacadeTest {
@Before
public void setUp() {
- OrchestrationCenterConfiguration regCenterConfig = new OrchestrationCenterConfiguration("REG_TEST", "127.0.0.1", new Properties());
- OrchestrationCenterConfiguration additionalConfigCenterConfig = new OrchestrationCenterConfiguration("CONFIG_TEST", "127.0.0.1", new Properties());
- OrchestrationConfiguration orchestrationConfiguration = new OrchestrationConfiguration("test_name", regCenterConfig, additionalConfigCenterConfig, false);
+ OrchestrationConfiguration orchestrationConfiguration = new OrchestrationConfiguration("test_name", new OrchestrationCenterConfiguration("ALL", "127.0.0.1", new Properties()), false);
orchestrationFacade.init(orchestrationConfiguration, Arrays.asList("sharding_db", "masterslave_db"));
- FieldUtil.setField(orchestrationFacade, "registryRepository", registryRepository);
+ FieldUtil.setField(orchestrationFacade, "repositoryFacade", repositoryFacade);
FieldUtil.setField(orchestrationFacade, "configCenter", configCenter);
FieldUtil.setField(orchestrationFacade, "registryCenter", registryCenter);
FieldUtil.setField(orchestrationFacade, "metaDataCenter", metaDataCenter);
@@ -111,15 +108,8 @@ public final class OrchestrationFacadeTest {
}
@Test
- public void assertCloseSuccess() {
- orchestrationFacade.close();
- verify(registryRepository).close();
- }
-
- @Test
- public void assertCloseFailure() {
- doThrow(new RuntimeException()).when(registryRepository).close();
+ public void assertClose() {
orchestrationFacade.close();
- verify(registryRepository).close();
+ verify(repositoryFacade).close();
}
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestRegistryRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestAllRepository.java
similarity index 90%
copy from shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestRegistryRepository.java
copy to shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestAllRepository.java
index 19a7eac..a379c50 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestRegistryRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestAllRepository.java
@@ -19,9 +19,10 @@ package org.apache.shardingsphere.orchestration.core.facade.fixture;
import lombok.Getter;
import lombok.Setter;
+import org.apache.shardingsphere.orchestration.repository.api.ConfigurationRepository;
import org.apache.shardingsphere.orchestration.repository.api.RegistryRepository;
-import org.apache.shardingsphere.orchestration.repository.api.listener.DataChangedEventListener;
import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationCenterConfiguration;
+import org.apache.shardingsphere.orchestration.repository.api.listener.DataChangedEventListener;
import java.util.Collections;
import java.util.List;
@@ -29,7 +30,7 @@ import java.util.Properties;
@Getter
@Setter
-public final class TestRegistryRepository implements RegistryRepository {
+public final class TestAllRepository implements RegistryRepository, ConfigurationRepository {
private Properties props = new Properties();
@@ -56,11 +57,11 @@ public final class TestRegistryRepository implements RegistryRepository {
}
@Override
- public void watch(final String key, final DataChangedEventListener dataChangedEventListener) {
+ public void delete(final String key) {
}
@Override
- public void delete(final String key) {
+ public void watch(final String key, final DataChangedEventListener listener) {
}
@Override
@@ -69,6 +70,6 @@ public final class TestRegistryRepository implements RegistryRepository {
@Override
public String getType() {
- return "REG_TEST";
+ return "ALL";
}
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestConfigurationRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestConfigurationRepository.java
index 52e73bc..60f6dce 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestConfigurationRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestConfigurationRepository.java
@@ -52,11 +52,11 @@ public final class TestConfigurationRepository implements ConfigurationRepositor
}
@Override
- public void watch(final String key, final DataChangedEventListener dataChangedEventListener) {
+ public void delete(final String key) {
}
@Override
- public void delete(final String key) {
+ public void watch(final String key, final DataChangedEventListener listener) {
}
@Override
@@ -65,6 +65,6 @@ public final class TestConfigurationRepository implements ConfigurationRepositor
@Override
public String getType() {
- return "CONFIG_TEST";
+ return "CONFIG";
}
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestRegistryRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestRegistryRepository.java
index 19a7eac..4f3d1da 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestRegistryRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/fixture/TestRegistryRepository.java
@@ -20,8 +20,8 @@ package org.apache.shardingsphere.orchestration.core.facade.fixture;
import lombok.Getter;
import lombok.Setter;
import org.apache.shardingsphere.orchestration.repository.api.RegistryRepository;
-import org.apache.shardingsphere.orchestration.repository.api.listener.DataChangedEventListener;
import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationCenterConfiguration;
+import org.apache.shardingsphere.orchestration.repository.api.listener.DataChangedEventListener;
import java.util.Collections;
import java.util.List;
@@ -56,11 +56,11 @@ public final class TestRegistryRepository implements RegistryRepository {
}
@Override
- public void watch(final String key, final DataChangedEventListener dataChangedEventListener) {
+ public void delete(final String key) {
}
@Override
- public void delete(final String key) {
+ public void watch(final String key, final DataChangedEventListener listener) {
}
@Override
@@ -69,6 +69,6 @@ public final class TestRegistryRepository implements RegistryRepository {
@Override
public String getType() {
- return "REG_TEST";
+ return "REG";
}
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/repository/OrchestrationRepositoryFacadeTest.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/repository/OrchestrationReposi [...]
new file mode 100644
index 0000000..b078b98
--- /dev/null
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/java/org/apache/shardingsphere/orchestration/core/facade/repository/OrchestrationRepositoryFacadeTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.orchestration.core.facade.repository;
+
+import org.apache.shardingsphere.orchestration.core.facade.fixture.TestAllRepository;
+import org.apache.shardingsphere.orchestration.core.facade.util.FieldUtil;
+import org.apache.shardingsphere.orchestration.repository.api.ConfigurationRepository;
+import org.apache.shardingsphere.orchestration.repository.api.RegistryRepository;
+import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationCenterConfiguration;
+import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationConfiguration;
+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 OrchestrationRepositoryFacadeTest {
+
+ @Test
+ public void assertNewWithoutAdditionalConfigurationRepository() {
+ OrchestrationRepositoryFacade actual = new OrchestrationRepositoryFacade(
+ new OrchestrationConfiguration("test", new OrchestrationCenterConfiguration("ALL", "127.0.0.1:8888", new Properties()), true));
+ assertThat(actual.getRegistryRepository(), is(actual.getConfigurationRepository()));
+ }
+
+ @Test
+ public void assertNewWithAdditionalConfigurationRepository() {
+ OrchestrationRepositoryFacade actual = new OrchestrationRepositoryFacade(new OrchestrationConfiguration("test",
+ new OrchestrationCenterConfiguration("ALL", "127.0.0.1:8888", new Properties()), new OrchestrationCenterConfiguration("CONFIG", "127.0.0.1:9999", new Properties()), true));
+ assertThat(actual.getRegistryRepository(), not(actual.getConfigurationRepository()));
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void assertNewWithoutAdditionalConfigurationRepositoryAndInvalidRegistryRepository() {
+ new OrchestrationRepositoryFacade(new OrchestrationConfiguration("test", new OrchestrationCenterConfiguration("REG", "127.0.0.1:8888", new Properties()), true));
+ }
+
+ @Test
+ public void assertCloseWithoutAdditionalConfigurationRepository() {
+ OrchestrationRepositoryFacade actual = new OrchestrationRepositoryFacade(
+ new OrchestrationConfiguration("test", new OrchestrationCenterConfiguration("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() {
+ OrchestrationRepositoryFacade actual = new OrchestrationRepositoryFacade(new OrchestrationConfiguration("test",
+ new OrchestrationCenterConfiguration("ALL", "127.0.0.1:8888", new Properties()), new OrchestrationCenterConfiguration("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-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/resources/META-INF/services/org.apache.shardingsphere.orchestration.repository.api.RegistryRepository b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/resources/META-INF/services/org.apache.shardingsphere.orchestration.repository.api.RegistryR [...]
index 4492fb8..f3b7bf1 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/resources/META-INF/services/org.apache.shardingsphere.orchestration.repository.api.RegistryRepository
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-core/shardingsphere-orchestration-core-facade/src/test/resources/META-INF/services/org.apache.shardingsphere.orchestration.repository.api.RegistryRepository
@@ -16,3 +16,4 @@
#
org.apache.shardingsphere.orchestration.core.facade.fixture.TestRegistryRepository
+org.apache.shardingsphere.orchestration.core.facade.fixture.TestAllRepository
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/main/java/org/apache/shardingsphere/orchestration/repository/api/OrchestrationRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/main/java/org/apache/shardingsphere/orchestration/repository/api/OrchestrationRepository.java
index ed35b6d..6c5512f 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/main/java/org/apache/shardingsphere/orchestration/repository/api/OrchestrationRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-api/src/main/java/org/apache/shardingsphere/orchestration/repository/api/OrchestrationRepository.java
@@ -17,9 +17,9 @@
package org.apache.shardingsphere.orchestration.repository.api;
+import org.apache.shardingsphere.infra.spi.type.TypedSPI;
import org.apache.shardingsphere.orchestration.repository.api.config.OrchestrationCenterConfiguration;
import org.apache.shardingsphere.orchestration.repository.api.listener.DataChangedEventListener;
-import org.apache.shardingsphere.infra.spi.type.TypedSPI;
import java.util.List;
@@ -47,28 +47,20 @@ public interface OrchestrationRepository extends TypedSPI {
String get(String key);
/**
- * Persist data.
- *
- * @param key key of data
- * @param value value of data
- */
- void persist(String key, String value);
-
- /**
* Get node's sub-nodes list.
*
* @param key key of data
* @return sub-nodes name list
*/
List<String> getChildrenKeys(String key);
-
+
/**
- * Watch key or path of orchestration server.
+ * Persist data.
*
* @param key key of data
- * @param dataChangedEventListener data changed event listener
+ * @param value value of data
*/
- void watch(String key, DataChangedEventListener dataChangedEventListener);
+ void persist(String key, String value);
/**
* Delete node.
@@ -78,6 +70,14 @@ public interface OrchestrationRepository extends TypedSPI {
void delete(String key);
/**
+ * Watch key or path of orchestration server.
+ *
+ * @param key key of data
+ * @param listener data changed event listener
+ */
+ void watch(String key, DataChangedEventListener listener);
+
+ /**
* Close.
*/
void close();
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/main/java/org/apache/shardingsphere/orchestration/repository/apollo/ApolloRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apo [...]
index d83a514..5ffb75a 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/main/java/org/apache/shardingsphere/orchestration/repository/apollo/ApolloRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-apollo/src/main/java/org/apache/shardingsphere/orchestration/repository/apollo/ApolloRepository.java
@@ -82,6 +82,11 @@ public final class ApolloRepository implements ConfigurationRepository {
}
@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);
@@ -113,11 +118,6 @@ public final class ApolloRepository implements ConfigurationRepository {
}
}
- @Override
- public void delete(final String key) {
- openApiWrapper.remove(pathToKey(key));
- }
-
private String pathToKey(final String path) {
String key = path.replace(PATH_SEPARATOR, DOT_SEPARATOR);
return key.substring(key.indexOf(DOT_SEPARATOR) + 1);
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/main/java/org/apache/shardingsphere/orchestration/repository/etcd/EtcdRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/ [...]
index 133ac36..51b8a23 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/main/java/org/apache/shardingsphere/orchestration/repository/etcd/EtcdRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/main/java/org/apache/shardingsphere/orchestration/repository/etcd/EtcdRepository.java
@@ -99,6 +99,11 @@ public final class EtcdRepository implements ConfigurationRepository, RegistryRe
}
@Override
+ public void delete(final String key) {
+ client.getKVClient().delete(ByteSequence.from(key, Charsets.UTF_8));
+ }
+
+ @Override
public void watch(final String key, final DataChangedEventListener dataChangedEventListener) {
Watch.Listener listener = Watch.listener(response -> {
for (WatchEvent each : response.getEvents()) {
@@ -123,11 +128,6 @@ public final class EtcdRepository implements ConfigurationRepository, RegistryRe
}
@Override
- public void delete(final String key) {
- client.getKVClient().delete(ByteSequence.from(key, Charsets.UTF_8));
- }
-
- @Override
public void close() {
client.close();
}
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/main/resources/META-INF/services/org.apache.shardingsphere.orchestration.repository.api.ConfigurationRepository b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestr [...]
deleted file mode 100644
index 18eb005..0000000
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-etcd/src/main/resources/META-INF/services/org.apache.shardingsphere.orchestration.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.orchestration.repository.etcd.EtcdRepository
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-nacos/src/main/java/org/apache/shardingsphere/orchestration/repository/nacos/NacosRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-nacos/ [...]
index 1ced4bf..b319b82 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-nacos/src/main/java/org/apache/shardingsphere/orchestration/repository/nacos/NacosRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-nacos/src/main/java/org/apache/shardingsphere/orchestration/repository/nacos/NacosRepository.java
@@ -122,10 +122,10 @@ public final class NacosRepository implements ConfigurationRepository {
* Watch key or path of the config server.
*
* @param key key of data
- * @param dataChangedEventListener data changed event listener
+ * @param listener data changed event listener
*/
@Override
- public void watch(final String key, final DataChangedEventListener dataChangedEventListener) {
+ public void watch(final String key, final DataChangedEventListener listener) {
try {
String dataId = pathToKey(key);
String group = nacosProperties.getValue(NacosPropertyKey.GROUP);
@@ -138,7 +138,7 @@ public final class NacosRepository implements ConfigurationRepository {
@Override
public void receiveConfigInfo(final String configInfo) {
- dataChangedEventListener.onChange(new DataChangedEvent(key, configInfo, ChangedType.UPDATED));
+ listener.onChange(new DataChangedEvent(key, configInfo, ChangedType.UPDATED));
}
});
} catch (final NacosException ex) {
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/orchestration/repository/zookeeper/CuratorZookeeperRepository.java b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orch [...]
index 1f3b54a..e6238c4 100644
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/orchestration/repository/zookeeper/CuratorZookeeperRepository.java
+++ b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-zookeeper-curator/src/main/java/org/apache/shardingsphere/orchestration/repository/zookeeper/CuratorZookeeperRepository.java
@@ -135,6 +135,20 @@ public final class CuratorZookeeperRepository implements ConfigurationRepository
}
@Override
+ public List<String> getChildrenKeys(final String key) {
+ try {
+ List<String> result = client.getChildren().forPath(key);
+ result.sort(Comparator.reverseOrder());
+ return result;
+ // CHECKSTYLE:OFF
+ } catch (final Exception ex) {
+ // CHECKSTYLE:ON
+ CuratorZookeeperExceptionHandler.handleException(ex);
+ return Collections.emptyList();
+ }
+ }
+
+ @Override
public void persist(final String key, final String value) {
try {
if (!isExisted(key)) {
@@ -196,21 +210,20 @@ public final class CuratorZookeeperRepository implements ConfigurationRepository
}
@Override
- public List<String> getChildrenKeys(final String key) {
+ public void delete(final String key) {
try {
- List<String> result = client.getChildren().forPath(key);
- result.sort(Comparator.reverseOrder());
- return result;
+ if (isExisted(key)) {
+ client.delete().deletingChildrenIfNeeded().forPath(key);
+ }
// CHECKSTYLE:OFF
- } catch (final Exception ex) {
+ } catch (Exception ex) {
// CHECKSTYLE:ON
CuratorZookeeperExceptionHandler.handleException(ex);
- return Collections.emptyList();
}
}
@Override
- public void watch(final String key, final DataChangedEventListener dataChangedEventListener) {
+ public void watch(final String key, final DataChangedEventListener listener) {
final String path = key + "/";
if (!caches.containsKey(path)) {
addCacheData(key);
@@ -223,7 +236,7 @@ public final class CuratorZookeeperRepository implements ConfigurationRepository
}
DataChangedEvent.ChangedType changedType = getChangedType(event);
if (ChangedType.IGNORED != changedType) {
- dataChangedEventListener.onChange(new DataChangedEvent(data.getPath(), null == data.getData() ? null : new String(data.getData(), Charsets.UTF_8), changedType));
+ listener.onChange(new DataChangedEvent(data.getPath(), null == data.getData() ? null : new String(data.getData(), Charsets.UTF_8), changedType));
}
});
}
@@ -254,26 +267,13 @@ public final class CuratorZookeeperRepository implements ConfigurationRepository
}
@Override
- public void delete(final String key) {
- try {
- if (isExisted(key)) {
- client.delete().deletingChildrenIfNeeded().forPath(key);
- }
- // CHECKSTYLE:OFF
- } catch (Exception ex) {
- // CHECKSTYLE:ON
- CuratorZookeeperExceptionHandler.handleException(ex);
- }
- }
-
- @Override
public void close() {
caches.values().forEach(TreeCache::close);
waitForCacheClose();
CloseableUtils.closeQuietly(client);
}
- /* TODO wait 500ms, close cache before close client, or will throw exception
+ /* TODO wait 500ms, close cache before close client, or will throw exception
* Because of asynchronous processing, may cause client to close
* first and cache has not yet closed the end.
* Wait for new version of Curator to fix this.
diff --git a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-zookeeper-curator/src/main/resources/META-INF/services/org.apache.shardingsphere.orchestration.repository.api.ConfigurationRepository b/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsp [...]
deleted file mode 100644
index 8d34647..0000000
--- a/shardingsphere-control-panel/shardingsphere-orchestration/shardingsphere-orchestration-repository/shardingsphere-orchestration-repository-provider/shardingsphere-orchestration-repository-zookeeper-curator/src/main/resources/META-INF/services/org.apache.shardingsphere.orchestration.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.orchestration.repository.zookeeper.CuratorZookeeperRepository
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/fixture/TestConfigurationRepository.java b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/fixture/TestConfigurationRepository.java
index 9c65e09..644f56c 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/fixture/TestConfigurationRepository.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/fixture/TestConfigurationRepository.java
@@ -57,11 +57,11 @@ public final class TestConfigurationRepository implements ConfigurationRepositor
}
@Override
- public void watch(final String key, final DataChangedEventListener dataChangedEventListener) {
+ public void delete(final String key) {
}
@Override
- public void delete(final String key) {
+ public void watch(final String key, final DataChangedEventListener listener) {
}
@Override
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/fixture/TestRegistryRepository.java b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/fixture/TestRegistryRepository.java
index 48c8210..95ac948 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/fixture/TestRegistryRepository.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-orchestration/src/test/java/org/apache/shardingsphere/driver/orchestration/fixture/TestRegistryRepository.java
@@ -63,11 +63,11 @@ public final class TestRegistryRepository implements RegistryRepository, Configu
}
@Override
- public void watch(final String key, final DataChangedEventListener dataChangedEventListener) {
+ public void delete(final String key) {
}
@Override
- public void delete(final String key) {
+ public void watch(final String key, final DataChangedEventListener listener) {
}
@Override
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/orchestration/registry/TestOrchestrationRepository.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/orchestration/registry/TestOrchest [...]
index 3088c06..11d08ca 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/orchestration/registry/TestOrchestrationRepository.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/orchestration/registry/TestOrchestrationRepository.java
@@ -63,12 +63,11 @@ public final class TestOrchestrationRepository implements RegistryRepository, Co
}
@Override
- public void watch(final String key, final DataChangedEventListener dataChangedEventListener) {
+ public void delete(final String key) {
}
@Override
- public void delete(final String key) {
-
+ public void watch(final String key, final DataChangedEventListener listener) {
}
@Override
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/orchestration/type/OrchestrationSpringBootEncryptTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/orchestration/type/Orchestratio [...]
index 7817860..15cb103 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/orchestration/type/OrchestrationSpringBootEncryptTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/orchestration/type/OrchestrationSpringBootEncryptTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.spring.boot.orchestration.type;
-import lombok.SneakyThrows;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource;
import org.apache.shardingsphere.driver.orchestration.internal.datasource.OrchestrationShardingSphereDataSource;
@@ -55,8 +54,7 @@ public class OrchestrationSpringBootEncryptTest {
}
@Test
- @SneakyThrows(ReflectiveOperationException.class)
- public void assertWithEncryptDataSource() {
+ public void assertWithEncryptDataSource() throws NoSuchFieldException, IllegalAccessException {
assertTrue(dataSource instanceof OrchestrationShardingSphereDataSource);
Field field = OrchestrationShardingSphereDataSource.class.getDeclaredField("dataSource");
field.setAccessible(true);
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/registry/TestOrchestrationRepository.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/registry/TestOrc [...]
index d84786e..7177383 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/registry/TestOrchestrationRepository.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-orchestration-spring/shardingsphere-jdbc-orchestration-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/orchestration/registry/TestOrchestrationRepository.java
@@ -57,11 +57,11 @@ public final class TestOrchestrationRepository implements RegistryRepository, Co
}
@Override
- public void watch(final String key, final DataChangedEventListener dataChangedEventListener) {
+ public void delete(final String key) {
}
@Override
- public void delete(final String key) {
+ public void watch(final String key, final DataChangedEventListener listener) {
}
@Override