@Test public void testGetClusterRelatedDcs() { List<DcTbl> dcTbls = clusterService.getClusterRelatedDcs("cluster101"); Set<Long> dcSet = Sets.newHashSet(); dcTbls.forEach(dcTbl -> {dcSet.add(dcTbl.getId());}); Assert.assertEquals(2, dcSet.size()); Assert.assertTrue(dcSet.contains(1L)); Assert.assertTrue(dcSet.contains(2L)); }
@Override public List<DcTbl> getClusterRelatedDcs(String clusterName) { ClusterTbl clusterTbl = find(clusterName); List<DcClusterTbl> dcClusterTbls = dcClusterService.findClusterRelated(clusterTbl.getId()); List<DcTbl> result = Lists.newLinkedList(); for(DcClusterTbl dcClusterTbl : dcClusterTbls) { result.add(dcService.find(dcClusterTbl.getDcId())); } return result; }
ClusterServiceImpl extends AbstractConsoleService<ClusterTblDao> implements ClusterService { @Override public List<DcTbl> getClusterRelatedDcs(String clusterName) { ClusterTbl clusterTbl = find(clusterName); List<DcClusterTbl> dcClusterTbls = dcClusterService.findClusterRelated(clusterTbl.getId()); List<DcTbl> result = Lists.newLinkedList(); for(DcClusterTbl dcClusterTbl : dcClusterTbls) { result.add(dcService.find(dcClusterTbl.getDcId())); } return result; } }
ClusterServiceImpl extends AbstractConsoleService<ClusterTblDao> implements ClusterService { @Override public List<DcTbl> getClusterRelatedDcs(String clusterName) { ClusterTbl clusterTbl = find(clusterName); List<DcClusterTbl> dcClusterTbls = dcClusterService.findClusterRelated(clusterTbl.getId()); List<DcTbl> result = Lists.newLinkedList(); for(DcClusterTbl dcClusterTbl : dcClusterTbls) { result.add(dcService.find(dcClusterTbl.getDcId())); } return result; }  }
ClusterServiceImpl extends AbstractConsoleService<ClusterTblDao> implements ClusterService { @Override public List<DcTbl> getClusterRelatedDcs(String clusterName) { ClusterTbl clusterTbl = find(clusterName); List<DcClusterTbl> dcClusterTbls = dcClusterService.findClusterRelated(clusterTbl.getId()); List<DcTbl> result = Lists.newLinkedList(); for(DcClusterTbl dcClusterTbl : dcClusterTbls) { result.add(dcService.find(dcClusterTbl.getDcId())); } return result; }  @Override ClusterTbl find(final String clusterName); @Override List<ClusterTbl> findAllByNames(List<String> clusterNames); @Override ClusterStatus clusterStatus(String clusterName); @Override List<DcTbl> getClusterRelatedDcs(String clusterName); @Override ClusterTbl find(final long clusterId); @Override List<String> findAllClusterNames(); @Override Long getAllCount(); @Override @DalTransaction synchronized ClusterTbl createCluster(ClusterModel clusterModel); long getOrgIdFromClusterOrgName(ClusterTbl cluster); @Override ClusterTbl findClusterAndOrg(String clusterName); @Override List<ClusterTbl> findClustersWithOrgInfoByActiveDcId(long activeDc); @Override List<ClusterTbl> findAllClustersWithOrgInfo(); @Override List<ClusterTbl> findClustersWithOrgInfoByClusterType(String clusterType); @Override void updateCluster(String clusterName, ClusterTbl cluster); @Override void updateActivedcId(long id, long activeDcId); @Override void updateStatusById(long id, ClusterStatus clusterStatus); @Override void deleteCluster(String clusterName); @Override void bindDc(String clusterName, String dcName); @Override void unbindDc(String clusterName, String dcName); @Override void update(final ClusterTbl cluster); boolean checkEmails(String emails); @Override List<String> reBalanceSentinels(String dcName, final int numOfClusters, final boolean activeOnly); @Override void reBalanceClusterSentinels(String dcName, final List<String> clusters); @Override List<ClusterListUnhealthyClusterModel> findUnhealthyClusters(); @Override List<ClusterTbl> findAllClusterByDcNameBind(String dcName); @Override List<ClusterTbl> findActiveClustersByDcName(String dcName); @Override List<ClusterTbl> findAllClustersByDcName(String dcName); @Override List<ClusterTbl> findAllClusterByKeeperContainer(long keeperContainerId); }
ClusterServiceImpl extends AbstractConsoleService<ClusterTblDao> implements ClusterService { @Override public List<DcTbl> getClusterRelatedDcs(String clusterName) { ClusterTbl clusterTbl = find(clusterName); List<DcClusterTbl> dcClusterTbls = dcClusterService.findClusterRelated(clusterTbl.getId()); List<DcTbl> result = Lists.newLinkedList(); for(DcClusterTbl dcClusterTbl : dcClusterTbls) { result.add(dcService.find(dcClusterTbl.getDcId())); } return result; }  @Override ClusterTbl find(final String clusterName); @Override List<ClusterTbl> findAllByNames(List<String> clusterNames); @Override ClusterStatus clusterStatus(String clusterName); @Override List<DcTbl> getClusterRelatedDcs(String clusterName); @Override ClusterTbl find(final long clusterId); @Override List<String> findAllClusterNames(); @Override Long getAllCount(); @Override @DalTransaction synchronized ClusterTbl createCluster(ClusterModel clusterModel); long getOrgIdFromClusterOrgName(ClusterTbl cluster); @Override ClusterTbl findClusterAndOrg(String clusterName); @Override List<ClusterTbl> findClustersWithOrgInfoByActiveDcId(long activeDc); @Override List<ClusterTbl> findAllClustersWithOrgInfo(); @Override List<ClusterTbl> findClustersWithOrgInfoByClusterType(String clusterType); @Override void updateCluster(String clusterName, ClusterTbl cluster); @Override void updateActivedcId(long id, long activeDcId); @Override void updateStatusById(long id, ClusterStatus clusterStatus); @Override void deleteCluster(String clusterName); @Override void bindDc(String clusterName, String dcName); @Override void unbindDc(String clusterName, String dcName); @Override void update(final ClusterTbl cluster); boolean checkEmails(String emails); @Override List<String> reBalanceSentinels(String dcName, final int numOfClusters, final boolean activeOnly); @Override void reBalanceClusterSentinels(String dcName, final List<String> clusters); @Override List<ClusterListUnhealthyClusterModel> findUnhealthyClusters(); @Override List<ClusterTbl> findAllClusterByDcNameBind(String dcName); @Override List<ClusterTbl> findActiveClustersByDcName(String dcName); @Override List<ClusterTbl> findAllClustersByDcName(String dcName); @Override List<ClusterTbl> findAllClusterByKeeperContainer(long keeperContainerId);  }