DcMetaBuilder extends AbstractCommand<DcMeta> { public DcMetaBuilder setCluster2DcClusterMap(Map<Long, List<DcClusterTbl>> cluster2DcClusterMap) { this.cluster2DcClusterMap = cluster2DcClusterMap; return this; } DcMetaBuilder(DcMeta dcMeta, long dcId, Set<String> clusterTypes, ExecutorService executors, RedisMetaService redisMetaService, DcClusterService dcClusterService,
                         ClusterMetaService clusterMetaService, DcClusterShardService dcClusterShardService, DcService dcService, RetryCommandFactory factory); @Override String getName(); @VisibleForTesting ClusterMeta getOrCreateClusterMeta(ClusterTbl cluster); ShardMeta getOrCreateShardMeta(String clusterId, ShardTbl shard, long sentinelId); DcMetaBuilder setDcNameMap(Map<Long, String> dcNameMap); DcMetaBuilder setCluster2DcClusterMap(Map<Long, List<DcClusterTbl>> cluster2DcClusterMap); DcMetaBuilder setDcClusterShards(List<DcClusterShardTbl> dcClusterShards);  }
@Test public void testClusterBondToOnlyOneIDC() throws Exception { ClusterModel clusterModel = new ClusterModel(); ClusterTbl clusterTbl = new ClusterTbl(); clusterTbl.setActivedcId(1).setClusterAdminEmails("test@test.com").setClusterName("test-one-dc-cluster") .setClusterType(ClusterType.ONE_WAY.toString()) .setClusterOrgId(1).setClusterDescription("not null").setStatus("Normal"); clusterModel.setClusterTbl(clusterTbl); clusterModel.setShards(Lists.newArrayList()); clusterModel.setDcs(Lists.newArrayList()); clusterTbl = clusterService.createCluster(clusterModel); dcClusterService.addDcCluster(dcService.getDcName(1), "test-one-dc-cluster"); Map<Long, List<DcClusterTbl>> map = Maps.newHashMap(); map.put(clusterTbl.getId(), Lists.newArrayList(new DcClusterTbl().setClusterId(clusterTbl.getId()).setDcId(1))); builder.setCluster2DcClusterMap(map); }