summaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src
diff options
context:
space:
mode:
authorTej, Tarun <tt3868@att.com>2017-10-10 17:11:54 -0400
committerTej, Tarun <tt3868@att.com>2017-10-10 17:12:31 -0400
commit6200a3b57dcce7890df56c80ec388608c8ea391d (patch)
tree4008ff9660a77086516f827d841ef26209125989 /POLICY-SDK-APP/src
parent2ebd62710f2bcd92627e6a79da25da25ac2750af (diff)
Fixing the BRMS rule generation issue
Fixing the rule params section to look for PapParams istead of Params. This will be a temporary solution for now. Issue-Id: POLICY-302 Change-Id: I4b6b415b3eacf121be374d2dfd50303049c35aba Signed-off-by: Tej, Tarun <tt3868@att.com>
Diffstat (limited to 'POLICY-SDK-APP/src')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSParamController.java12
-rw-r--r--POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt2
-rw-r--r--POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Raw_TestBRMSRawPolicy.1.txt2
3 files changed, 8 insertions, 8 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSParamController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSParamController.java
index fc7cb60e5..4dc45425a 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSParamController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSParamController.java
@@ -173,7 +173,7 @@ public class CreateBRMSParamController extends RestrictedBaseController {
if (flag) {
params.append(line);
}
- if (line.contains("declare Params")) {
+ if (line.contains("declare PapParams")) {
params.append(line);
flag = true;
}
@@ -181,7 +181,7 @@ public class CreateBRMSParamController extends RestrictedBaseController {
break;
}
}
- params = new StringBuilder(params.toString().replace("declare Params", "").replace("end", "").replaceAll("\\s+", ""));
+ params = new StringBuilder(params.toString().replace("declare PapParams", "").replace("end", "").replaceAll("\\s+", ""));
String[] components = params.toString().split(":");
String caption = "";
for (int i = 0; i < components.length; i++) {
@@ -400,7 +400,7 @@ public class CreateBRMSParamController extends RestrictedBaseController {
if (flag) {
params.append(line);
}
- if (line.contains("rule") && line.contains(".Params\"")) {
+ if (line.contains("rule") && line.contains(".PapParams\"")) {
params.append(line);
flag = true;
}
@@ -408,8 +408,8 @@ public class CreateBRMSParamController extends RestrictedBaseController {
break;
}
}
- params = new StringBuilder(params.substring(params.indexOf(".Params\"")+ 8));
- params = new StringBuilder(params.toString().replaceAll("\\s+", "").replace("salience1000whenthenParamsparams=newParams();","")
+ params = new StringBuilder(params.substring(params.indexOf(".PapParams\"")+ 11));
+ params = new StringBuilder(params.toString().replaceAll("\\s+", "").replace("salience1000whenthenPapParamsparams=newPapParams();","")
.replace("insert(params);end", "")
.replace("params.set", ""));
String[] components = params.toString().split("\\);");
@@ -462,7 +462,7 @@ public class CreateBRMSParamController extends RestrictedBaseController {
brmsTemplateVlaue + policyData.getRuleName() + "%$> \n */ \n";
body = body + findRule((String) policyData.getRuleName()) + "\n";
StringBuilder generatedRule = new StringBuilder();
- generatedRule.append("rule \""+ policyData.getDomainDir().replace("\\", ".") +".Config_BRMS_Param_" + policyData.getPolicyName()+".Params\" \n\tsalience 1000 \n\twhen\n\tthen\n\t\tParams params = new Params();");
+ generatedRule.append("rule \""+ policyData.getDomainDir().replace("\\", ".") +".Config_BRMS_Param_" + policyData.getPolicyName()+".PapParams\" \n\tsalience 1000 \n\twhen\n\tthen\n\t\tPapParams params = new PapParams();");
if(policyData.getRuleData().size() > 0){
for(Object keyValue: policyData.getRuleData().keySet()){
diff --git a/POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt b/POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt
index 6ff244ea4..63f93cbe2 100644
--- a/POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt
+++ b/POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt
@@ -88,7 +88,7 @@ import org.onap.policy.drools.system.PolicyEngine;
//
// These parameters are required to build the runtime policy
//
-declare Params
+declare PapParams
closedLoopControlName : String
actor : String
aaiURL : String
diff --git a/POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Raw_TestBRMSRawPolicy.1.txt b/POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Raw_TestBRMSRawPolicy.1.txt
index 6924fc3a9..a3cdb7851 100644
--- a/POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Raw_TestBRMSRawPolicy.1.txt
+++ b/POLICY-SDK-APP/src/test/resources/com.Config_BRMS_Raw_TestBRMSRawPolicy.1.txt
@@ -1,7 +1,7 @@
package com.sample
import com.sample.DroolsTest.Message;
// Declare the Parameters here.
-declare Params
+declare PapParams
samPoll : int
value : String
end