@Test public void isApplicationExistingTest() throws Exception { List<ConfigPropertyRelation> relationlist = new ArrayList<>(); ConfigPropertyRelation relation1 = new ConfigPropertyRelation(); relation1.setApplication("application"); relation1.setParent("root"); relationlist.add(relation1); ConfigPropertyRelation relation2 = new ConfigPropertyRelation(); relation2.setApplication("api"); relation2.setParent("application"); relationlist.add(relation2); ConfigPropertyRelation relation3 = new ConfigPropertyRelation(); relation3.setApplication("asset-service"); relation3.setParent("api"); relationlist.add(relation3); when(configRelationRepository.findAll()).thenReturn(relationlist); assertTrue(configPropertyService.isApplicationExisting("api")); }
@Override public boolean isApplicationExisting(String application) throws Exception { List<ConfigPropertyRelation> configRelationList = configPropertyRelationRepository.findAll(); Map<String, String> applicationParentMap = new HashMap<>(); configRelationList.forEach(configRelation -> { applicationParentMap.put(configRelation.getApplication(), configRelation.getParent()); }); if (applicationParentMap.containsKey(application)) { return true; } return false; }
ConfigPropertyServiceImpl implements ConfigPropertyService { @Override public boolean isApplicationExisting(String application) throws Exception { List<ConfigPropertyRelation> configRelationList = configPropertyRelationRepository.findAll(); Map<String, String> applicationParentMap = new HashMap<>(); configRelationList.forEach(configRelation -> { applicationParentMap.put(configRelation.getApplication(), configRelation.getParent()); }); if (applicationParentMap.containsKey(application)) { return true; } return false; } }
ConfigPropertyServiceImpl implements ConfigPropertyService { @Override public boolean isApplicationExisting(String application) throws Exception { List<ConfigPropertyRelation> configRelationList = configPropertyRelationRepository.findAll(); Map<String, String> applicationParentMap = new HashMap<>(); configRelationList.forEach(configRelation -> { applicationParentMap.put(configRelation.getApplication(), configRelation.getParent()); }); if (applicationParentMap.containsKey(application)) { return true; } return false; }  }
ConfigPropertyServiceImpl implements ConfigPropertyService { @Override public boolean isApplicationExisting(String application) throws Exception { List<ConfigPropertyRelation> configRelationList = configPropertyRelationRepository.findAll(); Map<String, String> applicationParentMap = new HashMap<>(); configRelationList.forEach(configRelation -> { applicationParentMap.put(configRelation.getApplication(), configRelation.getParent()); }); if (applicationParentMap.containsKey(application)) { return true; } return false; }  @Override ConfigTreeNode listProperties(); @Override @Transactional List<ConfigProperty> addUpdateProperties(ConfigPropertyRequest configPropertyRequest, String user,
			String userMessage, String timeNow, boolean partOfRollbackOperation); @Override @Transactional String deleteProperty(ConfigPropertyItem configPropertyItem, String user, String userMessage, String timeNow,
			boolean partOfRollbackOperation); @Override boolean isAllPropertiesExisting(ConfigPropertyRequest configPropertyRequest); @Override boolean isAnyPropertyExisting(ConfigPropertyRequest configPropertyRequest); @Override boolean isPropertyExisting(ConfigPropertyItem configPropertyItem); @Override boolean isCfkeyExisting(String cfkey); @Override boolean isAllCfkeysExisting(ConfigPropertyRequest configPropertyRequest); @Override boolean isApplicationExisting(String application); @Override boolean isAllApplicationsExisting(ConfigPropertyRequest configPropertyRequest); @Override List<String> listAllKeys(); @Override ConfigPropertyAuditTrail listAllConfigPropertyAudits(String timestamp); @Override ConfigPropertyRollbackPreview getRollbackPreview(String timestamp); @Override @Transactional String doConfigPropertyRollbackToTimestamp(String timestamp, String user, String userMessage); @Override List<ConfigProperty> listProperty(String cfkey, String application); }
ConfigPropertyServiceImpl implements ConfigPropertyService { @Override public boolean isApplicationExisting(String application) throws Exception { List<ConfigPropertyRelation> configRelationList = configPropertyRelationRepository.findAll(); Map<String, String> applicationParentMap = new HashMap<>(); configRelationList.forEach(configRelation -> { applicationParentMap.put(configRelation.getApplication(), configRelation.getParent()); }); if (applicationParentMap.containsKey(application)) { return true; } return false; }  @Override ConfigTreeNode listProperties(); @Override @Transactional List<ConfigProperty> addUpdateProperties(ConfigPropertyRequest configPropertyRequest, String user,
			String userMessage, String timeNow, boolean partOfRollbackOperation); @Override @Transactional String deleteProperty(ConfigPropertyItem configPropertyItem, String user, String userMessage, String timeNow,
			boolean partOfRollbackOperation); @Override boolean isAllPropertiesExisting(ConfigPropertyRequest configPropertyRequest); @Override boolean isAnyPropertyExisting(ConfigPropertyRequest configPropertyRequest); @Override boolean isPropertyExisting(ConfigPropertyItem configPropertyItem); @Override boolean isCfkeyExisting(String cfkey); @Override boolean isAllCfkeysExisting(ConfigPropertyRequest configPropertyRequest); @Override boolean isApplicationExisting(String application); @Override boolean isAllApplicationsExisting(ConfigPropertyRequest configPropertyRequest); @Override List<String> listAllKeys(); @Override ConfigPropertyAuditTrail listAllConfigPropertyAudits(String timestamp); @Override ConfigPropertyRollbackPreview getRollbackPreview(String timestamp); @Override @Transactional String doConfigPropertyRollbackToTimestamp(String timestamp, String user, String userMessage); @Override List<ConfigProperty> listProperty(String cfkey, String application);  }