[Policy-52, Policy-92, Policy-93] Policy Enhancements and bugfixes
[policy/engine.git] / ECOMP-PAP-REST / src / test / java / org / openecomp / policy / pap / ia / DbAuditCompareEntriesTest.java
index c5fa379..2fef9a7 100644 (file)
@@ -20,7 +20,8 @@
 
 package org.openecomp.policy.pap.ia;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import java.util.Date;
 import java.util.HashMap;
@@ -32,79 +33,12 @@ import javax.persistence.EntityManagerFactory;
 import javax.persistence.EntityTransaction;
 import javax.persistence.Persistence;
 
+import org.apache.commons.lang3.SerializationUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
-import org.openecomp.policy.jpa.BackUpMonitorEntity;
-import org.openecomp.policy.rest.jpa.ActionBodyEntity;
-import org.openecomp.policy.rest.jpa.ActionList;
-import org.openecomp.policy.rest.jpa.ActionPolicyDict;
-import org.openecomp.policy.rest.jpa.AddressGroup;
-import org.openecomp.policy.rest.jpa.Attribute;
-import org.openecomp.policy.rest.jpa.AttributeAssignment;
-import org.openecomp.policy.rest.jpa.BRMSParamTemplate;
-import org.openecomp.policy.rest.jpa.Category;
-import org.openecomp.policy.rest.jpa.ClosedLoopD2Services;
-import org.openecomp.policy.rest.jpa.ClosedLoopSite;
-import org.openecomp.policy.rest.jpa.ConfigurationDataEntity;
-import org.openecomp.policy.rest.jpa.ConstraintType;
-import org.openecomp.policy.rest.jpa.ConstraintValue;
-import org.openecomp.policy.rest.jpa.DCAEUsers;
-import org.openecomp.policy.rest.jpa.DCAEuuid;
-import org.openecomp.policy.rest.jpa.DatabaseLockEntity;
-import org.openecomp.policy.rest.jpa.Datatype;
-import org.openecomp.policy.rest.jpa.DecisionSettings;
-import org.openecomp.policy.rest.jpa.DescriptiveScope;
-import org.openecomp.policy.rest.jpa.EcompName;
-import org.openecomp.policy.rest.jpa.EnforcingType;
-import org.openecomp.policy.rest.jpa.FunctionArgument;
-import org.openecomp.policy.rest.jpa.FunctionDefinition;
-import org.openecomp.policy.rest.jpa.GlobalRoleSettings;
-import org.openecomp.policy.rest.jpa.GroupEntity;
-import org.openecomp.policy.rest.jpa.GroupPolicyScopeList;
-import org.openecomp.policy.rest.jpa.GroupServiceList;
-import org.openecomp.policy.rest.jpa.MicroServiceConfigName;
-import org.openecomp.policy.rest.jpa.MicroServiceLocation;
-import org.openecomp.policy.rest.jpa.MicroServiceModels;
-import org.openecomp.policy.rest.jpa.Obadvice;
-import org.openecomp.policy.rest.jpa.ObadviceExpression;
-import org.openecomp.policy.rest.jpa.PEPOptions;
-import org.openecomp.policy.rest.jpa.PIPConfigParam;
-import org.openecomp.policy.rest.jpa.PIPConfiguration;
-import org.openecomp.policy.rest.jpa.PIPResolver;
-import org.openecomp.policy.rest.jpa.PIPResolverParam;
-import org.openecomp.policy.rest.jpa.PIPType;
-import org.openecomp.policy.rest.jpa.PREFIXLIST;
-import org.openecomp.policy.rest.jpa.PdpEntity;
-import org.openecomp.policy.rest.jpa.PolicyAlgorithms;
-import org.openecomp.policy.rest.jpa.PolicyDBDaoEntity;
-import org.openecomp.policy.rest.jpa.PolicyEntity;
-import org.openecomp.policy.rest.jpa.PolicyManagement;
-import org.openecomp.policy.rest.jpa.PolicyRoles;
-import org.openecomp.policy.rest.jpa.PolicyScopeClosedLoop;
-import org.openecomp.policy.rest.jpa.PolicyScopeResource;
-import org.openecomp.policy.rest.jpa.PolicyScopeService;
-import org.openecomp.policy.rest.jpa.PolicyScopeType;
-import org.openecomp.policy.rest.jpa.PolicyScore;
-import org.openecomp.policy.rest.jpa.PolicyVersion;
-import org.openecomp.policy.rest.jpa.PortList;
-import org.openecomp.policy.rest.jpa.ProtocolList;
-import org.openecomp.policy.rest.jpa.RemoteCatalogValues;
-import org.openecomp.policy.rest.jpa.RuleAlgorithms;
-import org.openecomp.policy.rest.jpa.SecurityZone;
-import org.openecomp.policy.rest.jpa.ServiceList;
-import org.openecomp.policy.rest.jpa.SystemLogDB;
-import org.openecomp.policy.rest.jpa.TermList;
-import org.openecomp.policy.rest.jpa.UserInfo;
-import org.openecomp.policy.rest.jpa.VMType;
-import org.openecomp.policy.rest.jpa.VNFType;
-import org.openecomp.policy.rest.jpa.VSCLAction;
-import org.openecomp.policy.rest.jpa.VarbindDictionary;
-import org.openecomp.policy.rest.jpa.Zone;
-
 import org.openecomp.policy.common.ia.DbAudit;
 import org.openecomp.policy.common.ia.DbDAO;
 import org.openecomp.policy.common.ia.IntegrityAuditProperties;
@@ -112,10 +46,8 @@ import org.openecomp.policy.common.ia.jpa.IntegrityAuditEntity;
 import org.openecomp.policy.common.im.jpa.ForwardProgressEntity;
 import org.openecomp.policy.common.im.jpa.ResourceRegistrationEntity;
 import org.openecomp.policy.common.im.jpa.StateManagementEntity;
+import org.openecomp.policy.jpa.BackUpMonitorEntity;
 
-import org.apache.commons.lang3.SerializationUtils;
-
-@Ignore
 public class DbAuditCompareEntriesTest {
 
        private static Log logger = LogFactory.getLog(DbAuditCompareEntriesTest.class);
@@ -189,7 +121,6 @@ public class DbAuditCompareEntriesTest {
         * Tests that a comparison between hashsets is successful if
         * the entries match
         */
-       //@Ignore
        @Test
        public void runAllTests() throws Exception {
                logger.info("runAllTests: Entering");
@@ -218,7 +149,7 @@ public class DbAuditCompareEntriesTest {
                //There is only one entry IntegrityAuditEntity, but we will check anyway
                HashSet<String> classNameSet = dbDAO.getPersistenceClassNames();
                for(String c : classNameSet){
-                       if (c.equals("org.openecomp.policy.common.ia.IntegrityAuditEntity")){
+                       if (c.equals("org.openecomp.policy.common.ia.jpa.IntegrityAuditEntity")){
                                className = c;
                        }
                }
@@ -247,8 +178,8 @@ public class DbAuditCompareEntriesTest {
                
                dbAudit.writeAuditDebugLog(className, resourceName1, resourceName2, entry1, entry2);
                
-               HashMap<Object, Object> myEntries = new HashMap<Object, Object>();
-               HashMap<Object, Object> theirEntries = new HashMap<Object, Object>();
+               HashMap<Object, Object> myEntries = new HashMap<>();
+               HashMap<Object, Object> theirEntries = new HashMap<>();
                
                myEntries.put("pdp1", entry1);
                theirEntries.put("pdp1", entry2);
@@ -271,8 +202,8 @@ public class DbAuditCompareEntriesTest {
                 */
                entry2.setDesignated(true);
                                
-               myEntries = new HashMap<Object, Object>();
-               theirEntries = new HashMap<Object, Object>();
+               myEntries = new HashMap<>();
+               theirEntries = new HashMap<>();
                
                myEntries.put("pdp1", entry1);
                theirEntries.put("pdp1", entry2);
@@ -306,8 +237,8 @@ public class DbAuditCompareEntriesTest {
                // Clone the first entry
                entry2 = SerializationUtils.clone(entry1);
                
-               HashMap<Object, Object> myEntries = new HashMap<Object, Object>();
-               HashMap<Object, Object> theirEntries = new HashMap<Object, Object>();
+               HashMap<Object, Object> myEntries = new HashMap<>();
+               HashMap<Object, Object> theirEntries = new HashMap<>();
                
                myEntries.put("pdp1", entry1);
                theirEntries.put("pdp1", entry2);
@@ -330,8 +261,8 @@ public class DbAuditCompareEntriesTest {
                 
                entry2.setFlag("flag2");
                                
-               myEntries = new HashMap<Object, Object>();
-               theirEntries = new HashMap<Object, Object>();
+               myEntries = new HashMap<>();
+               theirEntries = new HashMap<>();
                
                myEntries.put("pdp1", entry1);
                theirEntries.put("pdp1", entry2);
@@ -366,8 +297,8 @@ public class DbAuditCompareEntriesTest {
                // Clone the first entry
                entry2 = SerializationUtils.clone(entry1);
                
-               HashMap<Object, Object> myEntries = new HashMap<Object, Object>();
-               HashMap<Object, Object> theirEntries = new HashMap<Object, Object>();
+               HashMap<Object, Object> myEntries = new HashMap<>();
+               HashMap<Object, Object> theirEntries = new HashMap<>();
                
                myEntries.put("pdp1", entry1);
                theirEntries.put("pdp1", entry2);
@@ -390,8 +321,8 @@ public class DbAuditCompareEntriesTest {
                 
                entry2.setAdminState("unlocked");
                                
-               myEntries = new HashMap<Object, Object>();
-               theirEntries = new HashMap<Object, Object>();
+               myEntries = new HashMap<>();
+               theirEntries = new HashMap<>();
                
                myEntries.put("pdp1", entry1);
                theirEntries.put("pdp1", entry2);
@@ -445,8 +376,8 @@ public class DbAuditCompareEntriesTest {
                 
                entry2.setFpcCount(321L);
                                
-               myEntries = new HashMap<Object, Object>();
-               theirEntries = new HashMap<Object, Object>();
+               myEntries = new HashMap<>();
+               theirEntries = new HashMap<>();
                
                myEntries.put("pdp1", entry1);
                theirEntries.put("pdp1", entry2);
@@ -480,8 +411,8 @@ public class DbAuditCompareEntriesTest {
                // Clone the first entry
                entry2 = SerializationUtils.clone(entry1);
                
-               HashMap<Object, Object> myEntries = new HashMap<Object, Object>();
-               HashMap<Object, Object> theirEntries = new HashMap<Object, Object>();
+               HashMap<Object, Object> myEntries = new HashMap<>();
+               HashMap<Object, Object> theirEntries = new HashMap<>();
                
                myEntries.put("pdp1", entry1);
                theirEntries.put("pdp1", entry2);
@@ -502,8 +433,8 @@ public class DbAuditCompareEntriesTest {
                 
                entry2.setSite("site_1a");
                                
-               myEntries = new HashMap<Object, Object>();
-               theirEntries = new HashMap<Object, Object>();
+               myEntries = new HashMap<>();
+               theirEntries = new HashMap<>();
                
                myEntries.put("pdp1", entry1);
                theirEntries.put("pdp1", entry2);
@@ -516,4 +447,4 @@ public class DbAuditCompareEntriesTest {
                assertEquals(1, result.size());
                logger.info("testResourceRegistrationEntity: Exit");
        }
-}
+}
\ No newline at end of file