ClusterDao extends AbstractXpipeConsoleDAO { @DalTransaction public ClusterTbl findClusterAndOrgByName(final String clusterName) { ClusterTbl proto = queryHandler.handleQuery(new DalQuery<ClusterTbl>() { @Override public ClusterTbl doQuery() throws DalException { return clusterTblDao.findClusterAndOrgByClusterName(clusterName, ClusterTblEntity.READSET_FULL_WITH_ORG); } }); String clusterOrgName = proto.getClusterOrgName(); if(clusterOrgName == null || clusterOrgName.trim().isEmpty()) { proto.setClusterOrgName(proto.getOrganizationInfo().getOrgName()); } return proto; }  @DalTransaction ClusterTbl createCluster(final ClusterTbl cluster); @DalTransaction void updateCluster(ClusterTbl cluster); @DalTransaction void deleteCluster(final ClusterTbl cluster); @DalTransaction int bindDc(final ClusterTbl cluster, final DcTbl dc, SetinelTbl sentinel); @DalTransaction int unbindDc(final ClusterTbl cluster, final DcTbl dc); @DalTransaction ClusterTbl findClusterAndOrgByName(final String clusterName); List<ClusterTbl> findAllClusterWithOrgInfo(); List<ClusterTbl> findClusterWithOrgInfoByClusterType(String type); List<ClusterTbl> findClustersWithOrgInfoByActiveDcId(final long dcId); List<ClusterTbl> findAllByDcId(final long dcId); List<ClusterTbl> findClustersWithName(List<String> clusterNames);  }
@Test public void testFindClusterAndOrgByName() throws DalException { String clusterName = "cluster2"; ClusterTbl clusterTbl1 = clusterDao.findClusterAndOrgByName(clusterName); List<OrganizationTbl> orgs = organizationService.getAllOrganizations(); orgs.forEach(org->logger.info("{}", org)); logger.info("{}", clusterTbl1); Assert.assertEquals(2L, (long)clusterTbl1.getOrganizationInfo().getId()); Assert.assertEquals("org-1", clusterTbl1.getClusterOrgName()); }