summaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST/src
diff options
context:
space:
mode:
authorKrishnajinka <kris.jinka@samsung.com>2018-08-20 14:18:14 +0900
committerKrishnajinka <kris.jinka@samsung.com>2018-08-20 14:18:50 +0900
commitc47063d7cf7b6294547c7628630a5b9fca1daedc (patch)
treea025965d319f5138238d153c32245f86ccf7dbed /ONAP-PAP-REST/src
parent84df4a428ded309f750f52ac1c104ac84e426fc0 (diff)
Use builder for std pap policy
Modify constructor in stdpappolicy to use builder this will fix the sonar issue related with more than 7 parameters method parameters Issue-ID: POLICY-1016 Change-Id: Id736a66e5ea48f0f233cffb640cdce8aaa8f2c0d Signed-off-by: Krishnajinka <kris.jinka@samsung.com>
Diffstat (limited to 'ONAP-PAP-REST/src')
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java48
1 files changed, 39 insertions, 9 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 bb14ff866..4ba72afcb 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,7 +3,7 @@
* ONAP-PAP-REST
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
+ * Modifications 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.
@@ -222,11 +222,26 @@ public class XACMLPAPTest {
ruleAttributes.put("templateName", "testPolicy");
ruleAttributes.put("samPoll", "5");
ruleAttributes.put("value", "test");
- StdPAPPolicy newPAPPolicy = new StdPAPPolicy("BRMS_Param", "test", "testing",
- "BRMS_PARAM_RULE", false, "test",
- matchingAttributes, 0, "DROOLS",
- null, ruleAttributes, "5",
- "default", "false", "", null, null);
+ //Creating BRMS Param Policies from the Admin Console
+ StdPAPPolicy newPAPPolicy = new StdPAPPolicy(StdPAPPolicyParams.builder()
+ .configPolicyType("BRMS_Param")
+ .policyName("test")
+ .description("testing")
+ .configName("BRMS_PARAM_RULE")
+ .editPolicy(false)
+ .domain("test")
+ .dynamicFieldConfigAttributes(matchingAttributes)
+ .highestVersion(0)
+ .onapName("DROOLS")
+ .configBodyData(null)
+ .drlRuleAndUIParams(ruleAttributes)
+ .riskLevel("5")
+ .riskType("default")
+ .guard("false")
+ .ttlDate("")
+ .brmsController(null)
+ .brmsDependency(null)
+ .build());
MockServletInputStream mockInput =
new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes());
Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);
@@ -289,9 +304,24 @@ public class XACMLPAPTest {
Mockito.when(httpServletRequest.getParameter("operation")).thenReturn("create");
Mockito.when(httpServletRequest.getParameter("policyType")).thenReturn("Config");
String json = "{\"test\":\"java\"}";
- StdPAPPolicy newPAPPolicy = new StdPAPPolicy("ClosedLoop_PM", "test", "testing", "onap",
- json, false, null, "Registration Failure(Trinity)", false, "test", 0, null,
- "default", "true", "");
+ //Creating CloseLoop_Fault and Performance Metric Policies
+ StdPAPPolicy newPAPPolicy = new StdPAPPolicy(StdPAPPolicyParams.builder()
+ .configPolicyType("ClosedLoop_PM")
+ .policyName("test")
+ .description("testing")
+ .onapName("onap")
+ .jsonBody(json)
+ .draft(false)
+ .oldPolicyFileName(null)
+ .serviceType("Registration Failure(Trinity)")
+ .editPolicy(false)
+ .domain("test")
+ .highestVersion(0)
+ .riskLevel(null)
+ .riskType("default")
+ .guard("true")
+ .ttlDate("")
+ .build());
MockServletInputStream mockInput =
new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes());
Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);