aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST/src/test
diff options
context:
space:
mode:
authorKrishnajinka <kris.jinka@samsung.com>2018-08-13 15:44:55 +0900
committerKrishnajinka <kris.jinka@samsung.com>2018-08-13 21:30:22 +0900
commit84223fab05c1493df05db20016a83687bdaee975 (patch)
treed2963885a5bc5a0589b3c84f51be16114963b243 /ONAP-PAP-REST/src/test
parent6ed1731fa2ce340d745dc2d39ffc6a066f50fbc2 (diff)
Modify std pap policy to use builder in constr
Fix sonar issue about constructor using more than 7 params. Use builder parameters object for setting the attributes of std pap policy.Rework2 Issue-ID: POLICY-1016 Change-Id: If26f7daa8d5b5d387238aad74daeddd49a8b95bb Signed-off-by: Krishnajinka <kris.jinka@samsung.com>
Diffstat (limited to 'ONAP-PAP-REST/src/test')
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java39
1 files changed, 32 insertions, 7 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)