@Test @Ignore public void testCheckMetaServerManually() throws Exception { String metaServers = "{\n" + " \"NTGXH\": \"http: " \"FAT\": \"http: " \"FAT-AWS\": \"http: "}"; when(consoleConfig.getMetaservers()).thenReturn(metaServers); when(consoleConfig.getClusterShardForMigrationSysCheck()).thenReturn(Pair.from("cluster_shyin", "shard1")); builder = new DefaultCheckMigrationCommandBuilder(scheduled, dcService, clusterService, outerClientService, consoleConfig); RetMessage message = builder.checkCommand(CHECK_MIGRATION_SYSTEM_STEP.CHECK_METASERVER).execute().get(); logger.info("{}", message); }
@Override public Command<RetMessage> checkCommand(CHECK_MIGRATION_SYSTEM_STEP step) { Pair<String, String> clusterShard = consoleConfig.getClusterShardForMigrationSysCheck(); String clusterName = clusterShard.getKey(), shardName = clusterShard.getValue(); switch (step) { case CHECK_DATA_BASE: return checkDatabaseRetryCommand(clusterName); case CHECK_OUTER_CLIENT: return new CheckOuterClientCommand(clusterName); case CHECK_METASERVER: Map<String, String> metaServers = fetchMetaServerConfig(); return new CheckMetaServerCommand(metaServers, clusterName, shardName); } return null; }
DefaultCheckMigrationCommandBuilder extends AbstractService implements CheckMigrationCommandBuilder { @Override public Command<RetMessage> checkCommand(CHECK_MIGRATION_SYSTEM_STEP step) { Pair<String, String> clusterShard = consoleConfig.getClusterShardForMigrationSysCheck(); String clusterName = clusterShard.getKey(), shardName = clusterShard.getValue(); switch (step) { case CHECK_DATA_BASE: return checkDatabaseRetryCommand(clusterName); case CHECK_OUTER_CLIENT: return new CheckOuterClientCommand(clusterName); case CHECK_METASERVER: Map<String, String> metaServers = fetchMetaServerConfig(); return new CheckMetaServerCommand(metaServers, clusterName, shardName); } return null; } }
DefaultCheckMigrationCommandBuilder extends AbstractService implements CheckMigrationCommandBuilder { @Override public Command<RetMessage> checkCommand(CHECK_MIGRATION_SYSTEM_STEP step) { Pair<String, String> clusterShard = consoleConfig.getClusterShardForMigrationSysCheck(); String clusterName = clusterShard.getKey(), shardName = clusterShard.getValue(); switch (step) { case CHECK_DATA_BASE: return checkDatabaseRetryCommand(clusterName); case CHECK_OUTER_CLIENT: return new CheckOuterClientCommand(clusterName); case CHECK_METASERVER: Map<String, String> metaServers = fetchMetaServerConfig(); return new CheckMetaServerCommand(metaServers, clusterName, shardName); } return null; } DefaultCheckMigrationCommandBuilder(ScheduledExecutorService scheduled, DcService dcService, ClusterService clusterService,
                                               OuterClientService outerClientService, ConsoleConfig consoleConfig); }
DefaultCheckMigrationCommandBuilder extends AbstractService implements CheckMigrationCommandBuilder { @Override public Command<RetMessage> checkCommand(CHECK_MIGRATION_SYSTEM_STEP step) { Pair<String, String> clusterShard = consoleConfig.getClusterShardForMigrationSysCheck(); String clusterName = clusterShard.getKey(), shardName = clusterShard.getValue(); switch (step) { case CHECK_DATA_BASE: return checkDatabaseRetryCommand(clusterName); case CHECK_OUTER_CLIENT: return new CheckOuterClientCommand(clusterName); case CHECK_METASERVER: Map<String, String> metaServers = fetchMetaServerConfig(); return new CheckMetaServerCommand(metaServers, clusterName, shardName); } return null; } DefaultCheckMigrationCommandBuilder(ScheduledExecutorService scheduled, DcService dcService, ClusterService clusterService,
                                               OuterClientService outerClientService, ConsoleConfig consoleConfig); @Override Command<RetMessage> checkCommand(CHECK_MIGRATION_SYSTEM_STEP step); }
DefaultCheckMigrationCommandBuilder extends AbstractService implements CheckMigrationCommandBuilder { @Override public Command<RetMessage> checkCommand(CHECK_MIGRATION_SYSTEM_STEP step) { Pair<String, String> clusterShard = consoleConfig.getClusterShardForMigrationSysCheck(); String clusterName = clusterShard.getKey(), shardName = clusterShard.getValue(); switch (step) { case CHECK_DATA_BASE: return checkDatabaseRetryCommand(clusterName); case CHECK_OUTER_CLIENT: return new CheckOuterClientCommand(clusterName); case CHECK_METASERVER: Map<String, String> metaServers = fetchMetaServerConfig(); return new CheckMetaServerCommand(metaServers, clusterName, shardName); } return null; } DefaultCheckMigrationCommandBuilder(ScheduledExecutorService scheduled, DcService dcService, ClusterService clusterService,
                                               OuterClientService outerClientService, ConsoleConfig consoleConfig); @Override Command<RetMessage> checkCommand(CHECK_MIGRATION_SYSTEM_STEP step);  }