From dfd9c0a09c35e4b5b4b61be08b8424e4a3d0d500 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Fri, 4 Oct 2019 17:03:28 -0400 Subject: Format java POLICY-SDK-APP As a result of doing command maven reformat, these files are now changed. Updated licenses. Issue-ID: POLICY-2133 Change-Id: I19a8dd70eb10c0d879b97635f7780ab7f92a1753 Signed-off-by: Pamela Dragosh --- .../java/org/onap/policy/admin/CheckPDPTest.java | 41 ++-- .../policy/admin/PolicyManagerServletTest.java | 235 +++++++++------------ .../policy/admin/PolicyNotificationMailTest.java | 10 +- .../policy/admin/PolicyRestControllerTest.java | 131 ++++++------ .../policy/admin/PolicyUserInfoControllerTest.java | 8 +- .../onap/policy/admin/RESTfulPAPEngineTest.java | 10 +- .../org/onap/policy/conf/HibernateSessionTest.java | 3 +- .../policy/controller/AdminTabControllerTest.java | 12 +- .../policy/controller/AutoPushControllerTest.java | 11 +- .../CreateDcaeMicroServiceControllerTest.java | 6 +- .../CreateOptimizationControllerTest.java | 91 ++++---- .../policy/controller/DashboardControllerTest.java | 14 +- ...xportAndImportDecisionBlackListEntriesTest.java | 4 +- .../onap/policy/controller/PDPControllerTest.java | 9 +- .../policy/controller/PolicyControllerTest.java | 9 +- .../PolicyExportAndImportControllerTest.java | 18 +- .../PolicyNotificationControllerTest.java | 17 +- .../controller/PolicyRolesControllerTest.java | 18 +- .../controller/PolicyValidationControllerTest.java | 11 +- .../onap/policy/daoImp/CommonClassDaoImplTest.java | 31 ++- .../onap/policy/model/PDPGroupContainerTest.java | 6 +- 21 files changed, 341 insertions(+), 354 deletions(-) (limited to 'POLICY-SDK-APP/src/test/java') diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/CheckPDPTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/CheckPDPTest.java index a06afc997..358b69f1f 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/CheckPDPTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/CheckPDPTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -19,13 +19,16 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.admin; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + import java.io.File; + import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; @@ -40,33 +43,26 @@ public class CheckPDPTest { assertFalse(CheckPDP.validateID("http://localhost:8082/pdp/")); System.setProperty("xacml.rest.pdp.idfile", - new File(".").getCanonicalPath() + File.separator + "src" + File.separator - + "test" + File.separator + "resources" + File.separator - + "idonotexist.properties"); + new File(".").getCanonicalPath() + File.separator + "src" + File.separator + "test" + File.separator + + "resources" + File.separator + "idonotexist.properties"); assertFalse(CheckPDP.validateID("http://localhost:8082/pdp/")); System.setProperty("xacml.rest.pdp.idfile", - new File(".").getCanonicalPath() + File.separator + "src" + File.separator - + "test" + File.separator + "resources" + File.separator - + "doesnothaveproperties.atall"); + new File(".").getCanonicalPath() + File.separator + "src" + File.separator + "test" + File.separator + + "resources" + File.separator + "doesnothaveproperties.atall"); assertFalse(CheckPDP.validateID("http://localhost:8082/pdp/")); - System.setProperty("xacml.rest.pdp.idfile", - new File(".").getCanonicalPath() + File.separator + "src" + File.separator - + "test" + File.separator + "resources" + File.separator - + "testbad.properties"); + System.setProperty("xacml.rest.pdp.idfile", new File(".").getCanonicalPath() + File.separator + "src" + + File.separator + "test" + File.separator + "resources" + File.separator + "testbad.properties"); assertFalse(CheckPDP.validateID("http://localhost:8082/pdp/")); - System.setProperty("xacml.rest.pdp.idfile", - new File(".").getCanonicalPath() + File.separator + "src" + File.separator - + "test" + File.separator + "resources" + File.separator - + "empty.properties"); + System.setProperty("xacml.rest.pdp.idfile", new File(".").getCanonicalPath() + File.separator + "src" + + File.separator + "test" + File.separator + "resources" + File.separator + "empty.properties"); assertFalse(CheckPDP.validateID("http://localhost:8082/pdp/")); System.setProperty("xacml.rest.pdp.idfile", - new File(".").getCanonicalPath() + File.separator + "src" + File.separator - + "test" + File.separator + "resources" + File.separator - + "testnotenoughvalues.properties"); + new File(".").getCanonicalPath() + File.separator + "src" + File.separator + "test" + File.separator + + "resources" + File.separator + "testnotenoughvalues.properties"); assertFalse(CheckPDP.validateID("http://localhost:8082/pdp/")); assertNull(CheckPDP.getPdpMap()); @@ -80,14 +76,11 @@ public class CheckPDPTest { @Test public final void test2CheckPDP() { try { - System.setProperty("xacml.rest.pdp.idfile", - new File(".").getCanonicalPath() + File.separator + "src" + File.separator - + "test" + File.separator + "resources" + File.separator - + "test.properties"); + System.setProperty("xacml.rest.pdp.idfile", new File(".").getCanonicalPath() + File.separator + "src" + + File.separator + "test" + File.separator + "resources" + File.separator + "test.properties"); assertTrue(CheckPDP.validateID("http://localhost:8082/pdp/")); assertTrue(CheckPDP.getPdpMap().containsKey("http://localhost:8082/pdp/")); - assertTrue(CheckPDP.getEncoding("http://localhost:8082/pdp/") - .equals("dGVzdHBkcDphbHBoYTQ1Ng==")); + assertTrue(CheckPDP.getEncoding("http://localhost:8082/pdp/").equals("dGVzdHBkcDphbHBoYTQ1Ng==")); } catch (Exception e) { fail("Error occured in CheckPDP test"); } diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java index 7bd3be440..0325c8d8f 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -19,19 +19,23 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.admin; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + import java.io.BufferedReader; import java.io.File; import java.io.StringReader; import java.util.ArrayList; import java.util.Collections; import java.util.List; + import javax.servlet.ServletConfig; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; + import org.apache.commons.io.IOUtils; import org.junit.Before; import org.junit.Test; @@ -98,8 +102,7 @@ public class PolicyManagerServletTest extends Mockito { String policyContent = ""; try { ClassLoader classLoader = getClass().getClassLoader(); - policyContent = IOUtils - .toString(classLoader.getResourceAsStream("Config_SampleTest1206.1.xml")); + policyContent = IOUtils.toString(classLoader.getResourceAsStream("Config_SampleTest1206.1.xml")); } catch (Exception e1) { logger.error("Exception Occured" + e1); } @@ -141,8 +144,7 @@ public class PolicyManagerServletTest extends Mockito { HttpSession mockSession = mock(HttpSession.class); User user = new User(); user.setOrgUserId("Test"); - Mockito.when(mockSession.getAttribute(SystemProperties.getProperty("user_attribute_name"))) - .thenReturn(user); + Mockito.when(mockSession.getAttribute(SystemProperties.getProperty("user_attribute_name"))).thenReturn(user); Mockito.when(request.getSession(false)).thenReturn(mockSession); commonClassDao = mock(CommonClassDao.class); @@ -153,14 +155,11 @@ public class PolicyManagerServletTest extends Mockito { PolicyManagerServlet servlet = new PolicyManagerServlet(); ServletConfig servletConfig = mock(ServletConfig.class); try { - when(servletConfig.getInitParameterNames()) - .thenReturn(Collections.enumeration(headers)); - when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")) - .thenReturn("xacml.admin.properties"); + when(servletConfig.getInitParameterNames()).thenReturn(Collections.enumeration(headers)); + when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn("xacml.admin.properties"); System.setProperty("xacml.rest.admin.closedLoopJSON", - new File(".").getCanonicalPath() + File.separator + "src" + File.separator - + "test" + File.separator + "resources" + File.separator - + "JSONConfig.json"); + new File(".").getCanonicalPath() + File.separator + "src" + File.separator + "test" + File.separator + + "resources" + File.separator + "JSONConfig.json"); servlet.init(servletConfig); assertTrue(PolicyManagerServlet.getServiceTypeNamesList().size() > 0); @@ -177,14 +176,11 @@ public class PolicyManagerServletTest extends Mockito { PolicyManagerServlet servlet = new PolicyManagerServlet(); ServletConfig servletConfig = mock(ServletConfig.class); try { - when(servletConfig.getInitParameterNames()) - .thenReturn(Collections.enumeration(headers)); - when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")) - .thenReturn("xacml.admin.properties"); + when(servletConfig.getInitParameterNames()).thenReturn(Collections.enumeration(headers)); + when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn("xacml.admin.properties"); System.setProperty("xacml.rest.admin.closedLoopJSON", - new File(".").getCanonicalPath() + File.separator + "src" + File.separator - + "test" + File.separator + "resources" + File.separator - + "JSONConfig.foo"); + new File(".").getCanonicalPath() + File.separator + "src" + File.separator + "test" + File.separator + + "resources" + File.separator + "JSONConfig.foo"); servlet.init(servletConfig); } catch (Exception e1) { logger.error("Exception Occured" + e1); @@ -197,14 +193,11 @@ public class PolicyManagerServletTest extends Mockito { PolicyManagerServlet servlet = new PolicyManagerServlet(); ServletConfig servletConfig = mock(ServletConfig.class); try { - when(servletConfig.getInitParameterNames()) - .thenReturn(Collections.enumeration(headers)); - when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")) - .thenReturn("xacml.admin.properties"); + when(servletConfig.getInitParameterNames()).thenReturn(Collections.enumeration(headers)); + when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn("xacml.admin.properties"); System.setProperty("xacml.rest.admin.closedLoopJSON", - new File(".").getCanonicalPath() + File.separator + "src" + File.separator - + "test" + File.separator + "resources" + File.separator - + "IDonotExist.json"); + new File(".").getCanonicalPath() + File.separator + "src" + File.separator + "test" + File.separator + + "resources" + File.separator + "IDonotExist.json"); servlet.init(servletConfig); } catch (Exception e1) { logger.error("Exception Occured" + e1); @@ -217,8 +210,8 @@ public class PolicyManagerServletTest extends Mockito { public void testDescribePolicy() { PolicyManagerServlet servlet = new PolicyManagerServlet(); PolicyController controller = mock(PolicyController.class); - BufferedReader reader = new BufferedReader(new StringReader( - "{params: { mode: 'DESCRIBEPOLICYFILE', path: 'com.Config_SampleTest1206.1.xml'}}")); + BufferedReader reader = new BufferedReader( + new StringReader("{params: { mode: 'DESCRIBEPOLICYFILE', path: 'com.Config_SampleTest1206.1.xml'}}")); try { when(request.getReader()).thenReturn(reader); String query = "FROM PolicyEntity where policyName = :split_1 and scope = :split_0"; @@ -231,7 +224,6 @@ public class PolicyManagerServletTest extends Mockito { } } - @SuppressWarnings("static-access") @Test public void testPolicyScopeList() { @@ -245,14 +237,11 @@ public class PolicyManagerServletTest extends Mockito { try { when(request.getReader()).thenReturn(reader); when(controller.getRoles("Test")).thenReturn(rolesdata); - when(controller.getDataByQuery("from PolicyEditorScopes", null)) + when(controller.getDataByQuery("from PolicyEditorScopes", null)).thenReturn(policyEditorScopes); + when(controller.getDataByQuery("from PolicyEditorScopes where SCOPENAME like :scopeName", null)) .thenReturn(policyEditorScopes); - when(controller.getDataByQuery( - "from PolicyEditorScopes where SCOPENAME like :scopeName", null)) - .thenReturn(policyEditorScopes); - when(controller.getDataByQuery( - "from PolicyVersion where POLICY_NAME like :scopeName", null)) - .thenReturn(policyVersion); + when(controller.getDataByQuery("from PolicyVersion where POLICY_NAME like :scopeName", null)) + .thenReturn(policyVersion); servlet.setPolicyController(controller); servlet.setTestUserId("Test"); servlet.doPost(request, response); @@ -269,16 +258,14 @@ public class PolicyManagerServletTest extends Mockito { PolicyManagerServlet servlet = new PolicyManagerServlet(); PolicyController controller = mock(PolicyController.class); List list = new ArrayList<>(); - list.add( - "{params: { mode: 'EDITFILE', path: '/com/Config_SampleTest1206.1.xml', onlyFolders: false}}"); + list.add("{params: { mode: 'EDITFILE', path: '/com/Config_SampleTest1206.1.xml', onlyFolders: false}}"); for (int i = 0; i < list.size(); i++) { BufferedReader reader = new BufferedReader(new StringReader(list.get(i))); try { when(request.getReader()).thenReturn(reader); when(controller.getRoles("Test")).thenReturn(rolesdata); - when(controller.getDataByQuery( - "FROM PolicyEntity where policyName = :split_1 and scope = :split_0", null)) - .thenReturn(basePolicyData); + when(controller.getDataByQuery("FROM PolicyEntity where policyName = :split_1 and scope = :split_0", + null)).thenReturn(basePolicyData); servlet.setPolicyController(controller); servlet.setTestUserId("Test"); servlet.doPost(request, response); @@ -297,10 +284,10 @@ public class PolicyManagerServletTest extends Mockito { String configData = ""; try { ClassLoader classLoader = getClass().getClassLoader(); - policyContent = IOUtils.toString(classLoader - .getResourceAsStream("Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml")); - configData = IOUtils.toString(classLoader - .getResourceAsStream("com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt")); + policyContent = + IOUtils.toString(classLoader.getResourceAsStream("Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml")); + configData = IOUtils + .toString(classLoader.getResourceAsStream("com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt")); } catch (Exception e1) { logger.error("Exception Occured" + e1); } @@ -311,25 +298,22 @@ public class PolicyManagerServletTest extends Mockito { ConfigurationDataEntity configurationEntity = new ConfigurationDataEntity(); configurationEntity.setConfigBody(configData); configurationEntity.setConfigType("OTHER"); - configurationEntity - .setConfigurationName("com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt"); + configurationEntity.setConfigurationName("com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.txt"); configurationEntity.setDescription("test"); entity.setConfigurationData(configurationEntity); policyData.add(entity); PolicyManagerServlet servlet = new PolicyManagerServlet(); PolicyController controller = mock(PolicyController.class); List list = new ArrayList<>(); - list.add( - "{params: { mode: 'EDITFILE', path: '/com/Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml'," - + " onlyFolders: false}}"); + list.add("{params: { mode: 'EDITFILE', path: '/com/Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml'," + + " onlyFolders: false}}"); for (int i = 0; i < list.size(); i++) { BufferedReader reader = new BufferedReader(new StringReader(list.get(i))); try { when(request.getReader()).thenReturn(reader); when(controller.getRoles("Test")).thenReturn(rolesdata); - when(controller.getDataByQuery( - "FROM PolicyEntity where policyName = :split_1 and scope = :split_0", null)) - .thenReturn(policyData); + when(controller.getDataByQuery("FROM PolicyEntity where policyName = :split_1 and scope = :split_0", + null)).thenReturn(policyData); servlet.setPolicyController(controller); servlet.setTestUserId("Test"); servlet.doPost(request, response); @@ -348,10 +332,10 @@ public class PolicyManagerServletTest extends Mockito { String configData = ""; try { ClassLoader classLoader = getClass().getClassLoader(); - policyContent = IOUtils.toString( - classLoader.getResourceAsStream("Config_BRMS_Raw_TestBRMSRawPolicy.1.xml")); - configData = IOUtils.toString( - classLoader.getResourceAsStream("com.Config_BRMS_Raw_TestBRMSRawPolicy.1.txt")); + policyContent = + IOUtils.toString(classLoader.getResourceAsStream("Config_BRMS_Raw_TestBRMSRawPolicy.1.xml")); + configData = + IOUtils.toString(classLoader.getResourceAsStream("com.Config_BRMS_Raw_TestBRMSRawPolicy.1.txt")); } catch (Exception e1) { logger.error("Exception Occured" + e1); } @@ -369,17 +353,15 @@ public class PolicyManagerServletTest extends Mockito { PolicyManagerServlet servlet = new PolicyManagerServlet(); PolicyController controller = mock(PolicyController.class); List list = new ArrayList<>(); - list.add( - "{params: { mode: 'EDITFILE', path: '/com/Config_BRMS_Raw_TestBRMSRawPolicy.1.xml'," - + " onlyFolders: false}}"); + list.add("{params: { mode: 'EDITFILE', path: '/com/Config_BRMS_Raw_TestBRMSRawPolicy.1.xml'," + + " onlyFolders: false}}"); for (int i = 0; i < list.size(); i++) { BufferedReader reader = new BufferedReader(new StringReader(list.get(i))); try { when(request.getReader()).thenReturn(reader); when(controller.getRoles("Test")).thenReturn(rolesdata); - when(controller.getDataByQuery( - "FROM PolicyEntity where policyName = :split_1 and scope = :split_0", null)) - .thenReturn(policyData); + when(controller.getDataByQuery("FROM PolicyEntity where policyName = :split_1 and scope = :split_0", + null)).thenReturn(policyData); servlet.setPolicyController(controller); servlet.setTestUserId("Test"); servlet.doPost(request, response); @@ -398,10 +380,10 @@ public class PolicyManagerServletTest extends Mockito { String configData = ""; try { ClassLoader classLoader = getClass().getClassLoader(); - policyContent = IOUtils.toString( - classLoader.getResourceAsStream("Config_Fault_TestClosedLoopPolicy.1.xml")); - configData = IOUtils.toString(classLoader - .getResourceAsStream("com.Config_Fault_TestClosedLoopPolicy.1.json")); + policyContent = + IOUtils.toString(classLoader.getResourceAsStream("Config_Fault_TestClosedLoopPolicy.1.xml")); + configData = + IOUtils.toString(classLoader.getResourceAsStream("com.Config_Fault_TestClosedLoopPolicy.1.json")); } catch (Exception e1) { logger.error("Exception Occured" + e1); } @@ -419,17 +401,15 @@ public class PolicyManagerServletTest extends Mockito { PolicyManagerServlet servlet = new PolicyManagerServlet(); PolicyController controller = mock(PolicyController.class); List list = new ArrayList<>(); - list.add( - "{params: { mode: 'EDITFILE', path: '/com/Config_Fault_TestClosedLoopPolicy.1.xml'," - + " onlyFolders: false}}"); + list.add("{params: { mode: 'EDITFILE', path: '/com/Config_Fault_TestClosedLoopPolicy.1.xml'," + + " onlyFolders: false}}"); for (int i = 0; i < list.size(); i++) { BufferedReader reader = new BufferedReader(new StringReader(list.get(i))); try { when(request.getReader()).thenReturn(reader); when(controller.getRoles("Test")).thenReturn(rolesdata); - when(controller.getDataByQuery( - "FROM PolicyEntity where policyName = :split_1 and scope = :split_0", null)) - .thenReturn(policyData); + when(controller.getDataByQuery("FROM PolicyEntity where policyName = :split_1 and scope = :split_0", + null)).thenReturn(policyData); servlet.setPolicyController(controller); servlet.setTestUserId("Test"); servlet.doPost(request, response); @@ -448,10 +428,9 @@ public class PolicyManagerServletTest extends Mockito { String configData = ""; try { ClassLoader classLoader = getClass().getClassLoader(); - policyContent = IOUtils.toString( - classLoader.getResourceAsStream("Config_PM_TestClosedLoopPMPolicy.1.xml")); - configData = IOUtils.toString( - classLoader.getResourceAsStream("com.Config_PM_TestClosedLoopPMPolicy.1.json")); + policyContent = IOUtils.toString(classLoader.getResourceAsStream("Config_PM_TestClosedLoopPMPolicy.1.xml")); + configData = + IOUtils.toString(classLoader.getResourceAsStream("com.Config_PM_TestClosedLoopPMPolicy.1.json")); } catch (Exception e1) { logger.error("Exception Occured" + e1); } @@ -476,9 +455,8 @@ public class PolicyManagerServletTest extends Mockito { try { when(request.getReader()).thenReturn(reader); when(controller.getRoles("Test")).thenReturn(rolesdata); - when(controller.getDataByQuery( - "FROM PolicyEntity where policyName = :split_1 and scope = :split_0", null)) - .thenReturn(policyData); + when(controller.getDataByQuery("FROM PolicyEntity where policyName = :split_1 and scope = :split_0", + null)).thenReturn(policyData); servlet.setPolicyController(controller); servlet.setTestUserId("Test"); servlet.doPost(request, response); @@ -505,10 +483,8 @@ public class PolicyManagerServletTest extends Mockito { String configData = ""; try { ClassLoader classLoader = getClass().getClassLoader(); - policyContent = - IOUtils.toString(classLoader.getResourceAsStream("Config_MS_vFirewall.1.xml")); - configData = IOUtils - .toString(classLoader.getResourceAsStream("com.Config_MS_vFirewall.1.json")); + policyContent = IOUtils.toString(classLoader.getResourceAsStream("Config_MS_vFirewall.1.xml")); + configData = IOUtils.toString(classLoader.getResourceAsStream("com.Config_MS_vFirewall.1.json")); } catch (Exception e1) { logger.error("Exception Occured" + e1); } @@ -526,20 +502,17 @@ public class PolicyManagerServletTest extends Mockito { PolicyManagerServlet servlet = new PolicyManagerServlet(); PolicyController controller = mock(PolicyController.class); List list = new ArrayList<>(); - list.add( - "{params: { mode: 'EDITFILE', path: '/com/Config_MS_vFirewall.1.xml', onlyFolders: false}}"); + list.add("{params: { mode: 'EDITFILE', path: '/com/Config_MS_vFirewall.1.xml', onlyFolders: false}}"); for (int i = 0; i < list.size(); i++) { BufferedReader reader = new BufferedReader(new StringReader(list.get(i))); try { when(request.getReader()).thenReturn(reader); when(commonClassDao.getDataById(GroupPolicyScopeList.class, "groupList", "resource=SampleResource,service=SampleService,type=SampleType," - + "closedLoopControlName=SampleClosedLoop")) - .thenReturn(groupListData); + + "closedLoopControlName=SampleClosedLoop")).thenReturn(groupListData); when(controller.getRoles("Test")).thenReturn(rolesdata); - when(controller.getDataByQuery( - "FROM PolicyEntity where policyName = :split_1 and scope = :split_0", null)) - .thenReturn(policyData); + when(controller.getDataByQuery("FROM PolicyEntity where policyName = :split_1 and scope = :split_0", + null)).thenReturn(policyData); servlet.setPolicyController(controller); servlet.setTestUserId("Test"); servlet.doPost(request, response); @@ -558,10 +531,8 @@ public class PolicyManagerServletTest extends Mockito { String configData = ""; try { ClassLoader classLoader = getClass().getClassLoader(); - policyContent = IOUtils.toString( - classLoader.getResourceAsStream("Config_FW_TestFireWallPolicy.1.xml")); - configData = IOUtils.toString( - classLoader.getResourceAsStream("com.Config_FW_TestFireWallPolicy.1.json")); + policyContent = IOUtils.toString(classLoader.getResourceAsStream("Config_FW_TestFireWallPolicy.1.xml")); + configData = IOUtils.toString(classLoader.getResourceAsStream("com.Config_FW_TestFireWallPolicy.1.json")); } catch (Exception e1) { logger.error("Exception Occured" + e1); } @@ -586,9 +557,8 @@ public class PolicyManagerServletTest extends Mockito { try { when(request.getReader()).thenReturn(reader); when(controller.getRoles("Test")).thenReturn(rolesdata); - when(controller.getDataByQuery( - "FROM PolicyEntity where policyName = :split_1 and scope = :split_0", null)) - .thenReturn(policyData); + when(controller.getDataByQuery("FROM PolicyEntity where policyName = :split_1 and scope = :split_0", + null)).thenReturn(policyData); servlet.setPolicyController(controller); servlet.setTestUserId("Test"); servlet.doPost(request, response); @@ -607,10 +577,8 @@ public class PolicyManagerServletTest extends Mockito { String configData = ""; try { ClassLoader classLoader = getClass().getClassLoader(); - policyContent = IOUtils - .toString(classLoader.getResourceAsStream("Action_TestActionPolicy.1.xml")); - configData = IOUtils.toString( - classLoader.getResourceAsStream("com.Action_TestActionPolicy.1.json")); + policyContent = IOUtils.toString(classLoader.getResourceAsStream("Action_TestActionPolicy.1.xml")); + configData = IOUtils.toString(classLoader.getResourceAsStream("com.Action_TestActionPolicy.1.json")); } catch (Exception e1) { logger.error("Exception Occured" + e1); } @@ -626,16 +594,14 @@ public class PolicyManagerServletTest extends Mockito { PolicyManagerServlet servlet = new PolicyManagerServlet(); PolicyController controller = mock(PolicyController.class); List list = new ArrayList<>(); - list.add("{params: { mode: 'EDITFILE', path: '/com/Action_TestActionPolicy.1.xml'," - + " onlyFolders: false}}"); + list.add("{params: { mode: 'EDITFILE', path: '/com/Action_TestActionPolicy.1.xml'," + " onlyFolders: false}}"); for (int i = 0; i < list.size(); i++) { BufferedReader reader = new BufferedReader(new StringReader(list.get(i))); try { when(request.getReader()).thenReturn(reader); when(controller.getRoles("Test")).thenReturn(rolesdata); - when(controller.getDataByQuery( - "FROM PolicyEntity where policyName = :split_1 and scope = :split_0", null)) - .thenReturn(policyData); + when(controller.getDataByQuery("FROM PolicyEntity where policyName = :split_1 and scope = :split_0", + null)).thenReturn(policyData); servlet.setPolicyController(controller); servlet.setTestUserId("Test"); servlet.doPost(request, response); @@ -653,8 +619,8 @@ public class PolicyManagerServletTest extends Mockito { String policyContent = ""; try { ClassLoader classLoader = getClass().getClassLoader(); - policyContent = IOUtils.toString(classLoader - .getResourceAsStream("Decision_TestDecisionPolicyWithRuleAlgorithms.1.xml")); + policyContent = IOUtils + .toString(classLoader.getResourceAsStream("Decision_TestDecisionPolicyWithRuleAlgorithms.1.xml")); } catch (Exception e1) { logger.error("Exception Occured" + e1); } @@ -666,17 +632,15 @@ public class PolicyManagerServletTest extends Mockito { PolicyManagerServlet servlet = new PolicyManagerServlet(); PolicyController controller = mock(PolicyController.class); List list = new ArrayList<>(); - list.add( - "{params: { mode: 'EDITFILE', path: '/com/Decision_TestDecisionPolicyWithRuleAlgorithms.1.xml'," - + " onlyFolders: false}}"); + list.add("{params: { mode: 'EDITFILE', path: '/com/Decision_TestDecisionPolicyWithRuleAlgorithms.1.xml'," + + " onlyFolders: false}}"); for (int i = 0; i < list.size(); i++) { BufferedReader reader = new BufferedReader(new StringReader(list.get(i))); try { when(request.getReader()).thenReturn(reader); when(controller.getRoles("Test")).thenReturn(rolesdata); - when(controller.getDataByQuery( - "FROM PolicyEntity where policyName = :split_1 and scope = :split_0", null)) - .thenReturn(policyData); + when(controller.getDataByQuery("FROM PolicyEntity where policyName = :split_1 and scope = :split_0", + null)).thenReturn(policyData); servlet.setPolicyController(controller); servlet.setTestUserId("Test"); servlet.doPost(request, response); @@ -692,19 +656,16 @@ public class PolicyManagerServletTest extends Mockito { PolicyManagerServlet servlet = new PolicyManagerServlet(); PolicyController controller = mock(PolicyController.class); List readers = new ArrayList<>(); + readers.add(new BufferedReader(new StringReader("{params: { mode: 'ADDFOLDER', path: '/', name: 'Test'}}"))); + readers.add(new BufferedReader(new StringReader("{params: { mode: 'ADDFOLDER', path: '/', name: 'Test*&'}}"))); readers.add(new BufferedReader( - new StringReader("{params: { mode: 'ADDFOLDER', path: '/', name: 'Test'}}"))); - readers.add(new BufferedReader( - new StringReader("{params: { mode: 'ADDFOLDER', path: '/', name: 'Test*&'}}"))); - readers.add(new BufferedReader(new StringReader( - "{params: { mode: 'ADDFOLDER', path: '/Test', subScopename: 'Test1'}}"))); + new StringReader("{params: { mode: 'ADDFOLDER', path: '/Test', subScopename: 'Test1'}}"))); for (int i = 0; i < readers.size(); i++) { try { when(request.getReader()).thenReturn(readers.get(i)); PolicyManagerServlet.setPolicyController(controller); servlet.doPost(request, response); - assertTrue(response.getContentAsString() != null - && response.getContentAsString().contains("success")); + assertTrue(response.getContentAsString() != null && response.getContentAsString().contains("success")); } catch (Exception e1) { logger.error("Exception Occured" + e1); fail(); @@ -720,18 +681,16 @@ public class PolicyManagerServletTest extends Mockito { when(controller.getEntityItem(ConfigurationDataEntity.class, "configurationName", "com.Config_SampleTest1206.1.txt")).thenReturn(configurationEntity); when(controller.getDataByQuery( - "FROM PolicyEntity where policyName = :oldPolicySplit_1 and scope = :oldPolicySplit_0", - null)).thenReturn(basePolicyData); - readers.add(new BufferedReader( - new StringReader("{params: { mode: 'COPY', path: 'com.Config_test.1.xml'," - + " newPath: 'com.Config_testClone.1.xml'}}"))); + "FROM PolicyEntity where policyName = :oldPolicySplit_1 and scope = :oldPolicySplit_0", null)) + .thenReturn(basePolicyData); + readers.add(new BufferedReader(new StringReader("{params: { mode: 'COPY', path: 'com.Config_test.1.xml'," + + " newPath: 'com.Config_testClone.1.xml'}}"))); for (int i = 0; i < readers.size(); i++) { try { when(request.getReader()).thenReturn(readers.get(i)); PolicyManagerServlet.setPolicyController(controller); servlet.doPost(request, response); - assertTrue(response.getContentAsString() != null - && response.getContentAsString().contains("success")); + assertTrue(response.getContentAsString() != null && response.getContentAsString().contains("success")); } catch (Exception e1) { logger.error("Exception Occured" + e1); fail(); @@ -747,18 +706,16 @@ public class PolicyManagerServletTest extends Mockito { when(controller.getEntityItem(ConfigurationDataEntity.class, "configurationName", "com.Config_SampleTest1206.1.txt")).thenReturn(configurationEntity); when(controller.getDataByQuery( - "FROM PolicyEntity where policyName = :oldPolicySplit_1 and scope = :oldPolicySplit_0", - null)).thenReturn(basePolicyData); - readers.add(new BufferedReader( - new StringReader("{params: { mode: 'RENAME', path: 'com.Config_test.1.xml'," - + " newPath: 'com.Config_testClone.1.xml'}}"))); + "FROM PolicyEntity where policyName = :oldPolicySplit_1 and scope = :oldPolicySplit_0", null)) + .thenReturn(basePolicyData); + readers.add(new BufferedReader(new StringReader("{params: { mode: 'RENAME', path: 'com.Config_test.1.xml'," + + " newPath: 'com.Config_testClone.1.xml'}}"))); for (int i = 0; i < readers.size(); i++) { try { when(request.getReader()).thenReturn(readers.get(i)); PolicyManagerServlet.setPolicyController(controller); servlet.doPost(request, response); - assertTrue(response.getContentAsString() != null - && response.getContentAsString().contains("success")); + assertTrue(response.getContentAsString() != null && response.getContentAsString().contains("success")); } catch (Exception e1) { logger.error("Exception Occured" + e1); fail(); @@ -771,15 +728,13 @@ public class PolicyManagerServletTest extends Mockito { PolicyManagerServlet servlet = new PolicyManagerServlet(); PolicyController controller = mock(PolicyController.class); List readers = new ArrayList<>(); - readers.add(new BufferedReader( - new StringReader("{params: { mode: 'RENAME', path: 'com', newPath: 'Test'}}"))); + readers.add(new BufferedReader(new StringReader("{params: { mode: 'RENAME', path: 'com', newPath: 'Test'}}"))); for (int i = 0; i < readers.size(); i++) { try { when(request.getReader()).thenReturn(readers.get(i)); PolicyManagerServlet.setPolicyController(controller); servlet.doPost(request, response); - assertTrue(response.getContentAsString() != null - && response.getContentAsString().contains("success")); + assertTrue(response.getContentAsString() != null && response.getContentAsString().contains("success")); } catch (Exception e1) { logger.error("Exception Occured" + e1); fail(); diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyNotificationMailTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyNotificationMailTest.java index f5162a695..4449676d3 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyNotificationMailTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyNotificationMailTest.java @@ -19,16 +19,19 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.admin; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import java.util.ArrayList; import java.util.List; + import org.junit.Before; import org.junit.Test; -import static org.mockito.Mockito.when; import org.onap.policy.common.utils.network.NetworkUtil; import org.onap.policy.controller.PolicyController; import org.onap.policy.rest.dao.CommonClassDao; @@ -69,9 +72,8 @@ public class PolicyNotificationMailTest { commonClassDao = mock(CommonClassDao.class); PolicyController.setCommonClassDao(commonClassDao); - when(commonClassDao.getDataByQuery( - "from WatchPolicyNotificationTable where policyName like:policyFileName", null)) - .thenReturn(data); + when(commonClassDao.getDataByQuery("from WatchPolicyNotificationTable where policyName like:policyFileName", + null)).thenReturn(data); } @Test diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java index ce38f236f..912f4d9ce 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -19,18 +19,22 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.admin; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; + import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; import java.util.List; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; + import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; @@ -73,69 +77,65 @@ public class PolicyRestControllerTest { response = new MockHttpServletResponse(); User user = new User(); user.setOrgUserId("Test"); - Mockito.when(mockSession.getAttribute(SystemProperties.getProperty("user_attribute_name"))) - .thenReturn(user); + Mockito.when(mockSession.getAttribute(SystemProperties.getProperty("user_attribute_name"))).thenReturn(user); Mockito.when(request.getSession(false)).thenReturn(mockSession); - clRequestString = - "{\"policyData\":{\"error\":\"\",\"inprocess\":false,\"model\":{\"name\":\"com\"," - + "\"subScopename\":\"\",\"path\":[],\"type\":\"dir\",\"size\":0," - + "\"date\":\"2017-06-01T15:45:36.000Z\",\"version\":\"\",\"createdBy\":\"Demo\"," - + "\"modifiedBy\":\"Demo\",\"content\":\"\",\"recursive\":false}," - + "\"tempModel\":{\"name\":\"com\",\"subScopename\":\"\",\"path\":[],\"type\":\"dir\"," - + "\"size\":0,\"date\":\"2017-06-01T15:45:36.000Z\",\"version\":\"\",\"createdBy\":\"Demo\"," - + "\"modifiedBy\":\"Demo\",\"content\":\"\",\"recursive\":false}," - + "\"$$hashKey\":\"object:1439\",\"policy\":{\"policyType\":\"Config\"," - + "\"configPolicyType\":\"ClosedLoop_Fault\",\"triggerTrapSignatures\":[1,1,2,3]," - + "\"triggerfaultSignatures\":[1,1,2,3],\"traptriggerSignatures\":[{\"id\":\"Trap1\"," - + "\"$$hashKey\":\"object:1526\"},{\"id\":\"Trap2\",\"$$hashKey\":\"object:1534\"}]," - + "\"connecttriggerSignatures\":[{\"id\":\"C1\",\"$$hashKey\":\"object:1554\"," - + "\"notBox\":\"NOT\",\"connectTrap1\":\"Trap1\",\"trapCount1\":\"12\"," - + "\"operatorBox\":\"AND\",\"connectTrap2\":\"Trap2\",\"trapCount2\":\"14\"}]," - + "\"faulttriggerSignatures\":[{\"id\":\"Fault1\",\"$$hashKey\":\"object:1566\"}," - + "{\"id\":\"Fault2\",\"$$hashKey\":\"object:1575\"}],\"connectVerificationSignatures\":" - + "[{\"id\":\"C1\",\"$$hashKey\":\"object:1595\",\"notBox\":\"NOT\"," - + "\"connectTrap1\":\"Fault1\",\"trapCount1\":\"11\",\"operatorBox\":\"AND\"," - + "\"connectTrap2\":\"Fault2\",\"trapCount2\":\"12\"}],\"jsonBodyData\":" - + "{\"trapMaxAge\":\"300\",\"vnfType\":\"Test\",\"closedLoopPolicyStatus\":\"Active\"," - + "\"vUSP\":true,\"trinity\":true,\"vDNS\":true,\"mcr\":true,\"gamma\":true," - + "\"actions\":\"Test\",\"timeInterval\":\"11\",\"timeOutvPRO\":\"11\",\"timeOutRuby\":\"11\"," - + "\"retrys\":\"1\",\"agingWindow\":\"12\",\"geoLink\":\"test\"," - + "\"emailAddress\":\"aa@test.com\",\"pepName\":\"Test\",\"pepAction\":\"test\"," - + "\"conditions\":\"SEND\"},\"policyName\":\"SampleTest\"," - + "\"policyDescription\":\"SampleTest\",\"riskType\":\"SampleRiskType\",\"riskLevel\":\"1\"," - + "\"guard\":\"True\",\"onapName\":\"SampleDemo\",\"ttlDate\":\"14/09/2017\"," - + "\"clearTimeOut\":\"123\",\"trapMaxAge\":\"11\",\"verificationclearTimeOut\":\"13\"}}," - + "\"trapData\":{\"trap1\":[{\"id\":\"A1\",\"$$hashKey\":\"object:1528\"," - + "\"notBox\":\"NOT\",\"trigger1\":\"Test\",\"operatorBox\":\"AND\",\"trigger2\":\"Test\"}]," - + "\"trap2\":[{\"id\":\"A1\",\"$$hashKey\":\"object:1536\",\"notBox\":\"NOT\"," - + "\"trigger1\":\"Test\",\"operatorBox\":\"AND\",\"trigger2\":\"Test\"},{\"id\":\"A2\"," - + "\"$$hashKey\":\"object:1542\",\"notBox\":\"NOT\",\"trigger1\":\"A1\"," - + "\"operatorBox\":\"AND\",\"trigger2\":\"Test\"},{\"id\":\"A3\"," - + "\"$$hashKey\":\"object:1548\",\"notBox\":\"NOT\",\"trigger1\":\"A1\"," - + "\"operatorBox\":\"OR\",\"trigger2\":\"A2\"}]},\"faultData\":{\"trap1\":[{\"id\":\"A1\"," - + "\"$$hashKey\":\"object:1568\",\"notBox\":\"NOT\",\"trigger1\":\"Test\"," - + "\"operatorBox\":\"AND\",\"trigger2\":\"Test\"}],\"trap2\":[{\"id\":\"A1\"," - + "\"$$hashKey\":\"object:1577\",\"notBox\":\"NOT\",\"trigger1\":\"Test\"," - + "\"operatorBox\":\"AND\",\"trigger2\":\"Test\"},{\"id\":\"A2\",\"$$hashKey\":" - + "\"object:1583\",\"notBox\":\"NOT\",\"trigger1\":\"Test\",\"operatorBox\":\"OR\"," - + "\"trigger2\":\"Test\"},{\"id\":\"A3\",\"$$hashKey\":\"object:1589\",\"notBox\":\"NOT\"," - + "\"trigger1\":\"A1\",\"operatorBox\":\"AND\",\"trigger2\":\"A2\"}]}}"; - - - fwRequestString = - "{\"policyData\":{\"error\":\"\",\"inprocess\":false,\"model\":{\"name\":\"com\"," - + "\"subScopename\":\"\",\"path\":[],\"type\":\"dir\",\"size\":0," - + "\"date\":\"2017-06-01T15:45:36.000Z\",\"version\":\"\",\"createdBy\":\"Demo\"," - + "\"modifiedBy\":\"Demo\",\"content\":\"\",\"recursive\":false},\"tempModel\":" - + "{\"name\":\"com\",\"subScopename\":\"\",\"path\":[],\"type\":\"dir\",\"size\":0," - + "\"date\":\"2017-06-01T15:45:36.000Z\",\"version\":\"\",\"createdBy\":\"Demo\"," - + "\"modifiedBy\":\"Demo\",\"content\":\"\",\"recursive\":false},\"$$hashKey\":\"object:260\"," - + "\"policy\":{\"policyType\":\"Config\",\"configPolicyType\":\"Firewall Config\"," - + "\"attributes\":[{\"id\":\"choice1\",\"$$hashKey\":\"object:338\",\"key\":\"Test\"," - + "\"value\":\"Test\"}],\"fwattributes\":[],\"policyName\":\"SampleTest\"," - + "\"policyDescription\":\"SampleTest\",\"riskType\":\"SampleRiskType\",\"riskLevel\":\"1\"," - + "\"guard\":\"True\",\"configName\":\"SampleTest\",\"ttlDate\":\"14/09/2017\"," - + "\"securityZone\":\"Test\"}}}"; + clRequestString = "{\"policyData\":{\"error\":\"\",\"inprocess\":false,\"model\":{\"name\":\"com\"," + + "\"subScopename\":\"\",\"path\":[],\"type\":\"dir\",\"size\":0," + + "\"date\":\"2017-06-01T15:45:36.000Z\",\"version\":\"\",\"createdBy\":\"Demo\"," + + "\"modifiedBy\":\"Demo\",\"content\":\"\",\"recursive\":false}," + + "\"tempModel\":{\"name\":\"com\",\"subScopename\":\"\",\"path\":[],\"type\":\"dir\"," + + "\"size\":0,\"date\":\"2017-06-01T15:45:36.000Z\",\"version\":\"\",\"createdBy\":\"Demo\"," + + "\"modifiedBy\":\"Demo\",\"content\":\"\",\"recursive\":false}," + + "\"$$hashKey\":\"object:1439\",\"policy\":{\"policyType\":\"Config\"," + + "\"configPolicyType\":\"ClosedLoop_Fault\",\"triggerTrapSignatures\":[1,1,2,3]," + + "\"triggerfaultSignatures\":[1,1,2,3],\"traptriggerSignatures\":[{\"id\":\"Trap1\"," + + "\"$$hashKey\":\"object:1526\"},{\"id\":\"Trap2\",\"$$hashKey\":\"object:1534\"}]," + + "\"connecttriggerSignatures\":[{\"id\":\"C1\",\"$$hashKey\":\"object:1554\"," + + "\"notBox\":\"NOT\",\"connectTrap1\":\"Trap1\",\"trapCount1\":\"12\"," + + "\"operatorBox\":\"AND\",\"connectTrap2\":\"Trap2\",\"trapCount2\":\"14\"}]," + + "\"faulttriggerSignatures\":[{\"id\":\"Fault1\",\"$$hashKey\":\"object:1566\"}," + + "{\"id\":\"Fault2\",\"$$hashKey\":\"object:1575\"}],\"connectVerificationSignatures\":" + + "[{\"id\":\"C1\",\"$$hashKey\":\"object:1595\",\"notBox\":\"NOT\"," + + "\"connectTrap1\":\"Fault1\",\"trapCount1\":\"11\",\"operatorBox\":\"AND\"," + + "\"connectTrap2\":\"Fault2\",\"trapCount2\":\"12\"}],\"jsonBodyData\":" + + "{\"trapMaxAge\":\"300\",\"vnfType\":\"Test\",\"closedLoopPolicyStatus\":\"Active\"," + + "\"vUSP\":true,\"trinity\":true,\"vDNS\":true,\"mcr\":true,\"gamma\":true," + + "\"actions\":\"Test\",\"timeInterval\":\"11\",\"timeOutvPRO\":\"11\",\"timeOutRuby\":\"11\"," + + "\"retrys\":\"1\",\"agingWindow\":\"12\",\"geoLink\":\"test\"," + + "\"emailAddress\":\"aa@test.com\",\"pepName\":\"Test\",\"pepAction\":\"test\"," + + "\"conditions\":\"SEND\"},\"policyName\":\"SampleTest\"," + + "\"policyDescription\":\"SampleTest\",\"riskType\":\"SampleRiskType\",\"riskLevel\":\"1\"," + + "\"guard\":\"True\",\"onapName\":\"SampleDemo\",\"ttlDate\":\"14/09/2017\"," + + "\"clearTimeOut\":\"123\",\"trapMaxAge\":\"11\",\"verificationclearTimeOut\":\"13\"}}," + + "\"trapData\":{\"trap1\":[{\"id\":\"A1\",\"$$hashKey\":\"object:1528\"," + + "\"notBox\":\"NOT\",\"trigger1\":\"Test\",\"operatorBox\":\"AND\",\"trigger2\":\"Test\"}]," + + "\"trap2\":[{\"id\":\"A1\",\"$$hashKey\":\"object:1536\",\"notBox\":\"NOT\"," + + "\"trigger1\":\"Test\",\"operatorBox\":\"AND\",\"trigger2\":\"Test\"},{\"id\":\"A2\"," + + "\"$$hashKey\":\"object:1542\",\"notBox\":\"NOT\",\"trigger1\":\"A1\"," + + "\"operatorBox\":\"AND\",\"trigger2\":\"Test\"},{\"id\":\"A3\"," + + "\"$$hashKey\":\"object:1548\",\"notBox\":\"NOT\",\"trigger1\":\"A1\"," + + "\"operatorBox\":\"OR\",\"trigger2\":\"A2\"}]},\"faultData\":{\"trap1\":[{\"id\":\"A1\"," + + "\"$$hashKey\":\"object:1568\",\"notBox\":\"NOT\",\"trigger1\":\"Test\"," + + "\"operatorBox\":\"AND\",\"trigger2\":\"Test\"}],\"trap2\":[{\"id\":\"A1\"," + + "\"$$hashKey\":\"object:1577\",\"notBox\":\"NOT\",\"trigger1\":\"Test\"," + + "\"operatorBox\":\"AND\",\"trigger2\":\"Test\"},{\"id\":\"A2\",\"$$hashKey\":" + + "\"object:1583\",\"notBox\":\"NOT\",\"trigger1\":\"Test\",\"operatorBox\":\"OR\"," + + "\"trigger2\":\"Test\"},{\"id\":\"A3\",\"$$hashKey\":\"object:1589\",\"notBox\":\"NOT\"," + + "\"trigger1\":\"A1\",\"operatorBox\":\"AND\",\"trigger2\":\"A2\"}]}}"; + + fwRequestString = "{\"policyData\":{\"error\":\"\",\"inprocess\":false,\"model\":{\"name\":\"com\"," + + "\"subScopename\":\"\",\"path\":[],\"type\":\"dir\",\"size\":0," + + "\"date\":\"2017-06-01T15:45:36.000Z\",\"version\":\"\",\"createdBy\":\"Demo\"," + + "\"modifiedBy\":\"Demo\",\"content\":\"\",\"recursive\":false},\"tempModel\":" + + "{\"name\":\"com\",\"subScopename\":\"\",\"path\":[],\"type\":\"dir\",\"size\":0," + + "\"date\":\"2017-06-01T15:45:36.000Z\",\"version\":\"\",\"createdBy\":\"Demo\"," + + "\"modifiedBy\":\"Demo\",\"content\":\"\",\"recursive\":false},\"$$hashKey\":\"object:260\"," + + "\"policy\":{\"policyType\":\"Config\",\"configPolicyType\":\"Firewall Config\"," + + "\"attributes\":[{\"id\":\"choice1\",\"$$hashKey\":\"object:338\",\"key\":\"Test\"," + + "\"value\":\"Test\"}],\"fwattributes\":[],\"policyName\":\"SampleTest\"," + + "\"policyDescription\":\"SampleTest\",\"riskType\":\"SampleRiskType\",\"riskLevel\":\"1\"," + + "\"guard\":\"True\",\"configName\":\"SampleTest\",\"ttlDate\":\"14/09/2017\"," + + "\"securityZone\":\"Test\"}}}"; fwViewRequestString = "{\"policyData\":{\"policyType\":\"Config\",\"configPolicyType\":\"Firewall Config\",\"attributes\":" @@ -144,8 +144,6 @@ public class PolicyRestControllerTest { + "\"riskType\":\"SampleRiskType\",\"riskLevel\":\"1\",\"guard\":\"True\"," + "\"configName\":\"SampleTest\",\"ttlDate\":\"14/09/2017\",\"securityZone\":\"Test\"}}"; - - prefixListData = new ArrayList<>(); PrefixList prefixList = new PrefixList(); prefixList.setPrefixListName("Test"); @@ -209,8 +207,7 @@ public class PolicyRestControllerTest { termList.setAction("Test"); termListData.add(termList); when(commonClassDao.getData(TermList.class)).thenReturn(termListData); - when(commonClassDao.getDataById(TermList.class, "termName", "Test")) - .thenReturn(termListData); + when(commonClassDao.getDataById(TermList.class, "termName", "Test")).thenReturn(termListData); } @Test diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyUserInfoControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyUserInfoControllerTest.java index d05b7933d..bf4b67683 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyUserInfoControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyUserInfoControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -19,13 +19,16 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.admin; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; + import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; @@ -45,8 +48,7 @@ public class PolicyUserInfoControllerTest { response = new MockHttpServletResponse(); User user = new User(); user.setOrgUserId("Test"); - Mockito.when(mockSession.getAttribute(SystemProperties.getProperty("user_attribute_name"))) - .thenReturn(user); + Mockito.when(mockSession.getAttribute(SystemProperties.getProperty("user_attribute_name"))).thenReturn(user); Mockito.when(request.getSession(false)).thenReturn(mockSession); } diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/RESTfulPAPEngineTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/RESTfulPAPEngineTest.java index be248598f..e28ca1281 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/RESTfulPAPEngineTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/RESTfulPAPEngineTest.java @@ -19,17 +19,24 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.admin; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; +import com.att.research.xacml.api.pap.PAPException; +import com.att.research.xacml.api.pap.PDPPolicy; +import com.att.research.xacml.util.XACMLProperties; + import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URLConnection; + import javax.servlet.http.HttpServletResponse; + import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -40,9 +47,6 @@ import org.mockito.Mockito; import org.onap.policy.rest.adapter.PolicyRestAdapter; import org.onap.policy.xacml.api.pap.OnapPDP; import org.onap.policy.xacml.api.pap.OnapPDPGroup; -import com.att.research.xacml.api.pap.PAPException; -import com.att.research.xacml.api.pap.PDPPolicy; -import com.att.research.xacml.util.XACMLProperties; public class RESTfulPAPEngineTest { @Rule diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/conf/HibernateSessionTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/conf/HibernateSessionTest.java index dab2cba53..3bd48d67a 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/conf/HibernateSessionTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/conf/HibernateSessionTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -23,6 +23,7 @@ package org.onap.policy.conf; import static org.junit.Assert.assertNull; + import org.hibernate.SessionFactory; import org.junit.Before; import org.junit.Test; diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AdminTabControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AdminTabControllerTest.java index a4999ff42..68da8e714 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AdminTabControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AdminTabControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -19,19 +19,23 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.controller; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; + import java.io.BufferedReader; import java.io.StringReader; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; + import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; @@ -62,8 +66,7 @@ public class AdminTabControllerTest { HttpSession mockSession = mock(HttpSession.class); User user = new User(); user.setOrgUserId("Test"); - Mockito.when(mockSession.getAttribute(SystemProperties.getProperty("user_attribute_name"))) - .thenReturn(user); + Mockito.when(mockSession.getAttribute(SystemProperties.getProperty("user_attribute_name"))).thenReturn(user); Mockito.when(request.getSession(false)).thenReturn(mockSession); AdminTabController.setCommonClassDao(commonClassDao); @@ -81,8 +84,7 @@ public class AdminTabControllerTest { AdminTabController admin = new AdminTabController(); try { admin.getAdminTabEntityData(request, response); - assertTrue(response.getContentAsString() != null - && response.getContentAsString().contains("lockdowndata")); + assertTrue(response.getContentAsString() != null && response.getContentAsString().contains("lockdowndata")); } catch (UnsupportedEncodingException e) { logger.error("Exception Occured" + e); fail(); diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AutoPushControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AutoPushControllerTest.java index 5dd5d7ee3..7d2d5f8c2 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AutoPushControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AutoPushControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -19,12 +19,19 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; + +import com.mockrunner.mock.web.MockHttpServletRequest; +import com.mockrunner.mock.web.MockHttpServletResponse; + import java.io.IOException; + import javax.servlet.http.HttpServletResponse; + import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -35,8 +42,6 @@ import org.onap.portalsdk.core.web.support.UserUtils; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import com.mockrunner.mock.web.MockHttpServletRequest; -import com.mockrunner.mock.web.MockHttpServletResponse; @RunWith(PowerMockRunner.class) public class AutoPushControllerTest { diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java index e4ededa1f..96320e7bc 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java @@ -22,7 +22,6 @@ package org.onap.policy.controller; - import static org.easymock.EasyMock.createMock; import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.replay; @@ -31,10 +30,12 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; + import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.fge.jackson.JsonLoader; + import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -46,9 +47,11 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; + import javax.servlet.ReadListener; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; + import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType; @@ -56,6 +59,7 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType; + import org.junit.Before; import org.junit.Test; import org.onap.policy.common.logging.flexlogger.FlexLogger; diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateOptimizationControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateOptimizationControllerTest.java index 6747e9669..6a5e83f4e 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateOptimizationControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateOptimizationControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -22,7 +22,6 @@ package org.onap.policy.controller; - import static org.easymock.EasyMock.createMock; import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.replay; @@ -31,6 +30,12 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.fge.jackson.JsonLoader; + import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -39,9 +44,19 @@ import java.io.InputStream; import java.io.StringReader; import java.util.ArrayList; import java.util.List; + import javax.servlet.ReadListener; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; + +import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType; +import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType; +import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType; +import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType; +import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType; +import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType; +import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType; + import org.junit.Before; import org.junit.Test; import org.onap.policy.common.logging.flexlogger.FlexLogger; @@ -53,17 +68,6 @@ import org.onap.policy.rest.jpa.OptimizationModels; import org.onap.policy.rest.jpa.PolicyEntity; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.fge.jackson.JsonLoader; -import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType; -import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType; -import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType; -import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType; -import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType; -import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType; -import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType; /** * The class CreateOptimizationControllerTest contains tests for the class @@ -94,26 +98,24 @@ public class CreateOptimizationControllerTest { when(commonClassDao.getDataById(OptimizationModels.class, "modelName", "test")) .thenReturn(optimizationModelsData); - jsonString = - "{\"policyData\": {\"error\": \"\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", " - + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0," - + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\"," - + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false}," - + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"}," - + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"OOF\"," - + "\"policyName\": \"testPolicy\",\"policyDescription\": \"testing input\"," - + "\"onapName\": \"test\",\"guard\": \"False\",\"riskType\": \"Risk12345\"," - + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\"," - + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}}," - + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}"; - - configBodyString = - "{\"service\":\"PolicyEntityTest\",\"policyName\":\"someone\",\"description\":\"test\"," - + "\"templateVersion\":\"1607\",\"version\":\"HD\",\"priority\":\"2\"," - + "\"content\":{\"lastPolled\":\"1\",\"boolen-test\":\"true\",\"created\":\"test\"," - + "\"retiredDate\":\"test\",\"scope\":\"TEST_PLACEMENT_VDHV\",\"name\":\"test\"," - + "\"lastModified\":\"test\",\"state\":\"CREATED\",\"type\":\"CONFIG\",\"intent\":\"test\"," - + "\"target\":\"TEST\"}}"; + jsonString = "{\"policyData\": {\"error\": \"\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\", " + + " \"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0," + + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\"," + + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false}," + + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"}," + + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"OOF\"," + + "\"policyName\": \"testPolicy\",\"policyDescription\": \"testing input\"," + + "\"onapName\": \"test\",\"guard\": \"False\",\"riskType\": \"Risk12345\"," + + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\"," + + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}}," + + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}"; + + configBodyString = "{\"service\":\"PolicyEntityTest\",\"policyName\":\"someone\",\"description\":\"test\"," + + "\"templateVersion\":\"1607\",\"version\":\"HD\",\"priority\":\"2\"," + + "\"content\":{\"lastPolled\":\"1\",\"boolen-test\":\"true\",\"created\":\"test\"," + + "\"retiredDate\":\"test\",\"scope\":\"TEST_PLACEMENT_VDHV\",\"name\":\"test\"," + + "\"lastModified\":\"test\",\"state\":\"CREATED\",\"type\":\"CONFIG\",\"intent\":\"test\"," + + "\"target\":\"TEST\"}}"; request = mock(HttpServletRequest.class); BufferedReader br = new BufferedReader(new StringReader(jsonString)); @@ -141,15 +143,14 @@ public class CreateOptimizationControllerTest { PolicyRestAdapter policyData = null; try { root = JsonLoader.fromString(jsonString); - policyData = (PolicyRestAdapter) mapper.readValue( - root.get("policyData").get("policy").toString(), PolicyRestAdapter.class); + policyData = (PolicyRestAdapter) mapper.readValue(root.get("policyData").get("policy").toString(), + PolicyRestAdapter.class); } catch (Exception e) { logger.error("testSetDataToPolicyRestAdapter", e); } PolicyRestAdapter result = controller.setDataToPolicyRestAdapter(policyData, root); - assertTrue( - result != null && result.getJsonBody() != null && !result.getJsonBody().isEmpty()); + assertTrue(result != null && result.getJsonBody() != null && !result.getJsonBody().isEmpty()); logger.debug("result.getJsonBody() : " + result.getJsonBody()); logger.debug("testSetDataToPolicyRestAdapter: exit"); @@ -181,8 +182,8 @@ public class CreateOptimizationControllerTest { testData.setVersion("1707.4.1.2-Junit"); optimizationModelsData.add(testData); // mock the getDataById() call with the same MS model name - when(commonClassDao.getDataById(OptimizationModels.class, "modelName", - "testPolicyBody")).thenReturn(optimizationModelsData); + when(commonClassDao.getDataById(OptimizationModels.class, "modelName", "testPolicyBody")) + .thenReturn(optimizationModelsData); controller.getOptimizationTemplateData(request, response); @@ -225,8 +226,8 @@ public class CreateOptimizationControllerTest { optimizationModelsData.add(testData); // mock the getDataById() call with the same MS model name - when(commonClassDao.getDataById(OptimizationModels.class, "modelName", - "TestPolicyBody")).thenReturn(optimizationModelsData); + when(commonClassDao.getDataById(OptimizationModels.class, "modelName", "TestPolicyBody")) + .thenReturn(optimizationModelsData); controller.getModelServiceVersionData(request, response); assertTrue(response.getContentAsString() != null @@ -266,8 +267,8 @@ public class CreateOptimizationControllerTest { try { root = JsonLoader.fromString(jsonString); - restAdapter = (PolicyRestAdapter) mapper.readValue( - root.get("policyData").get("policy").toString(), PolicyRestAdapter.class); + restAdapter = (PolicyRestAdapter) mapper.readValue(root.get("policyData").get("policy").toString(), + PolicyRestAdapter.class); PolicyType policyType = new PolicyType(); TargetType target = new TargetType(); @@ -409,9 +410,7 @@ public class CreateOptimizationControllerTest { String fileName = ""; try { ClassLoader classLoader = getClass().getClassLoader(); - fileName = - new File(classLoader.getResource("schedulerPolicies-v1707.xmi").getFile()) - .getAbsolutePath(); + fileName = new File(classLoader.getResource("schedulerPolicies-v1707.xmi").getFile()).getAbsolutePath(); } catch (Exception e1) { logger.error("Exception Occured while loading file" + e1); } diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/DashboardControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/DashboardControllerTest.java index f2ecea504..f86f3532c 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/DashboardControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/DashboardControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * POLICY-SDK-APP * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -19,15 +19,19 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.controller; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; + import java.io.UnsupportedEncodingException; import java.nio.file.Path; import java.nio.file.Paths; + import javax.servlet.http.HttpServletRequest; + import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; @@ -84,8 +88,8 @@ public class DashboardControllerTest { public void testGetPAPStatusData() { try { controller.getPAPStatusData(request, response); - assertTrue(response.getContentAsString() != null - && response.getContentAsString().contains("papTableDatas")); + assertTrue( + response.getContentAsString() != null && response.getContentAsString().contains("papTableDatas")); } catch (UnsupportedEncodingException e) { logger.error("Exception Occured" + e); fail(); @@ -96,8 +100,8 @@ public class DashboardControllerTest { public void testGetPDPStatusData() { try { controller.getPDPStatusData(request, response); - assertTrue(response.getContentAsString() != null - && response.getContentAsString().contains("pdpTableDatas")); + assertTrue( + response.getContentAsString() != null && response.getContentAsString().contains("pdpTableDatas")); } catch (UnsupportedEncodingException e) { logger.error("Exception Occured" + e); fail(); diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/ExportAndImportDecisionBlackListEntriesTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/ExportAndImportDecisionBlackListEntriesTest.java index e9f953b87..1c744278a 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/ExportAndImportDecisionBlackListEntriesTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/ExportAndImportDecisionBlackListEntriesTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,9 @@ import static org.mockito.Mockito.mock; import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; + import javax.servlet.http.HttpServletRequest; + import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java index 1c1c0fbbd..0d5a09754 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -19,15 +19,19 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.controller; import static org.junit.Assert.assertTrue; + import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; + import javax.servlet.http.HttpServletRequest; + import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; @@ -86,8 +90,7 @@ public class PDPControllerTest extends Mockito { when(controller.getRoles("Test")).thenReturn(rolesdata); pdpController.getPDPGroupEntityData(request, response); try { - assertTrue(response.getContentAsString() != null - && response.getContentAsString().contains("data")); + assertTrue(response.getContentAsString() != null && response.getContentAsString().contains("data")); } catch (UnsupportedEncodingException e) { logger.error("Exception Occured" + e); } diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyControllerTest.java index 65077ae01..af3c88257 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -19,15 +19,19 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.controller; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; + import java.util.ArrayList; import java.util.List; + import javax.script.SimpleBindings; + import org.apache.commons.io.IOUtils; import org.junit.Before; import org.junit.Test; @@ -52,8 +56,7 @@ public class PolicyControllerTest { String policyData = ""; try { ClassLoader classLoader = getClass().getClassLoader(); - policyData = IOUtils - .toString(classLoader.getResourceAsStream("Config_SampleTest1206.1.xml")); + policyData = IOUtils.toString(classLoader.getResourceAsStream("Config_SampleTest1206.1.xml")); } catch (Exception e1) { e1.printStackTrace(); } diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyExportAndImportControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyExportAndImportControllerTest.java index 1e4e62da1..84e9ccf84 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyExportAndImportControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyExportAndImportControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,19 +17,26 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.when; + +import com.mockrunner.mock.web.MockHttpServletRequest; +import com.mockrunner.mock.web.MockHttpServletResponse; + import java.io.File; import java.io.IOException; import java.util.Collections; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + import org.json.JSONObject; import org.junit.Test; import org.junit.runner.RunWith; @@ -43,8 +50,6 @@ import org.onap.portalsdk.core.web.support.UserUtils; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import com.mockrunner.mock.web.MockHttpServletRequest; -import com.mockrunner.mock.web.MockHttpServletResponse; @RunWith(PowerMockRunner.class) public class PolicyExportAndImportControllerTest { @@ -97,9 +102,8 @@ public class PolicyExportAndImportControllerTest { ClassLoader classLoader = getClass().getClassLoader(); // Test negative case - String file = - new File(classLoader.getResource("Config_BRMS_Raw_TestBRMSRawPolicy.1.xml").getFile()) - .getAbsolutePath(); + String file = new File(classLoader.getResource("Config_BRMS_Raw_TestBRMSRawPolicy.1.xml").getFile()) + .getAbsolutePath(); JSONObject json = controller.importRepositoryFile(file, request); assertNull(json); diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyNotificationControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyNotificationControllerTest.java index 476eb6728..509f4a692 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyNotificationControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyNotificationControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -19,15 +19,22 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.mockito.Matchers.any; import static org.mockito.Mockito.when; + +import com.mockrunner.mock.web.MockHttpServletRequest; +import com.mockrunner.mock.web.MockHttpServletResponse; + import java.io.IOException; import java.util.Collections; + import javax.servlet.http.HttpServletResponse; + import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; @@ -38,8 +45,6 @@ import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.springframework.web.servlet.ModelAndView; -import com.mockrunner.mock.web.MockHttpServletRequest; -import com.mockrunner.mock.web.MockHttpServletResponse; @RunWith(PowerMockRunner.class) public class PolicyNotificationControllerTest { @@ -60,16 +65,14 @@ public class PolicyNotificationControllerTest { PolicyNotificationController controller = new PolicyNotificationController(); controller.commonClassDao = dao; MockHttpServletRequest request = new MockHttpServletRequest(); - request.setBodyContent( - "{\n\"watchData\": {\"name\": \"testVal\",\"path\": \"testPath\"\n}}\n"); + request.setBodyContent("{\n\"watchData\": {\"name\": \"testVal\",\"path\": \"testPath\"\n}}\n"); MockHttpServletResponse response = new MockHttpServletResponse(); ModelAndView model = controller.watchPolicy(request, response); assertNull(model); assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK); // Negative test watch - request.setBodyContent( - "{\n\"watchData\": {\"name\": \"testVal\",\"nopath\": \"testPath\"\n}}\n"); + request.setBodyContent("{\n\"watchData\": {\"name\": \"testVal\",\"nopath\": \"testPath\"\n}}\n"); response = new MockHttpServletResponse(); model = controller.watchPolicy(request, response); assertNull(model); diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyRolesControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyRolesControllerTest.java index d665aae5e..720f6ca76 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyRolesControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyRolesControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * POLICY-SDK-APP * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -19,17 +19,21 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.controller; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; + import java.io.BufferedReader; import java.io.StringReader; import java.io.UnsupportedEncodingException; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; + import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; @@ -59,8 +63,7 @@ public class PolicyRolesControllerTest { HttpSession mockSession = mock(HttpSession.class); User user = new User(); user.setOrgUserId("Test"); - Mockito.when(mockSession.getAttribute(SystemProperties.getProperty("user_attribute_name"))) - .thenReturn(user); + Mockito.when(mockSession.getAttribute(SystemProperties.getProperty("user_attribute_name"))).thenReturn(user); Mockito.when(request.getSession(false)).thenReturn(mockSession); logger.info("setUp: exit"); @@ -70,8 +73,7 @@ public class PolicyRolesControllerTest { public void testGetPolicyRolesEntityData() { try { controller.getPolicyRolesEntityData(request, response); - assertTrue(response.getContentAsString() != null - && response.getContentAsString().contains("rolesDatas")); + assertTrue(response.getContentAsString() != null && response.getContentAsString().contains("rolesDatas")); } catch (UnsupportedEncodingException e) { logger.error("Exception Occured" + e); fail(); @@ -82,8 +84,7 @@ public class PolicyRolesControllerTest { public void testGetPolicyScopesEntityData() { try { controller.getPolicyScopesEntityData(request, response); - assertTrue(response.getContentAsString() != null - && response.getContentAsString().contains("scopeDatas")); + assertTrue(response.getContentAsString() != null && response.getContentAsString().contains("scopeDatas")); } catch (UnsupportedEncodingException e) { logger.error("Exception Occured" + e); fail(); @@ -100,8 +101,7 @@ public class PolicyRolesControllerTest { when(request.getReader()).thenReturn(br); controller.SaveRolesEntityData(request, response); logger.info("response.getContentAsString(): " + response.getContentAsString()); - assertTrue(response.getContentAsString() != null - && response.getContentAsString().contains("rolesDatas")); + assertTrue(response.getContentAsString() != null && response.getContentAsString().contains("rolesDatas")); } catch (Exception e) { fail("Exception: " + e); } diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyValidationControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyValidationControllerTest.java index 2ad6d6a7e..56b2d1030 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyValidationControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PolicyValidationControllerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -19,16 +19,21 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.controller; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; + +import com.mockrunner.mock.web.MockHttpServletRequest; +import com.mockrunner.mock.web.MockHttpServletResponse; + import java.io.IOException; + import javax.servlet.http.HttpServletResponse; + import org.junit.Test; import org.springframework.web.servlet.ModelAndView; -import com.mockrunner.mock.web.MockHttpServletRequest; -import com.mockrunner.mock.web.MockHttpServletResponse; public class PolicyValidationControllerTest { @Test diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java index e7212f109..3bc89c9d0 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -26,12 +26,15 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + import java.io.File; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Properties; + import javax.script.SimpleBindings; + import org.apache.tomcat.dbcp.dbcp2.BasicDataSource; import org.h2.tools.Server; import org.hibernate.SessionFactory; @@ -150,8 +153,7 @@ public class CommonClassDaoImplTest { userinfo.setUserName(loginId_userName); commonClassDao.save(userinfo); - List dataCur = - commonClassDao.getDataByQuery("from UserInfo", new SimpleBindings()); + List dataCur = commonClassDao.getDataByQuery("from UserInfo", new SimpleBindings()); assertEquals(1, dataCur.size()); UserInfo cur = (UserInfo) dataCur.get(0); @@ -183,8 +185,7 @@ public class CommonClassDaoImplTest { pe.setCreatedBy("Test"); commonClassDao.save(pe); - List dataCur = - commonClassDao.getDataByQuery("from PolicyEntity", new SimpleBindings()); + List dataCur = commonClassDao.getDataByQuery("from PolicyEntity", new SimpleBindings()); assertTrue(1 == dataCur.size()); assertTrue(dataCur.get(0) instanceof PolicyEntity); @@ -296,8 +297,7 @@ public class CommonClassDaoImplTest { String[] splitDBCheckName = dbCheckName.split(":"); // Current Implementation - String query = - "FROM PolicyEntity where policyName like :splitDBCheckName1 and scope = :splitDBCheckName0"; + String query = "FROM PolicyEntity where policyName like :splitDBCheckName1 and scope = :splitDBCheckName0"; SimpleBindings params = new SimpleBindings(); params.put("splitDBCheckName1", splitDBCheckName[1] + "%"); params.put("splitDBCheckName0", splitDBCheckName[0]); @@ -328,8 +328,7 @@ public class CommonClassDaoImplTest { commonClassDao.save(watch); // Current Implementation - String query = - "from WatchPolicyNotificationTable where POLICYNAME = :finalName and LOGINIDS = :userId"; + String query = "from WatchPolicyNotificationTable where POLICYNAME = :finalName and LOGINIDS = :userId"; SimpleBindings params = new SimpleBindings(); params.put("finalName", finalName); params.put("userId", userId); @@ -371,8 +370,7 @@ public class CommonClassDaoImplTest { String finalName = "banana' OR '1'='1"; // Current Implementation - String query = - "from WatchPolicyNotificationTable where POLICYNAME = :finalName and LOGINIDS = :userId"; + String query = "from WatchPolicyNotificationTable where POLICYNAME = :finalName and LOGINIDS = :userId"; SimpleBindings params = new SimpleBindings(); params.put("finalName", finalName); params.put("userId", userId); @@ -399,19 +397,18 @@ public class CommonClassDaoImplTest { userInfo.setUserLoginId("TestID"); userInfo.setUserName("Test"); commonClassDao.save(userInfo); - List data = commonClassDao.getDataById(UserInfo.class, "userLoginId:userName", - "TestID:Test"); + List data = commonClassDao.getDataById(UserInfo.class, "userLoginId:userName", "TestID:Test"); assertTrue(data.size() == 1); UserInfo userInfoUpdate = (UserInfo) data.get(0); userInfoUpdate.setUserName("Test1"); commonClassDao.update(userInfoUpdate); List data1 = commonClassDao.getDataByColumn(UserInfo.class, "userLoginId"); assertTrue(data1.size() == 1); - UserInfo data2 = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, - "userLoginId:userName", "TestID:Test1"); + UserInfo data2 = + (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId:userName", "TestID:Test1"); assertTrue("TestID".equals(data2.getUserLoginId())); - List data3 = commonClassDao.checkDuplicateEntry("TestID:Test1", - "userLoginId:userName", UserInfo.class); + List data3 = + commonClassDao.checkDuplicateEntry("TestID:Test1", "userLoginId:userName", UserInfo.class); assertTrue(data3.size() == 1); PolicyRoles roles = new PolicyRoles(); roles.setRole("admin"); diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/model/PDPGroupContainerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/model/PDPGroupContainerTest.java index 5117a05da..0cfba2cc1 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/model/PDPGroupContainerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/model/PDPGroupContainerTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 Samsung * ================================================================================ @@ -24,13 +24,15 @@ package org.onap.policy.model; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; + +import com.att.research.xacml.api.pap.PAPException; + import org.junit.Test; import org.mockito.Mockito; import org.onap.policy.rest.util.PolicyContainer.ItemSetChangeListener; import org.onap.policy.xacml.api.pap.OnapPDP; import org.onap.policy.xacml.api.pap.OnapPDPGroup; import org.onap.policy.xacml.api.pap.PAPPolicyEngine; -import com.att.research.xacml.api.pap.PAPException; public class PDPGroupContainerTest { private PAPPolicyEngine engine = Mockito.mock(PAPPolicyEngine.class); -- cgit 1.2.3-korg