ShardServiceImpl extends AbstractConsoleService<ShardTblDao> implements ShardService { @VisibleForTesting protected ShardDeleteEvent createShardDeleteEvent(String clusterName, ClusterTbl clusterTbl, String shardName, ShardTbl shardTbl, Map<Long, SetinelTbl> sentinelTblMap) { ClusterType clusterType = ClusterType.lookup(clusterTbl.getClusterType()); ShardDeleteEvent shardDeleteEvent = new ShardDeleteEvent(clusterName, shardName, executors); shardDeleteEvent.setClusterType(clusterType); if (null != clusterType && clusterType.supportMultiActiveDC()) { return null; } try { shardDeleteEvent.setShardMonitorName(metaCache.getSentinelMonitorName(clusterName, shardTbl.getShardName())); } catch (Exception e) { logger.warn("[createClusterEvent]", e); long activeDcId = clusterService.find(clusterName).getActivedcId(); String activeDcName = dcService.getDcName(activeDcId); shardDeleteEvent.setShardMonitorName(SentinelUtil.getSentinelMonitorName( clusterName, shardTbl.getSetinelMonitorName(), activeDcName)); } StringBuffer sb = new StringBuffer(); for(SetinelTbl setinelTbl : sentinelTblMap.values()) { sb.append(setinelTbl.getSetinelAddress()).append(","); } sb.deleteCharAt(sb.length() - 1); shardDeleteEvent.setShardSentinels(sb.toString()); shardEventListeners.forEach(shardEventListener -> shardDeleteEvent.addObserver(shardEventListener)); return shardDeleteEvent; }  @Override ShardTbl find(final long shardId); @Override ShardTbl find(final String clusterName, final String shardName); @Override List<ShardTbl> findAllByClusterName(final String clusterName); @Override List<ShardTbl> findAllShardNamesByClusterName(final String clusterName); @Override synchronized ShardTbl createShard(final String clusterName, final ShardTbl shard,
											 final Map<Long, SetinelTbl> sentinels); @Override synchronized ShardTbl findOrCreateShardIfNotExist(String clusterName, ShardTbl shard,
															 Map<Long, SetinelTbl> sentinels); @Override void deleteShard(final String clusterName, final String shardName); @Override List<ShardListModel> findAllUnhealthy();  }
@Test public void testCreateForCRDTCluster() { String clusterId = "test-cluster"; String shardId = "test-shard"; ShardEvent shardEvent = shardService.createShardDeleteEvent(clusterId, new ClusterTbl().setClusterName(clusterId).setClusterType(ClusterType.BI_DIRECTION.toString()), shardId, new ShardTbl(), null); Assert.assertNull(shardEvent); }