Merge "Add tests to increase code coverage"
[nonrtric.git] / policy-agent / src / main / java / org / oransc / policyagent / configuration / ApplicationConfigParser.java
index ea66053..a76f964 100644 (file)
@@ -70,8 +70,10 @@ public class ApplicationConfigParser {
         Properties dmaapConsumerConfig = new Properties();
 
         JsonObject agentConfigJson = root.getAsJsonObject(CONFIG);
-        List<RicConfig> ricConfigs = parseRics(agentConfigJson);
-        Map<String, ControllerConfig> controllerConfigs = parseControllerConfigs(agentConfigJson);
+
+        if (agentConfigJson == null) {
+            throw new ServiceException("Missing root configuration \"" + CONFIG + "\" in JSON: " + root);
+        }
 
         JsonObject json = agentConfigJson.getAsJsonObject("streams_publishes");
         if (json != null) {
@@ -83,6 +85,8 @@ public class ApplicationConfigParser {
             dmaapConsumerConfig = parseDmaapConfig(json);
         }
 
+        List<RicConfig> ricConfigs = parseRics(agentConfigJson);
+        Map<String, ControllerConfig> controllerConfigs = parseControllerConfigs(agentConfigJson);
         checkConfigurationConsistency(ricConfigs, controllerConfigs);
 
         return ImmutableConfigParserResult.builder() //
@@ -205,8 +209,8 @@ public class ApplicationConfigParser {
             dmaapProps.put("group", path.consumerGroup);
             dmaapProps.put("id", path.consumerId);
             dmaapProps.put("TransportType", ProtocolTypeConstants.HTTPNOAUTH.toString());
-            dmaapProps.put("timeout", 15000);
-            dmaapProps.put("limit", 100);
+            dmaapProps.put("timeout", "15000");
+            dmaapProps.put("limit", "100");
             dmaapProps.put("maxBatchSize", "10");
             dmaapProps.put("maxAgeMs", "10000");
             dmaapProps.put("compress", true);