Unit/SONAR/Checkstyle in ONAP-REST
[policy/engine.git] / ONAP-PAP-REST / src / test / java / org / onap / policy / pap / test / XACMLPAPTest.java
index 1b65fed..f9faa29 100644 (file)
@@ -24,7 +24,9 @@ package org.onap.policy.pap.test;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.mockito.Mockito.when;
+
 import com.mockrunner.mock.web.MockServletInputStream;
+
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
@@ -36,11 +38,13 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
+
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.tomcat.dbcp.dbcp2.BasicDataSource;
@@ -67,7 +71,7 @@ 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.ActionPolicyDict;
-import org.onap.policy.rest.jpa.BRMSParamTemplate;
+import org.onap.policy.rest.jpa.BrmsParamTemplate;
 import org.onap.policy.rest.jpa.Category;
 import org.onap.policy.rest.jpa.FunctionDefinition;
 import org.onap.policy.rest.jpa.PolicyEditorScopes;
@@ -79,7 +83,6 @@ import org.springframework.mock.web.MockHttpServletResponse;
 import org.springframework.mock.web.MockServletConfig;
 import org.springframework.orm.hibernate4.LocalSessionFactoryBuilder;
 
-
 public class XACMLPAPTest {
     private static final Log logger = LogFactory.getLog(XACMLPAPTest.class);
 
@@ -332,7 +335,6 @@ public class XACMLPAPTest {
         Mockito.verify(httpServletResponse).addHeader("operation", "create");
     }
 
-
     @Test
     public void testDecisonBLGuardPolicy() throws IOException, ServletException, SQLException {
         httpServletRequest = Mockito.mock(HttpServletRequest.class);
@@ -445,7 +447,6 @@ public class XACMLPAPTest {
         Mockito.verify(httpServletResponse).addHeader("operation", "create");
     }
 
-
     private void setPolicyCreation() {
         CommonClassDao commonClassDao = Mockito.mock(CommonClassDao.class);
         PolicyCreation.setCommonClassDao(commonClassDao);
@@ -458,7 +459,7 @@ public class XACMLPAPTest {
         editorScope.setUserModifiedBy(userInfo);
         Mockito.when(commonClassDao.getEntityItem(PolicyEditorScopes.class, "scopeName", "test"))
                 .thenReturn(editorScope);
-        BRMSParamTemplate template = new BRMSParamTemplate();
+        BrmsParamTemplate template = new BrmsParamTemplate();
         template.setRuleName("testPolicy");
         template.setUserCreatedBy(userInfo);
         String rule = "package com.sample;\n" + "import com.sample.DroolsTest.Message;\n" + "declare Params\n"
@@ -470,7 +471,7 @@ public class XACMLPAPTest {
                 + "Params($param.samPoll > 50)\n" + "then\n" + "System.out.println(\"Firing rule 1\");\n"
                 + "System.out.println($param);\n" + "end\n";
         template.setRule(rule);
-        Mockito.when(commonClassDao.getEntityItem(BRMSParamTemplate.class, "ruleName", "testPolicy"))
+        Mockito.when(commonClassDao.getEntityItem(BrmsParamTemplate.class, "ruleName", "testPolicy"))
                 .thenReturn(template);
     }
 
@@ -487,7 +488,7 @@ public class XACMLPAPTest {
         // Verify
         Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
         //
-        // Check VNFType
+        // Check VnfType
         //
         httpServletRequest = Mockito.mock(HttpServletRequest.class);
         httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
@@ -498,14 +499,14 @@ public class XACMLPAPTest {
         // Verify
         Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
         //
-        // Check PEPOptions
+        // Check PepOptions
         //
         httpServletRequest = Mockito.mock(HttpServletRequest.class);
         httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
         json = "{\"dictionaryFields\":{\"pepName\":\"testRestAPI\",\"description\":\"testing create\","
                 + "\"attributes\":[{\"option\":\"test1\",\"number\":\"test\"},{\"option\":\"test2\","
                 + "\"number\":\"test\"}]}}";
-        dictionaryTestSetup(false, "PEPOptions", json);
+        dictionaryTestSetup(false, "PepOptions", json);
         // send Request to PAP
         pap.service(httpServletRequest, httpServletResponse);
         // Verify
@@ -694,7 +695,6 @@ public class XACMLPAPTest {
         // Verify
         Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
 
-
         httpServletRequest = Mockito.mock(HttpServletRequest.class);
         httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
         json = "{\"dictionaryFields\":{\"attributeName\":\"TestMMrestAPI1\",\"type\":\"REST\",\"url\":\"testsomeurl"
@@ -886,7 +886,7 @@ public class XACMLPAPTest {
     @Test
     public void getDictionary() throws ServletException, IOException {
         String[] dictionarys = new String[] {"Attribute", "OnapName", "Action", "BRMSParamTemplate", "VSCLAction",
-                "VNFType", "PEPOptions", "Varbind", "Service", "Site", "Settings", "RainyDayTreatments",
+                "VNFType", "PepOptions", "Varbind", "Service", "Site", "Settings", "RainyDayTreatments",
                 "DescriptiveScope", "ActionList", "ProtocolList", "Zone", "SecurityZone", "PrefixList", "AddressGroup",
                 "ServiceGroup", "ServiceList", "TermList", "MicroServiceLocation", "MicroServiceConfigName", "DCAEUUID",
                 "MicroServiceModels", "PolicyScopeService", "PolicyScopeResource", "PolicyScopeType",