Merge "Add Junit to policy/engine LogParser package"
[policy/engine.git] / ONAP-PAP-REST / src / test / java / org / onap / policy / pap / test / XACMLPAPTest.java
index 0463585..53616aa 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-PAP-REST
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 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.
@@ -51,6 +51,7 @@ import org.onap.policy.pap.xacml.rest.controller.ClosedLoopDictionaryController;
 import org.onap.policy.pap.xacml.rest.controller.FirewallDictionaryController;
 import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl;
 import org.onap.policy.pap.xacml.rest.policycontroller.PolicyCreation;
+import org.onap.policy.pap.xacml.rest.util.DictionaryUtils;
 import org.onap.policy.rest.dao.CommonClassDao;
 import org.onap.policy.rest.jpa.BRMSParamTemplate;
 import org.onap.policy.rest.jpa.PolicyEditorScopes;
@@ -89,6 +90,10 @@ public class XACMLPAPTest {
                 .thenReturn("src/test/resources/xacml.pap.properties");
         pap = new XACMLPapServlet();
         pap.init(servletConfig);
+        CommonClassDao commonClassDao = Mockito.mock(CommonClassDao.class);
+        new DictionaryUtils(commonClassDao);
+        DictionaryUtils.setDictionaryUtils(new DictionaryUtils());
+        Mockito.mock(DictionaryUtils.class);  
     }
     
     @Test
@@ -206,7 +211,7 @@ public class XACMLPAPTest {
         Mockito.when(httpServletRequest.getParameter("operation")).thenReturn("create");
         Mockito.when(httpServletRequest.getParameter("policyType")).thenReturn("Decision");
         StdPAPPolicy newPAPPolicy = new StdPAPPolicy("test", "test rule", "ONAP", "AAF", null, null, null, 
-                null, null, null, null, null, null, false, "test", 0);
+                null, null, null, null, null, null, null, false, "test", 0);
         MockServletInputStream mockInput = new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes());
         Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);
         
@@ -238,7 +243,7 @@ public class XACMLPAPTest {
         matchingAttributes.put("guardActiveStart","05:00");
         matchingAttributes.put("guardActiveEnd","10:00");
         StdPAPPolicy newPAPPolicy = new StdPAPPolicy("testGuard", "test rule", "PDPD", "GUARD_YAML", matchingAttributes , null, null, 
-                null, null, null, null, null, null, false, "test", 0);
+                null, null, null, null, null, null, null, false, "test", 0);
         MockServletInputStream mockInput = new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes());
         Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);
         
@@ -267,7 +272,7 @@ public class XACMLPAPTest {
         matchingAttributes.put("guardActiveEnd","10:00");
         matchingAttributes.put("blackList","bl1,bl2");
         StdPAPPolicy newPAPPolicy = new StdPAPPolicy("testblGuard", "test rule", "PDPD", "GUARD_BL_YAML", matchingAttributes , null, null, 
-                null, null, null, null, null, null, false, "test", 0);
+                null, null, null, null, null, null, null, false, "test", 0);
         MockServletInputStream mockInput = new MockServletInputStream(PolicyUtils.objectToJsonString(newPAPPolicy).getBytes());
         Mockito.when(httpServletRequest.getInputStream()).thenReturn(mockInput);
         
@@ -320,7 +325,7 @@ public class XACMLPAPTest {
         template.setUserCreatedBy(userInfo);
         String rule = "package com.sample;\n"
                 + "import com.sample.DroolsTest.Message;\n"
-                + "declare Params\n"
+                + "declare PapParams\n"
                 + "samPoll : int\n"
                 + "value : String\n"
                 + "end\n"