@Test public void iscfkeyExistingTest() throws Exception { List<ConfigPropertyMetadata> cfMetaList = new ArrayList<>(); ConfigPropertyMetadata meta1 = new ConfigPropertyMetadata(); meta1.setCfkey("applevelkey1"); meta1.setDescription("desc"); cfMetaList.add(meta1); ConfigPropertyMetadata meta2 = new ConfigPropertyMetadata(); meta2.setCfkey("applevelkey2"); meta2.setDescription("desc"); cfMetaList.add(meta2); when(configPropertyMetadataRepository.findAll()).thenReturn(cfMetaList); assertTrue(configPropertyService.isCfkeyExisting("applevelkey2")); }
@Override public boolean isCfkeyExisting(String cfkey) throws Exception { List<ConfigPropertyMetadata> configMetadataList = configPropertyMetadataRepository.findAll(); Map<String, String> cfkeyDescriptionMap = new HashMap<>(); configMetadataList.forEach(configMetadata -> { cfkeyDescriptionMap.put(configMetadata.getCfkey(), configMetadata.getDescription()); }); if (cfkeyDescriptionMap.containsKey(cfkey)) { return true; } else { return false; } }
ConfigPropertyServiceImpl implements ConfigPropertyService { @Override public boolean isCfkeyExisting(String cfkey) throws Exception { List<ConfigPropertyMetadata> configMetadataList = configPropertyMetadataRepository.findAll(); Map<String, String> cfkeyDescriptionMap = new HashMap<>(); configMetadataList.forEach(configMetadata -> { cfkeyDescriptionMap.put(configMetadata.getCfkey(), configMetadata.getDescription()); }); if (cfkeyDescriptionMap.containsKey(cfkey)) { return true; } else { return false; } } }
ConfigPropertyServiceImpl implements ConfigPropertyService { @Override public boolean isCfkeyExisting(String cfkey) throws Exception { List<ConfigPropertyMetadata> configMetadataList = configPropertyMetadataRepository.findAll(); Map<String, String> cfkeyDescriptionMap = new HashMap<>(); configMetadataList.forEach(configMetadata -> { cfkeyDescriptionMap.put(configMetadata.getCfkey(), configMetadata.getDescription()); }); if (cfkeyDescriptionMap.containsKey(cfkey)) { return true; } else { return false; } }  }
ConfigPropertyServiceImpl implements ConfigPropertyService { @Override public boolean isCfkeyExisting(String cfkey) throws Exception { List<ConfigPropertyMetadata> configMetadataList = configPropertyMetadataRepository.findAll(); Map<String, String> cfkeyDescriptionMap = new HashMap<>(); configMetadataList.forEach(configMetadata -> { cfkeyDescriptionMap.put(configMetadata.getCfkey(), configMetadata.getDescription()); }); if (cfkeyDescriptionMap.containsKey(cfkey)) { return true; } else { 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 isCfkeyExisting(String cfkey) throws Exception { List<ConfigPropertyMetadata> configMetadataList = configPropertyMetadataRepository.findAll(); Map<String, String> cfkeyDescriptionMap = new HashMap<>(); configMetadataList.forEach(configMetadata -> { cfkeyDescriptionMap.put(configMetadata.getCfkey(), configMetadata.getDescription()); }); if (cfkeyDescriptionMap.containsKey(cfkey)) { return true; } else { 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);  }