Commit 17e317fa authored by jashaikh's avatar jashaikh

Added Jacoco Code Coverage For Sonar.

parent 1f309f6e
...@@ -14,6 +14,8 @@ import org.slf4j.LoggerFactory; ...@@ -14,6 +14,8 @@ import org.slf4j.LoggerFactory;
public class AzureAppConfigService { public class AzureAppConfigService {
private static final Logger LOGGER = LoggerFactory.getLogger(AzureAppConfigService.class); private static final Logger LOGGER = LoggerFactory.getLogger(AzureAppConfigService.class);
private static final String EXISTING_KEY = "config.message";
private static final String NEW_KEY = "config.dataSource";
private final ConfigurationClient configurationClient; private final ConfigurationClient configurationClient;
private final SettingSelector settingSelector; private final SettingSelector settingSelector;
...@@ -85,17 +87,17 @@ public class AzureAppConfigService { ...@@ -85,17 +87,17 @@ public class AzureAppConfigService {
*/ */
public void azureAppConfiguration() { public void azureAppConfiguration() {
try { try {
String readValueByKey = getValueByKey("config.message"); String readValueByKey = getValueByKey(EXISTING_KEY);
LOGGER.info("Message: {}", readValueByKey); LOGGER.info("Message: {}", readValueByKey);
String writeValueByKey = writeValueByKey("config.datasource", "Data Source URL"); String writeValueByKey = writeValueByKey(NEW_KEY, "Data Source URL");
LOGGER.info("Data Source URL From Application: {}", writeValueByKey); LOGGER.info("Data Source URL From Application: {}", writeValueByKey);
PagedIterable<ConfigurationSetting> readAllKeyValue = readAllKeyValue(); PagedIterable<ConfigurationSetting> readAllKeyValue = readAllKeyValue();
readAllKeyValue.forEach(property -> LOGGER.info("Key: {} \t Value: {}", property.getKey(), property.getValue())); readAllKeyValue.forEach(property -> LOGGER.info("Key: {} \t Value: {}", property.getKey(), property.getValue()));
String deleteValueByKey = deleteValueByKey("config.datasource"); String deleteValueByKey = deleteValueByKey(NEW_KEY);
LOGGER.warn("[Key: {} \t Value: {}] has been removed successfully", "config.datasource", deleteValueByKey); LOGGER.warn("[Key: {} \t Value: {}] has been removed successfully", NEW_KEY, deleteValueByKey);
LOGGER.info("After Removing Key-Value Read All Values..."); LOGGER.info("After Removing Key-Value Read All Values...");
readAllKeyValue = readAllKeyValue(); readAllKeyValue = readAllKeyValue();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment