From 84223fab05c1493df05db20016a83687bdaee975 Mon Sep 17 00:00:00 2001 From: Krishnajinka Date: Mon, 13 Aug 2018 15:44:55 +0900 Subject: 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 --- .../org/onap/policy/pap/test/XACMLPAPTest.java | 39 ++++++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'ONAP-PAP-REST/src/test') 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) -- cgit 1.2.3-korg