X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fia%2FDbAuditCompareEntriesTest.java;h=b6b674dc73e588bb959681e067eda460580ce50f;hp=9fded580cec2b00d642eb334d299c63e625bd148;hb=1e61676b77dd09659027b8984f050df7e8538526;hpb=f18fbfc026de9cf02126f57844c37abfee607394 diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/ia/DbAuditCompareEntriesTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/ia/DbAuditCompareEntriesTest.java index 9fded580c..b6b674dc7 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/ia/DbAuditCompareEntriesTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/ia/DbAuditCompareEntriesTest.java @@ -86,7 +86,7 @@ public class DbAuditCompareEntriesTest { persistenceUnit = "testPapPU"; resourceName = "siteA.pap1"; - //Clean the iaTest DB table for IntegrityAuditEntity entries + // Clean the iaTest DB table for IntegrityAuditEntity entries cleanDb(persistenceUnit, properties); logger.info("setUp: Exiting"); @@ -95,11 +95,11 @@ public class DbAuditCompareEntriesTest { @After public void tearDown() throws Exception { logger.info("tearDown: Entering"); - //nothing to do + // nothing to do logger.info("tearDown: Exiting"); } - public void cleanDb(String persistenceUnit, Properties properties){ + public void cleanDb(String persistenceUnit, Properties properties) { logger.debug("cleanDb: enter"); EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnit, properties); @@ -119,7 +119,6 @@ public class DbAuditCompareEntriesTest { logger.debug("cleanDb: exit"); } - /* * Tests that a comparison between hashsets is successful if * the entries match @@ -128,20 +127,18 @@ public class DbAuditCompareEntriesTest { public void runAllTests() throws Exception { logger.info("runAllTests: Entering"); - testIntegrityAuditEntity(); testBackupMonitorEntity(); testStateManagementEntity(); testForwardProgressEntity(); testResourceRegistrationEntity(); - //clean up the IntegrityAuditEntity table + // clean up the IntegrityAuditEntity table cleanDb(persistenceUnit, properties); logger.info("runAllTests: Exit"); } - public void testIntegrityAuditEntity() throws Exception { logger.info("testIntegrityAuditEntity: Entering"); @@ -149,10 +146,10 @@ public class DbAuditCompareEntriesTest { DbAudit dbAudit = new DbAudit(dbDAO); String className = null; - //There is only one entry IntegrityAuditEntity, but we will check anyway + // There is only one entry IntegrityAuditEntity, but we will check anyway Set classNameSet = dbDAO.getPersistenceClassNames(); - for(String c : classNameSet){ - if (c.equals("org.onap.policy.common.ia.jpa.IntegrityAuditEntity")){ + for (String c : classNameSet) { + if (c.equals("org.onap.policy.common.ia.jpa.IntegrityAuditEntity")) { className = c; } } @@ -231,7 +228,6 @@ public class DbAuditCompareEntriesTest { // Two entries with the same field values - entry1.setFlag("flag1"); entry1.setResourceNodeName("node1"); entry1.setResourceName("resourceName"); @@ -248,17 +244,14 @@ public class DbAuditCompareEntriesTest { Set result = dbAudit.compareEntries(myEntries, theirEntries); - // Assert that there are no mismatches returned assertTrue(result.isEmpty()); - - /* ************************************ + /* + * ************************************ * Now test with a mis-matched entry - * ************************************/ - - + ************************************/ // Change a field on entry2 @@ -272,8 +265,7 @@ public class DbAuditCompareEntriesTest { result = dbAudit.compareEntries(myEntries, theirEntries); - - //Assert that there was one mismatch + // Assert that there was one mismatch assertEquals(1, result.size()); logger.info("testBackupMonitorEntity: Exit"); @@ -308,17 +300,14 @@ public class DbAuditCompareEntriesTest { Set result = dbAudit.compareEntries(myEntries, theirEntries); - // Assert that there are no mismatches returned assertTrue(result.isEmpty()); - - /* ************************************ + /* + * ************************************ * Now test with a mis-matched entry - * ************************************/ - - + ************************************/ // Change a field on entry2 @@ -332,8 +321,7 @@ public class DbAuditCompareEntriesTest { result = dbAudit.compareEntries(myEntries, theirEntries); - - //Assert that there was one mismatch + // Assert that there was one mismatch assertEquals(1, result.size()); logger.info("testStateManagementEntity: Exit"); @@ -365,15 +353,14 @@ public class DbAuditCompareEntriesTest { Set result = dbAudit.compareEntries(myEntries, theirEntries); - // Assert that there are no mismatches returned assertTrue(result.isEmpty()); - - /* ************************************ + /* + * ************************************ * Now test with a mis-matched entry - * ************************************/ + ************************************/ // Change a field on entry2 @@ -387,8 +374,7 @@ public class DbAuditCompareEntriesTest { result = dbAudit.compareEntries(myEntries, theirEntries); - - //Assert that there was one mismatch + // Assert that there was one mismatch assertEquals(1, result.size()); logger.info("testForwardProgressEntity: Exit"); @@ -422,15 +408,14 @@ public class DbAuditCompareEntriesTest { Set result = dbAudit.compareEntries(myEntries, theirEntries); - // Assert that there are no mismatches returned assertTrue(result.isEmpty()); - - /* ************************************ + /* + * ************************************ * Now test with a mis-matched entry - * ************************************/ + ************************************/ // Change a field on entry2 @@ -444,10 +429,9 @@ public class DbAuditCompareEntriesTest { result = dbAudit.compareEntries(myEntries, theirEntries); - - //Assert that there was one mismatch + // Assert that there was one mismatch assertEquals(1, result.size()); logger.info("testResourceRegistrationEntity: Exit"); } -} \ No newline at end of file +}