diff options
Diffstat (limited to 'ONAP-PAP-REST/src/test/java/org')
6 files changed, 51 insertions, 51 deletions
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/UpdateOthersPAPSTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/UpdateOthersPAPSTest.java index 99902012b..ffac655a6 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/UpdateOthersPAPSTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/UpdateOthersPAPSTest.java @@ -43,7 +43,7 @@ import org.onap.policy.pap.xacml.rest.UpdateOthersPAPS; import org.onap.policy.pap.xacml.rest.adapters.UpdateObjectData; import org.onap.policy.pap.xacml.rest.components.Policy; import org.onap.policy.rest.dao.CommonClassDao; -import org.onap.policy.rest.jpa.PolicyDBDaoEntity; +import org.onap.policy.rest.jpa.PolicyDbDaoEntity; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @@ -65,20 +65,20 @@ public class UpdateOthersPAPSTest { request = mock(HttpServletRequest.class); response = new MockHttpServletResponse(); List<Object> data = new ArrayList<>(); - PolicyDBDaoEntity entity = new PolicyDBDaoEntity(); - entity.setPolicyDBDaoUrl("http://localhost:8070/pap"); + PolicyDbDaoEntity entity = new PolicyDbDaoEntity(); + entity.setPolicyDbDaoUrl("http://localhost:8070/pap"); entity.setUsername("test"); entity.setPassword("test"); - PolicyDBDaoEntity entity1 = new PolicyDBDaoEntity(); - entity1.setPolicyDBDaoUrl("http://localhost:8071/pap"); + PolicyDbDaoEntity entity1 = new PolicyDbDaoEntity(); + entity1.setPolicyDbDaoUrl("http://localhost:8071/pap"); entity1.setUsername("test"); entity1.setPassword("test"); data.add(entity); data.add(entity1); System.setProperty("xacml.rest.pap.url", "http://localhost:8070/pap"); - when(commonClassDao.getData(PolicyDBDaoEntity.class)).thenReturn(data); + when(commonClassDao.getData(PolicyDbDaoEntity.class)).thenReturn(data); } @Test diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java index 10fcd300d..f978d7464 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java @@ -499,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 @@ -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", diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/NotifyOtherPapsTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/NotifyOtherPapsTest.java index 50c166aed..7156ec788 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/NotifyOtherPapsTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/NotifyOtherPapsTest.java @@ -28,7 +28,7 @@ import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.rest.jpa.PolicyDBDaoEntity; +import org.onap.policy.rest.jpa.PolicyDbDaoEntity; public class NotifyOtherPapsTest { private static final String systemKey = XACMLProperties.XACML_PROPERTIES_NAME; @@ -43,9 +43,9 @@ public class NotifyOtherPapsTest { @Test public void negTestNotify() { NotifyOtherPaps notify = new NotifyOtherPaps(); - List<PolicyDBDaoEntity> otherServers = new ArrayList<PolicyDBDaoEntity>(); - PolicyDBDaoEntity dbdaoEntity = new PolicyDBDaoEntity(); - dbdaoEntity.setPolicyDBDaoUrl("http://test"); + List<PolicyDbDaoEntity> otherServers = new ArrayList<PolicyDbDaoEntity>(); + PolicyDbDaoEntity dbdaoEntity = new PolicyDbDaoEntity(); + dbdaoEntity.setPolicyDbDaoUrl("http://test"); otherServers.add(dbdaoEntity); long entityId = 0; String entityType = "entityType"; diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryControllerTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryControllerTest.java index 3472b0df5..fab361118 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryControllerTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryControllerTest.java @@ -42,7 +42,7 @@ import org.onap.policy.pap.xacml.rest.util.DictionaryUtils; import org.onap.policy.rest.dao.CommonClassDao; import org.onap.policy.rest.jpa.ClosedLoopD2Services; import org.onap.policy.rest.jpa.ClosedLoopSite; -import org.onap.policy.rest.jpa.PEPOptions; +import org.onap.policy.rest.jpa.PepOptions; import org.onap.policy.rest.jpa.UserInfo; import org.onap.policy.rest.jpa.VNFType; import org.onap.policy.rest.jpa.VSCLAction; @@ -140,7 +140,7 @@ public class ClosedLoopDictionaryControllerTest { @Test public void testGetPEPOptionsDictionaryByNameEntityData() { - when(commonClassDao.getDataByColumn(PEPOptions.class, "pepName")).thenReturn(data); + when(commonClassDao.getDataByColumn(PepOptions.class, "pepName")).thenReturn(data); controller.getPEPOptionsDictionaryByNameEntityData(response); try { assertTrue(response.getContentAsString() != null @@ -153,7 +153,7 @@ public class ClosedLoopDictionaryControllerTest { @Test public void testGetPEPOptionsDictionaryEntityData() { - when(commonClassDao.getData(PEPOptions.class)).thenReturn(new ArrayList<>()); + when(commonClassDao.getData(PepOptions.class)).thenReturn(new ArrayList<>()); controller.getPEPOptionsDictionaryEntityData(response); try { assertTrue(response.getContentAsString() != null diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportControllerTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportControllerTest.java index ef723a3fd..ee4dff803 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportControllerTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportControllerTest.java @@ -96,7 +96,7 @@ public class DictionaryImportControllerTest extends Mockito { fileNames.add("SearchCriteria.csv"); fileNames.add("VNFType.csv"); fileNames.add("VSCLAction.csv"); - fileNames.add("PEPOptions.csv"); + fileNames.add("PepOptions.csv"); fileNames.add("Settings.csv"); fileNames.add("Zone.csv"); fileNames.add("ActionList.csv"); diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/jpa/PolicyEntityTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/jpa/PolicyEntityTest.java index 9da3f8b5c..d7fbda259 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/jpa/PolicyEntityTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/jpa/PolicyEntityTest.java @@ -38,7 +38,7 @@ import org.onap.policy.common.logging.flexlogger.Logger; import org.onap.policy.rest.XacmlRestProperties; import org.onap.policy.rest.jpa.ActionBodyEntity; import org.onap.policy.rest.jpa.ConfigurationDataEntity; -import org.onap.policy.rest.jpa.PolicyDBDaoEntity; +import org.onap.policy.rest.jpa.PolicyDbDaoEntity; import org.onap.policy.rest.jpa.PolicyEntity; public class PolicyEntityTest { @@ -59,7 +59,7 @@ public class PolicyEntityTest { et.begin(); // Make sure the DB is clean - em.createQuery("DELETE FROM PolicyDBDaoEntity").executeUpdate(); + em.createQuery("DELETE FROM PolicyDbDaoEntity").executeUpdate(); em.createQuery("DELETE FROM PolicyEntity").executeUpdate(); em.createQuery("DELETE FROM ConfigurationDataEntity").executeUpdate(); em.createQuery("DELETE FROM ActionBodyEntity").executeUpdate(); @@ -605,7 +605,7 @@ public class PolicyEntityTest { + "\n with exception: " + e); } - // ****************Test the PolicyDBDaoEntity************************ + // ****************Test the PolicyDbDaoEntity************************ // Create a transaction EntityTransaction et3 = em.getTransaction(); @@ -613,29 +613,29 @@ public class PolicyEntityTest { et3.begin(); // create one - PolicyDBDaoEntity pe1 = new PolicyDBDaoEntity(); + PolicyDbDaoEntity pe1 = new PolicyDbDaoEntity(); em.persist(pe1); pe1.setDescription("This is pe1"); - pe1.setPolicyDBDaoUrl("http://123.45.2.456:2345"); + pe1.setPolicyDbDaoUrl("http://123.45.2.456:2345"); // push it to the DB em.flush(); // create another - PolicyDBDaoEntity pe2 = new PolicyDBDaoEntity(); + PolicyDbDaoEntity pe2 = new PolicyDbDaoEntity(); em.persist(pe2); pe2.setDescription("This is pe2"); - pe2.setPolicyDBDaoUrl("http://789.01.2.345:2345"); + pe2.setPolicyDbDaoUrl("http://789.01.2.345:2345"); // Print them to the log before flushing - logger.debug("\n\n***********PolicyEntityTest: PolicyDBDaoEntity objects before flush********" - + "\n policyDBDaoUrl-1 = " + pe1.getPolicyDBDaoUrl() + "\n description-1 = " + pe1.getDescription() + logger.debug("\n\n***********PolicyEntityTest: PolicyDbDaoEntity objects before flush********" + + "\n policyDbDaoUrl-1 = " + pe1.getPolicyDbDaoUrl() + "\n description-1 = " + pe1.getDescription() + "\n createdDate-1 = " + pe1.getCreatedDate() + "\n modifiedDate-1 " + pe1.getModifiedDate() - + "\n*****************************************" + "\n policyDBDaoUrl-2 = " + pe2.getPolicyDBDaoUrl() + + "\n*****************************************" + "\n policyDbDaoUrl-2 = " + pe2.getPolicyDbDaoUrl() + "\n description-2 = " + pe2.getDescription() + "\n createdDate-2 = " + pe2.getCreatedDate() + "\n modifiedDate-2 " + pe2.getModifiedDate()); @@ -644,36 +644,36 @@ public class PolicyEntityTest { // Now let's retrieve them from the DB using the named query - resultList = em.createNamedQuery("PolicyDBDaoEntity.findAll").getResultList(); + resultList = em.createNamedQuery("PolicyDbDaoEntity.findAll").getResultList(); - PolicyDBDaoEntity pex = null; - PolicyDBDaoEntity pey = null; + PolicyDbDaoEntity pex = null; + PolicyDbDaoEntity pey = null; if (!resultList.isEmpty()) { if (resultList.size() != 2) { - fail("\nPolicyEntityTest: Number of PolicyDBDaoEntity entries = " + resultList.size() + fail("\nPolicyEntityTest: Number of PolicyDbDaoEntity entries = " + resultList.size() + " instead of 2"); } for (Object policyDBDaoEntity : resultList) { - PolicyDBDaoEntity pdbdao = (PolicyDBDaoEntity) policyDBDaoEntity; - if (pdbdao.getPolicyDBDaoUrl().equals("http://123.45.2.456:2345")) { + PolicyDbDaoEntity pdbdao = (PolicyDbDaoEntity) policyDBDaoEntity; + if (pdbdao.getPolicyDbDaoUrl().equals("http://123.45.2.456:2345")) { pex = pdbdao; - } else if (pdbdao.getPolicyDBDaoUrl().equals("http://789.01.2.345:2345")) { + } else if (pdbdao.getPolicyDbDaoUrl().equals("http://789.01.2.345:2345")) { pey = pdbdao; } } // Print them to the log before flushing - logger.debug("\n\n***********PolicyEntityTest: PolicyDBDaoEntity objects retrieved from DB********" - + "\n policyDBDaoUrl-x = " + pex.getPolicyDBDaoUrl() + "\n description-x = " + logger.debug("\n\n***********PolicyEntityTest: PolicyDbDaoEntity objects retrieved from DB********" + + "\n policyDbDaoUrl-x = " + pex.getPolicyDbDaoUrl() + "\n description-x = " + pex.getDescription() + "\n createdDate-x = " + pex.getCreatedDate() + "\n modifiedDate-x " + pex.getModifiedDate() + "\n*****************************************" - + "\n policyDBDaoUrl-y = " - + pey.getPolicyDBDaoUrl() + "\n description-y = " + pey.getDescription() + + "\n policyDbDaoUrl-y = " + + pey.getPolicyDbDaoUrl() + "\n description-y = " + pey.getDescription() + "\n createdDate-y = " + pey.getCreatedDate() + "\n modifiedDate-y " + pey.getModifiedDate()); // Verify the retrieved objects are the same as the ones we stored in the DB - if (pex.getPolicyDBDaoUrl().equals("http://123.45.2.456:2345")) { + if (pex.getPolicyDbDaoUrl().equals("http://123.45.2.456:2345")) { assertSame(pe1, pex); assertSame(pe2, pey); } else { @@ -682,46 +682,46 @@ public class PolicyEntityTest { } } else { - fail("\nPolicyEntityTest: No PolicyDBDaoEntity DB entry found"); + fail("\nPolicyEntityTest: No PolicyDbDaoEntity DB entry found"); } - // Now let's see if we can do an update on the PolicyDBDaoEntity which we retrieved. + // Now let's see if we can do an update on the PolicyDbDaoEntity which we retrieved. // em.persist(pex); pex.setDescription("This is pex"); em.flush(); // retrieve it - Query createPolicyQuery = em.createQuery("SELECT p FROM PolicyDBDaoEntity p WHERE p.description=:desc"); + Query createPolicyQuery = em.createQuery("SELECT p FROM PolicyDbDaoEntity p WHERE p.description=:desc"); resultList = createPolicyQuery.setParameter("desc", "This is pex").getResultList(); - PolicyDBDaoEntity pez = null; + PolicyDbDaoEntity pez = null; if (!resultList.isEmpty()) { if (resultList.size() != 1) { - fail("\nPolicyEntityTest: Update Test - Number of PolicyDBDaoEntity entries = " + resultList.size() + fail("\nPolicyEntityTest: Update Test - Number of PolicyDbDaoEntity entries = " + resultList.size() + " instead of 1"); } - pez = (PolicyDBDaoEntity) resultList.get(0); + pez = (PolicyDbDaoEntity) resultList.get(0); // Print them to the log before flushing logger.debug( - "\n\n***********PolicyEntityTest: Update Test - PolicyDBDaoEntity objects retrieved from " + "\n\n***********PolicyEntityTest: Update Test - PolicyDbDaoEntity objects retrieved from " + "DB********" - + "\n policyDBDaoUrl-x = " + pex.getPolicyDBDaoUrl() + "\n description-x = " + + "\n policyDbDaoUrl-x = " + pex.getPolicyDbDaoUrl() + "\n description-x = " + pex.getDescription() + "\n createdDate-x = " + pex.getCreatedDate() + "\n modifiedDate-x " + pex.getModifiedDate() - + "\n*****************************************" + "\n policyDBDaoUrl-z = " - + pez.getPolicyDBDaoUrl() + "\n description-z = " + pez.getDescription() + + "\n*****************************************" + "\n policyDbDaoUrl-z = " + + pez.getPolicyDbDaoUrl() + "\n description-z = " + pez.getDescription() + "\n createdDate-z = " + pez.getCreatedDate() + "\n modifiedDate-z " + pez.getModifiedDate()); // Verify the retrieved objects are the same as the ones we stored in the DB assertSame(pex, pez); } else { - fail("\nPolicyEntityTest: Update Test - No PolicyDBDaoEntity DB updated entry found"); + fail("\nPolicyEntityTest: Update Test - No PolicyDbDaoEntity DB updated entry found"); } // Clean up the DB - em.createQuery("DELETE FROM PolicyDBDaoEntity").executeUpdate(); + em.createQuery("DELETE FROM PolicyDbDaoEntity").executeUpdate(); em.createQuery("DELETE FROM PolicyEntity").executeUpdate(); em.createQuery("DELETE FROM ConfigurationDataEntity").executeUpdate(); em.createQuery("DELETE FROM ActionBodyEntity").executeUpdate(); |