aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java39
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ActionPolicyService.java19
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ConfigPolicyService.java3
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java23
-rw-r--r--ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java75
-rw-r--r--ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicyParams.java142
-rw-r--r--ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPAPPolicyTest.java41
7 files changed, 255 insertions, 87 deletions
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java
index 80772e212..ab4f2a00f 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java
@@ -3,6 +3,7 @@
* ONAP-PAP-REST
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -290,8 +291,15 @@ public class XACMLPAPTest {
Mockito.when(httpServletRequest.getParameter("apiflag")).thenReturn("api");
Mockito.when(httpServletRequest.getParameter("operation")).thenReturn("create");
Mockito.when(httpServletRequest.getParameter("policyType")).thenReturn("Decision");
- StdPAPPolicy newPAPPolicy = new StdPAPPolicy("test", "test rule", "ONAP", "AAF", null, null, null,
- null, null, null, null, null, null, null, false, "test", 0);
+ StdPAPPolicy newPAPPolicy = new StdPAPPolicy(StdPAPPolicyParams.builder()
+ .policyName("test")
+ .description("test rule")
+ .onapName("ONAP")
+ .providerComboBox("AAF")
+ .editPolicy(false)
+ .domain("test")
+ .highestVersion(0)
+ .build());
MockServletInputStream mockInput =
new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes());
Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);
@@ -324,8 +332,17 @@ public class XACMLPAPTest {
matchingAttributes.put("guardActiveStart", "05:00");
matchingAttributes.put("guardActiveEnd", "10:00");
StdPAPPolicy newPAPPolicy =
- new StdPAPPolicy("testGuard", "test rule", "PDPD", "GUARD_YAML", matchingAttributes, null, null,
- null, null, null, null, null, null, null, false, "test", 0);
+
+ new StdPAPPolicy(StdPAPPolicyParams.builder()
+ .policyName("testGuard")
+ .description("test rule")
+ .onapName("PDPD")
+ .providerComboBox("GUARD_YAML")
+ .dyanamicFieldConfigAttributes(matchingAttributes)
+ .editPolicy(false)
+ .domain("test")
+ .highestVersion(0)
+ .build());
MockServletInputStream mockInput =
new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes());
Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);
@@ -355,8 +372,16 @@ public class XACMLPAPTest {
matchingAttributes.put("guardActiveEnd", "10:00");
matchingAttributes.put("blackList", "bl1,bl2");
StdPAPPolicy newPAPPolicy =
- new StdPAPPolicy("testblGuard", "test rule", "PDPD", "GUARD_BL_YAML", matchingAttributes, null, null,
- null, null, null, null, null, null, null, false, "test", 0);
+ new StdPAPPolicy(StdPAPPolicyParams.builder()
+ .policyName("testblGuard")
+ .description("test rule")
+ .onapName("PDPD")
+ .providerComboBox("GUARD_BL_YAML")
+ .dyanamicFieldConfigAttributes(matchingAttributes)
+ .editPolicy(false)
+ .domain("test")
+ .highestVersion(0)
+ .build());
MockServletInputStream mockInput =
new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes());
Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);
@@ -386,7 +411,7 @@ public class XACMLPAPTest {
.description("test rule")
.onapName("TEST")
.configName("config")
- .attributes(configAttributes)
+ .dyanamicFieldConfigAttributes(configAttributes)
.configType("OTHER")
.configBodyData("test body")
.editPolicy(false)
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ActionPolicyService.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ActionPolicyService.java
index 5016e0690..ab5b60cea 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ActionPolicyService.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ActionPolicyService.java
@@ -28,6 +28,7 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.onap.policy.xacml.std.pap.StdPAPPolicy;
+import org.onap.policy.xacml.std.pap.StdPAPPolicyParams;
/**
* Action Policy Implementation.
@@ -94,11 +95,19 @@ public class ActionPolicyService {
operation = "create";
}
// Create Policy
- StdPAPPolicy newPAPPolicy = new StdPAPPolicy(policyName, policyParameters.getPolicyDescription(),
- componentAttributes, policyParameters.getDynamicRuleAlgorithmLabels(),
- policyParameters.getDynamicRuleAlgorithmFunctions(),
- policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmField2(),
- actionPerformer, actionAttribute, updateFlag, policyScope, 0);
+ StdPAPPolicy newPAPPolicy = new StdPAPPolicy(StdPAPPolicyParams.builder().policyName(policyName)
+ .description(policyParameters.getPolicyDescription())
+ .dyanamicFieldConfigAttributes(componentAttributes)
+ .dynamicRuleAlgorithmLabels(policyParameters.getDynamicRuleAlgorithmLabels())
+ .dynamicRuleAlgorithmCombo(policyParameters.getDynamicRuleAlgorithmFunctions())
+ .dynamicRuleAlgorithmField1(policyParameters.getDynamicRuleAlgorithmField1())
+ .dynamicRuleAlgorithmField2(policyParameters.getDynamicRuleAlgorithmField2())
+ .actionPerformer(actionPerformer)
+ .actionAttribute(actionAttribute)
+ .editPolicy(updateFlag)
+ .domain(policyScope)
+ .highestVersion(0)
+ .build());
// send Json to PAP
response = (String) papServices.callPAP(newPAPPolicy, new String[]{"operation=" + operation, "apiflag=api",
"policyType=Action"}, policyParameters.getRequestID(), "Action");
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ConfigPolicyService.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ConfigPolicyService.java
index 46f968aac..e25e94cd0 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ConfigPolicyService.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ConfigPolicyService.java
@@ -3,6 +3,7 @@
* ONAP-PDP-REST
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -132,7 +133,7 @@ public class ConfigPolicyService {
.description(policyParameters.getPolicyDescription())
.onapName(onapName)
.configName(configName)
- .attributes(configAttributes)
+ .dyanamicFieldConfigAttributes(configAttributes)
.configType(configType)
.configBodyData(configBody)
.editPolicy(updateFlag)
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java
index 7bdf1dc71..00a3cc890 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/DecisionPolicyService.java
@@ -29,6 +29,7 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.onap.policy.xacml.std.pap.StdPAPPolicy;
+import org.onap.policy.xacml.std.pap.StdPAPPolicyParams;
/**
* Decision Policy Implementation
@@ -97,12 +98,22 @@ public class DecisionPolicyService {
matchingAttributes = policyParameters.getAttributes().get(AttributeType.MATCHING);
}
// Create StdPAPPolicy object used to send policy data to PAP-REST.
- StdPAPPolicy newPAPPolicy = new StdPAPPolicy(policyName, policyParameters.getPolicyDescription(), onapName,
- ruleProvider.toString(), matchingAttributes, settingsAttributes,
- policyParameters.getTreatments(), policyParameters.getDynamicRuleAlgorithmLabels(),
- policyParameters.getDynamicRuleAlgorithmFunctions(),
- policyParameters.getDynamicRuleAlgorithmField1(), policyParameters.getDynamicRuleAlgorithmField2(),
- null, null, null, updateFlag, policyScope, 0);
+ StdPAPPolicy newPAPPolicy = new StdPAPPolicy(StdPAPPolicyParams.builder()
+ .policyName(policyName)
+ .description(policyParameters.getPolicyDescription())
+ .onapName(onapName)
+ .providerComboBox(ruleProvider.toString())
+ .dyanamicFieldConfigAttributes(matchingAttributes)
+ .dynamicSettingsMap(settingsAttributes)
+ .treatments(policyParameters.getTreatments())
+ .dynamicRuleAlgorithmLabels(policyParameters.getDynamicRuleAlgorithmLabels())
+ .dynamicRuleAlgorithmCombo(policyParameters.getDynamicRuleAlgorithmFunctions())
+ .dynamicRuleAlgorithmField1(policyParameters.getDynamicRuleAlgorithmField1())
+ .dynamicRuleAlgorithmField2(policyParameters.getDynamicRuleAlgorithmField2())
+ .editPolicy(updateFlag)
+ .domain(policyScope)
+ .highestVersion(0)
+ .build());
// Send JSON to PAP.
response = (String) papServices.callPAP(newPAPPolicy, new String[]{"operation=" + operation, "apiflag=api",
"policyType=Decision"}, policyParameters.getRequestID(), "Decision");
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java
index 264b2b784..435e3c347 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java
@@ -3,6 +3,7 @@
* ONAP-XACML
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -101,16 +102,23 @@ public class StdPAPPolicy implements OnapPAPPolicy, Serializable {
this.configPolicyType = configPolicyType;
}
- //Constructor for Create Config Policies from API and Admin Console
- //Constructor for Updating Config Policies from the API
- //convenience constructor
+ /**
+ * Constructor for
+ * Create Config Policies from API and Admin Console
+ * Updating Config Policies from the API
+ * Create/Update Action Policies from API
+ * Create/Update Decision Policies
+ * @param stdPAPPolicyParams Input params object
+ */
public StdPAPPolicy(StdPAPPolicyParams stdPAPPolicyParams) {
this.configPolicyType=stdPAPPolicyParams.getConfigPolicyType();
this.policyName = stdPAPPolicyParams.getPolicyName();
this.policyDescription = stdPAPPolicyParams.getDescription();
this.onapName = stdPAPPolicyParams.getOnapName();
+ this.providerComboBox = stdPAPPolicyParams.getProviderComboBox();
this.configName = stdPAPPolicyParams.getConfigName();
- this.dyanamicFieldConfigAttributes = stdPAPPolicyParams.getAttributes();
+ this.dyanamicFieldConfigAttributes = stdPAPPolicyParams.getDyanamicFieldConfigAttributes();
+ this.dynamicSettingsMap = stdPAPPolicyParams.getDynamicSettingsMap();
this.configType = stdPAPPolicyParams.getConfigType();
this.configBodyData = stdPAPPolicyParams.getConfigBodyData();
this.editPolicy = stdPAPPolicyParams.getEditPolicy();
@@ -120,55 +128,16 @@ public class StdPAPPolicy implements OnapPAPPolicy, Serializable {
this.riskType = stdPAPPolicyParams.getRiskType();
this.guard = stdPAPPolicyParams.getGuard();
this.ttlDate = stdPAPPolicyParams.getTtlDate();
- }
-
- //Constructor for Create/Update Action Policies from API
- public StdPAPPolicy(String policyName, String description, Map<String, String> attributes,
- List<String> dynamicRuleAlgorithmLabels, List<String> dynamicRuleAlgorithmCombo,
- List<String> dynamicRuleAlgorithmField1, List<String> dynamicRuleAlgorithmField2,
- String actionPerformer, String actionAttribute, Boolean editPolicy,
- String domain, int highestVersion) {
-
- this.policyName = policyName;
- this.policyDescription = description;
- this.dyanamicFieldConfigAttributes = attributes;
- this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
- this.dynamicRuleAlgorithmCombo = dynamicRuleAlgorithmCombo;
- this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1;
- this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2;
- this.actionPerformer = actionPerformer;
- this.actionAttribute = actionAttribute;
- this.editPolicy = editPolicy;
- this.domain = domain;
- this.highestVersion = highestVersion;
-
- }
-
- //Constructor for Create/Update Decision Policies
- public StdPAPPolicy(String policyName, String description, String onapName, String providerComboBox,
- Map<String, String> attributes, Map<String, String> settings, Map<String, String> treatments,
- List<String> dynamicRuleAlgorithmLabels, List<String> dynamicRuleAlgorithmCombo,
- List<String> dynamicRuleAlgorithmField1,
- List<String> dynamicRuleAlgorithmField2, Map<String, String> dropDownMap,
- List<Object> dynamicVariableList,
- List<String> dataTypeList, Boolean editPolicy, String domain, int highestVersion) {
- this.policyName = policyName;
- this.policyDescription = description;
- this.onapName = onapName;
- this.setProviderComboBox(providerComboBox);
- this.dyanamicFieldConfigAttributes = attributes;
- this.dynamicSettingsMap = settings;
- this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
- this.dynamicRuleAlgorithmCombo = dynamicRuleAlgorithmCombo;
- this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1;
- this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2;
- this.dynamicVariableList = dynamicVariableList;
- this.dataTypeList = dataTypeList;
- this.dropDownMap = dropDownMap;
- this.editPolicy = editPolicy;
- this.domain = domain;
- this.highestVersion = highestVersion;
- this.treatments = treatments;
+ this.dynamicRuleAlgorithmLabels = stdPAPPolicyParams.getDynamicRuleAlgorithmLabels();
+ this.dynamicRuleAlgorithmCombo = stdPAPPolicyParams.getDynamicRuleAlgorithmCombo();
+ this.dynamicRuleAlgorithmField1 = stdPAPPolicyParams.getDynamicRuleAlgorithmField1();
+ this.dynamicRuleAlgorithmField2 = stdPAPPolicyParams.getDynamicRuleAlgorithmField2();
+ this.dynamicVariableList = stdPAPPolicyParams.getDynamicVariableList();
+ this.dataTypeList = stdPAPPolicyParams.getDataTypeList();
+ this.dropDownMap = stdPAPPolicyParams.getDropDownMap();
+ this.actionPerformer = stdPAPPolicyParams.getActionPerformer();
+ this.actionAttribute = stdPAPPolicyParams.getActionAttribute();
+ this.treatments = stdPAPPolicyParams.getTreatments();
}
//convenience constructor
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicyParams.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicyParams.java
index a9daa9e97..0e183e08a 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicyParams.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicyParams.java
@@ -20,15 +20,19 @@
package org.onap.policy.xacml.std.pap;
+import java.util.List;
import java.util.Map;
+/**
+ * Std PAP Policy paramters class.
+ */
public class StdPAPPolicyParams {
private String configPolicyType;
private String policyName;
private String description;
private String onapName;
private String configName;
- private Map<String, String> attributes;
+ private Map<String, String> dyanamicFieldConfigAttributes;
private String configType;
private String configBodyData;
private Boolean editPolicy;
@@ -38,7 +42,22 @@ public class StdPAPPolicyParams {
private String guard;
private String ttlDate;
private int highestVersion;
-
+ private List<String> dynamicRuleAlgorithmLabels;
+ private List<String> dynamicRuleAlgorithmCombo;
+ private List<String> dynamicRuleAlgorithmField1;
+ private List<String> dynamicRuleAlgorithmField2;
+ private String actionPerformer;
+ private String actionAttribute;
+ private String providerComboBox;
+ private Map<String, String> dynamicSettingsMap;
+ private List<Object> dynamicVariableList;
+ private List<String> dataTypeList;
+ private Map<String, String> dropDownMap;
+ private Map<String,String> treatments;
+
+ /**
+ * Default constructor
+ */
private StdPAPPolicyParams() {
super();
}
@@ -71,8 +90,8 @@ public class StdPAPPolicyParams {
return configName;
}
- public Map<String, String> getAttributes() {
- return attributes;
+ public Map<String, String> getDyanamicFieldConfigAttributes() {
+ return dyanamicFieldConfigAttributes;
}
public String getConfigType() {
@@ -107,6 +126,57 @@ public class StdPAPPolicyParams {
return ttlDate;
}
+ public List<String> getDynamicRuleAlgorithmLabels() {
+ return dynamicRuleAlgorithmLabels;
+ }
+
+ public List<String> getDynamicRuleAlgorithmCombo() {
+ return dynamicRuleAlgorithmCombo;
+ }
+
+ public List<String> getDynamicRuleAlgorithmField1() {
+ return dynamicRuleAlgorithmField1;
+ }
+
+ public List<String> getDynamicRuleAlgorithmField2() {
+ return dynamicRuleAlgorithmField2;
+ }
+
+ public String getActionPerformer() {
+ return actionPerformer;
+ }
+
+ public String getActionAttribute() {
+ return actionAttribute;
+ }
+
+ public String getProviderComboBox() {
+ return providerComboBox;
+ }
+
+ public Map<String,String> getDynamicSettingsMap() {
+ return dynamicSettingsMap;
+ }
+
+ public List<Object> getDynamicVariableList() {
+ return dynamicVariableList;
+ }
+
+ public List<String> getDataTypeList() {
+ return dataTypeList;
+ }
+
+ public Map<String,String> getDropDownMap() {
+ return dropDownMap;
+ }
+
+ public Map<String,String> getTreatments() {
+ return treatments;
+ }
+
+ /**
+ * Builder class for the Policy parameters
+ */
public static class StdPAPPolicyParamsBuilder {
StdPAPPolicyParams m = new StdPAPPolicyParams();
@@ -140,8 +210,8 @@ public class StdPAPPolicyParams {
return this;
}
- public StdPAPPolicyParamsBuilder attributes(Map<String, String> attributes) {
- m.attributes = attributes;
+ public StdPAPPolicyParamsBuilder dyanamicFieldConfigAttributes(Map<String, String> attributes) {
+ m.dyanamicFieldConfigAttributes = attributes;
return this;
}
@@ -189,5 +259,65 @@ public class StdPAPPolicyParams {
m.highestVersion = highVer;
return this;
}
+
+ public StdPAPPolicyParamsBuilder dynamicRuleAlgorithmLabels(List<String> dynamicRuleAlgorithmLabels) {
+ m.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder dynamicRuleAlgorithmCombo(List<String> dynamicRuleAlgorithmCombo) {
+ m.dynamicRuleAlgorithmCombo = dynamicRuleAlgorithmCombo;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder dynamicRuleAlgorithmField1(List<String> dynamicRuleAlgorithmField1) {
+ m.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder dynamicRuleAlgorithmField2(List<String> dynamicRuleAlgorithmField2) {
+ m.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder actionPerformer(String actionPerformer) {
+ m.actionPerformer = actionPerformer;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder actionAttribute(String actionAttribute) {
+ m.actionAttribute = actionAttribute;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder providerComboBox(String providerComboBox) {
+ m.providerComboBox = providerComboBox;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder dynamicVariableList(List<Object> dynamicVariableList) {
+ m.dynamicVariableList = dynamicVariableList;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder dynamicSettingsMap(Map<String, String> dynamicSettingsMap) {
+ m.dynamicSettingsMap = dynamicSettingsMap;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder dataTypeList(List<String> dataTypeList) {
+ m.dataTypeList = dataTypeList;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder dropDownMap(Map<String, String> dropDownMap){
+ m.dropDownMap = dropDownMap;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder treatments(Map<String,String> treatments) {
+ m.treatments = treatments;
+ return this;
+ }
}
}
diff --git a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPAPPolicyTest.java b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPAPPolicyTest.java
index aa57c27f0..4a9370c41 100644
--- a/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPAPPolicyTest.java
+++ b/ONAP-XACML/src/test/java/org/onap/policy/xacml/test/std/pap/StdPAPPolicyTest.java
@@ -586,7 +586,7 @@ public class StdPAPPolicyTest {
.description("description")
.onapName("onapName")
.configName("configName")
- .attributes(attributes)
+ .dyanamicFieldConfigAttributes(attributes)
.configType("configType")
.configBodyData("body")
.editPolicy(true)
@@ -624,10 +624,18 @@ public class StdPAPPolicyTest {
dynamicRuleAlgorithmField1.add("dynamicRuleAlgorithmField1");
List<String> dynamicRuleAlgorithmField2 = new ArrayList<>();
dynamicRuleAlgorithmField2.add("dynamicRuleAlgorithmField2");
- StdPAPPolicy stdPAPPolicy = new StdPAPPolicy("policyName", "description", attributes,
- dynamicRuleAlgorithmLabels, dynamicRuleAlgorithmCombo, dynamicRuleAlgorithmField1,
- dynamicRuleAlgorithmField2,
- "actionPerformer", "actionAttribute", true, "domain", 1);
+ StdPAPPolicy stdPAPPolicy = new StdPAPPolicy(StdPAPPolicyParams.builder().policyName("policyName").description("description")
+ .dyanamicFieldConfigAttributes(attributes)
+ .dynamicRuleAlgorithmLabels(dynamicRuleAlgorithmLabels)
+ .dynamicRuleAlgorithmCombo(dynamicRuleAlgorithmCombo)
+ .dynamicRuleAlgorithmField1(dynamicRuleAlgorithmField1)
+ .dynamicRuleAlgorithmField2(dynamicRuleAlgorithmField2)
+ .actionPerformer("actionPerformer")
+ .actionAttribute("actionAttribute")
+ .editPolicy(true)
+ .domain("domain")
+ .highestVersion(1)
+ .build());
assertEquals("policyName", stdPAPPolicy.getPolicyName());
assertEquals("description", stdPAPPolicy.getPolicyDescription());
assertEquals(attributes, stdPAPPolicy.getDynamicFieldConfigAttributes());
@@ -664,10 +672,25 @@ public class StdPAPPolicyTest {
dynamicVariableList.add("dynamicVariableList");
List<String> dataTypeList = new ArrayList<>();
dataTypeList.add("dataTypeList");
- StdPAPPolicy stdPAPPolicy = new StdPAPPolicy("policyName", "description", "onapName", "providerComboBox",
- attributes, settings, treatments, dynamicRuleAlgorithmLabels, dynamicRuleAlgorithmCombo,
- dynamicRuleAlgorithmField1, dynamicRuleAlgorithmField2, dropDownMap, dynamicVariableList,
- dataTypeList, true, "domain", 1);
+ StdPAPPolicy stdPAPPolicy = new StdPAPPolicy(StdPAPPolicyParams.builder()
+ .policyName("policyName")
+ .description("description")
+ .onapName("onapName")
+ .providerComboBox("providerComboBox")
+ .dyanamicFieldConfigAttributes(attributes)
+ .dynamicSettingsMap(settings)
+ .treatments(treatments)
+ .dynamicRuleAlgorithmLabels(dynamicRuleAlgorithmLabels)
+ .dynamicRuleAlgorithmCombo(dynamicRuleAlgorithmCombo)
+ .dynamicRuleAlgorithmField1(dynamicRuleAlgorithmField1)
+ .dynamicRuleAlgorithmField2(dynamicRuleAlgorithmField2)
+ .dropDownMap(dropDownMap)
+ .dynamicVariableList(dynamicVariableList)
+ .dataTypeList(dataTypeList)
+ .editPolicy(true)
+ .domain("domain")
+ .highestVersion(1)
+ .build());
assertEquals("policyName", stdPAPPolicy.getPolicyName());
assertEquals("description", stdPAPPolicy.getPolicyDescription());
assertEquals("onapName", stdPAPPolicy.getOnapName());