diff options
author | krishnajinka <kris.jinka@samsung.com> | 2018-08-09 07:35:57 +0900 |
---|---|---|
committer | krishnajinka <kris.jinka@samsung.com> | 2018-08-10 08:42:56 +0900 |
commit | 6ed1731fa2ce340d745dc2d39ffc6a066f50fbc2 (patch) | |
tree | 426db83bf48fd4f14fd7d3ca73a2a42bd1b3f687 /ONAP-PDP-REST/src/test/java | |
parent | 5e8b7f573f0f7f08be242ee017ecf1243317f1b5 (diff) |
Add PAP Policy parameter builder xacml policy
Fix Sonar flagged major issue about 14 params instead of 9
in the constructor of std pap policy class. Commit5 for
modify constrctor.fix test
Issue-ID: POLICY-1016
Change-Id: I79c8482b7fc4e203cb18402ba2b5a68a120c57b1
Signed-off-by: krisjinka <kris.jinka@samsung.com>
Diffstat (limited to 'ONAP-PDP-REST/src/test/java')
-rw-r--r-- | ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/PAPServicesTest.java | 71 |
1 files changed, 37 insertions, 34 deletions
diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/PAPServicesTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/PAPServicesTest.java index 93fde841d..09014cc3d 100644 --- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/PAPServicesTest.java +++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/services/PAPServicesTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -36,44 +36,47 @@ import org.onap.policy.xacml.std.pap.StdPDPPolicy; public class PAPServicesTest { - PAPServices papServices = null; + PAPServices papServices = null; - @Before - public void setUp() throws Exception { - PAPServices.setJunit(true); - Properties prop = new Properties(); - prop.load(new FileInputStream("src/test/resources/pass.xacml.pdp.properties")); - String succeeded = prop.getProperty("xacml.rest.pap.url"); - List<String> paps = Arrays.asList(succeeded.split(",")); - PAPServices.setPaps(paps); - papServices = new PAPServices(); + @Before + public void setUp() throws Exception { + PAPServices.setJunit(true); + Properties prop = new Properties(); + prop.load(new FileInputStream("src/test/resources/pass.xacml.pdp.properties")); + String succeeded = prop.getProperty("xacml.rest.pap.url"); + List<String> paps = Arrays.asList(succeeded.split(",")); + PAPServices.setPaps(paps); + papServices = new PAPServices(); - } + } - @After - public void tearDown() throws Exception { - PAPServices.setPaps(null); - PAPServices.setJunit(false); - } + @After + public void tearDown() throws Exception { + PAPServices.setPaps(null); + PAPServices.setJunit(false); + } - @Test - public final void testCallPAP() throws PolicyException { - StdPAPPolicy newPAPPolicy = new StdPAPPolicy(); - String response = null; - response = (String) papServices.callPAP(newPAPPolicy, new String[] {"operation=create", "apiflag=api", "policyType=Config"}, UUID.randomUUID(), "Config"); - assertEquals("success",response); - } + @Test + public final void testCallPAP() throws PolicyException { + StdPAPPolicy newPAPPolicy = new StdPAPPolicy(); + String response = null; + response = (String) papServices.callPAP(newPAPPolicy, new String[]{"operation=create", "apiflag=api", + "policyType=Config"}, UUID.randomUUID(), "Config"); + assertEquals("success", response); + } - @Test - public final void testGetActiveVersion() { - String activeVersion = papServices.getActiveVersion("test", "Config_", "test.testpolicy", "Config", UUID.randomUUID()); - assertNull(activeVersion); - } + @Test + public final void testGetActiveVersion() { + String activeVersion = papServices.getActiveVersion("test", "Config_", "test.testpolicy", "Config", + UUID.randomUUID()); + assertNull(activeVersion); + } - @Test - public final void testPushPolicy() throws PolicyException { - StdPDPPolicy selectedPolicy = papServices.pushPolicy("test", "Config_", "test.testpolicy", "Config", "default", UUID.randomUUID()); + @Test + public final void testPushPolicy() throws PolicyException { + StdPDPPolicy selectedPolicy = papServices.pushPolicy("test", "Config_", "test.testpolicy", "Config", "default" + , UUID.randomUUID()); assertNull(selectedPolicy); - } + } } |