Add DMaaP Configuration APIs for Testing
[holmes/engine-management.git] / engine-d / src / main / java / org / onap / holmes / engine / resources / EngineResources.java
index 8f9a271..9724355 100644 (file)
@@ -33,6 +33,7 @@ import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import lombok.extern.slf4j.Slf4j;
 import org.jvnet.hk2.annotations.Service;
+import org.onap.holmes.common.dmaap.DmaapService;
 import org.onap.holmes.common.exception.CorrelationException;
 import org.onap.holmes.common.utils.ExceptionUtil;
 import org.onap.holmes.common.utils.LanguageUtil;
@@ -56,8 +57,8 @@ public class EngineResources {
     @Produces(MediaType.APPLICATION_JSON)
     @Timed
     public CorrelationRuleResponse deployRule(
-            @ApiParam(value = "The request entity of the HTTP call, which comprises two "
-                    + "fields: \"content\" and \"engineid\". "
+            @ApiParam(value = "The request entity of the HTTP call, which comprises three "
+                    + "fields: \"content\" , \"loopcontrolname\" and \"engineid\". "
                     + "The \"content\" should be a valid Drools rule string and the \"engineid\" "
                     + "has to be \"engine-d\" in the Amsterdam release.", required = true) DeployRuleRequest deployRuleRequest,
             @Context HttpServletRequest httpRequest) {
@@ -65,8 +66,9 @@ public class EngineResources {
         CorrelationRuleResponse crResponse = new CorrelationRuleResponse();
         Locale locale = LanguageUtil.getLocale(httpRequest);
         try {
-
             String packageName = droolsEngine.deployRule(deployRuleRequest, locale);
+            DmaapService.loopControlNames
+                    .put(packageName, deployRuleRequest.getLoopControlName());
             log.info("Rule deployed. Package name: " + packageName);
             crResponse.setPackageName(packageName);