You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2021/11/30 15:01:51 UTC

[shardingsphere] branch master updated: Update MGRDatabaseDiscoveryTypeTest.java (#13870)

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 0f13073  Update MGRDatabaseDiscoveryTypeTest.java (#13870)
0f13073 is described below

commit 0f13073a21df3f6bf5d9ae4ccc1060f0d7a7b8fd
Author: yx9o <ya...@163.com>
AuthorDate: Tue Nov 30 23:00:53 2021 +0800

    Update MGRDatabaseDiscoveryTypeTest.java (#13870)
---
 .../dbdiscovery/mgr/MGRDatabaseDiscoveryTypeTest.java        | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mgr/src/test/java/org/apache/shardingsphere/dbdiscovery/mgr/MGRDatabaseDiscoveryTypeTest.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mgr/src/test/java/org/apache/shardingsphere/dbdiscovery/mgr/MGRDatabaseDiscoveryTypeTest.java
index a940d06..802cf74 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mgr/src/test/java/org/apache/shardingsphere/dbdiscovery/mgr/MGRDatabaseDiscoveryTypeTest.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mgr/src/test/java/org/apache/shardingsphere/dbdiscovery/mgr/MGRDatabaseDiscoveryTypeTest.java
@@ -20,7 +20,6 @@ package org.apache.shardingsphere.dbdiscovery.mgr;
 import com.google.common.eventbus.EventBus;
 import lombok.SneakyThrows;
 import org.apache.curator.framework.CuratorFramework;
-import org.apache.curator.test.TestingServer;
 import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap;
 import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
 import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperConfiguration;
@@ -42,7 +41,7 @@ import java.sql.DatabaseMetaData;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
-import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -61,10 +60,6 @@ import static org.mockito.Mockito.when;
 
 public final class MGRDatabaseDiscoveryTypeTest {
     
-    private static TestingServer server;
-    
-    private static CuratorFramework client;
-    
     private static final String PLUGIN_STATUS = "SELECT * FROM information_schema.PLUGINS WHERE PLUGIN_NAME='group_replication'";
     
     private static final String MEMBER_COUNT = "SELECT count(*) FROM performance_schema.replication_group_members";
@@ -165,12 +160,9 @@ public final class MGRDatabaseDiscoveryTypeTest {
             when(databaseMetaData.get(i).getURL()).thenReturn("jdbc:mysql://127.0.0.1:" + (3306 + i) + "/ds_0?serverTimezone=UTC&useSSL=false");
         }
         Map<String, DataSource> dataSourceMap = new HashMap<>(3, 1);
-        List<String> disabledDataSourceNames = new ArrayList<>();
+        List<String> disabledDataSourceNames = Arrays.asList("ds_1");
         for (int i = 0; i < 3; i++) {
             dataSourceMap.put(String.format("ds_%s", i), dataSources.get(i));
-            if (disabledDataSourceNames.isEmpty()) {
-                disabledDataSourceNames.add(String.format("ds_1", i));
-            }
         }
         mgrHaType.updateMemberState("discovery_db", dataSourceMap, disabledDataSourceNames);
         verify(eventBus).post(Mockito.refEq(new DataSourceDisabledEvent("discovery_db", "ds_2", true)));