KeeperContainerServiceImpl extends AbstractConsoleService<KeepercontainerTblDao> implements KeeperContainerService { protected boolean keeperContainerAlreadyExists(KeeperContainerCreateInfo createInfo) { KeepercontainerTbl existing = queryHandler.handleQuery(new DalQuery<KeepercontainerTbl>() { @Override public KeepercontainerTbl doQuery() throws DalException { return dao.findByIpPort(createInfo.getKeepercontainerIp(), createInfo.getKeepercontainerPort(), KeepercontainerTblEntity.READSET_CONTAINER_ADDRESS); } }); return existing != null; }  @Override KeepercontainerTbl find(final long id); @Override List<KeepercontainerTbl> findAllByDcName(final String dcName); @Override List<KeepercontainerTbl> findAllActiveByDcName(String dcName); @Override List<KeepercontainerTbl> findKeeperCount(String dcName); @Override List<KeepercontainerTbl> findBestKeeperContainersByDcCluster(String dcName, String clusterName); @Override void addKeeperContainer(final KeeperContainerCreateInfo createInfo); @Override List<KeeperContainerCreateInfo> getDcAllKeeperContainers(String dc); @Override void updateKeeperContainer(KeeperContainerCreateInfo createInfo); @Override List<KeeperContainerInfoModel> findAllInfos();  }
@Test public void testKeeperContainerAlreadyExists() { KeeperContainerCreateInfo existKeeperContainer = new KeeperContainerCreateInfo() .setKeepercontainerIp("127.0.0.1").setKeepercontainerPort(7080); KeeperContainerCreateInfo newKeeperContainer = new KeeperContainerCreateInfo() .setKeepercontainerIp("127.0.0.1").setKeepercontainerPort(9090); Assert.assertTrue(keeperContainerService.keeperContainerAlreadyExists(existKeeperContainer)); Assert.assertFalse(keeperContainerService.keeperContainerAlreadyExists(newKeeperContainer)); }