diff options
Diffstat (limited to 'integrity-audit/src/test/java/org/onap')
-rw-r--r-- | integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditCompareEntriesTest.java | 24 | ||||
-rw-r--r-- | integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditTest.java | 28 | ||||
-rw-r--r-- | integrity-audit/src/test/java/org/onap/policy/common/ia/DbDaoTest.java (renamed from integrity-audit/src/test/java/org/onap/policy/common/ia/DbDAOTest.java) | 76 | ||||
-rw-r--r-- | integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditDesignationTest.java | 12 |
4 files changed, 70 insertions, 70 deletions
diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditCompareEntriesTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditCompareEntriesTest.java index 6335482a..a5d0ef1b 100644 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditCompareEntriesTest.java +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditCompareEntriesTest.java @@ -1,8 +1,8 @@ -/*- +/* * ============LICENSE_START======================================================= * Integrity Audit * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 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. @@ -52,7 +52,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { private static Logger logger = FlexLogger.getLogger(DbAuditCompareEntriesTest.class); - private DbDAO dbDao; + private DbDao dbDao; private static String resourceName = "pdp1"; @BeforeClass @@ -105,7 +105,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { public void testSuccessfulComparison() throws Exception { logger.info("testSuccessfulComparison: Entering"); - dbDao = new DbDAO(resourceName, A_SEQ_PU, makeProperties()); + dbDao = new DbDao(resourceName, A_SEQ_PU, makeProperties()); final DbAudit dbAudit = new DbAudit(dbDao); String className = null; @@ -175,7 +175,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { public void testComparisonError() throws Exception { logger.info("testComparisonError: Entering"); - dbDao = new DbDAO(resourceName, A_SEQ_PU, makeProperties()); + dbDao = new DbDao(resourceName, A_SEQ_PU, makeProperties()); final DbAudit dbAudit = new DbAudit(dbDao); final String resourceName1 = resourceName; @@ -235,7 +235,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { public void testCompareMissingEntries() throws Exception { logger.info("testCompareMissingEntries: Entering"); - dbDao = new DbDAO(resourceName, A_SEQ_PU, makeProperties()); + dbDao = new DbDao(resourceName, A_SEQ_PU, makeProperties()); final DbAudit dbAudit = new DbAudit(dbDao); final String resourceName1 = resourceName; @@ -321,7 +321,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { public void testCompareAllHashEntities() throws Exception { logger.info("testCompareAllHashEntities: Entering"); - dbDao = new DbDAO(resourceName, A_SEQ_PU, makeProperties()); + dbDao = new DbDao(resourceName, A_SEQ_PU, makeProperties()); DbAudit dbAudit = new DbAudit(dbDao); Set<String> classNameSet = dbDao.getPersistenceClassNames(); @@ -442,13 +442,13 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { truncateTables(properties2); // Add entries into DB1 - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); - new DbDAO("pdp2", A_SEQ_PU, properties).destroy(); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); + new DbDao("pdp2", A_SEQ_PU, properties).destroy(); DbAudit dbAudit = new DbAudit(dbDao); // Add entries into DB2 - DbDAO dbDao3 = new DbDAO(resourceName, A_SEQ_PU, properties2); - new DbDAO("pdp2", A_SEQ_PU, properties2).destroy(); + DbDao dbDao3 = new DbDao(resourceName, A_SEQ_PU, properties2); + new DbDao("pdp2", A_SEQ_PU, properties2).destroy(); // Pull all entries and compare Set<String> classNameSet = dbDao.getPersistenceClassNames(); @@ -491,7 +491,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { public void testEmbeddedClass() throws Exception { logger.info("testEmbeddedClasses: Entering"); - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); final DbAudit dbAudit = new DbAudit(dbDao); String className = null; diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditTest.java index 8e848787..836aa288 100644 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditTest.java +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Integrity Audit * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 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. @@ -57,7 +57,7 @@ public class DbAuditTest extends IntegrityAuditTestBase { private EntityManagerFactory emf2; private EntityManager em2; - private DbDAO dbDao; + private DbDao dbDao; @BeforeClass public static void setUpBeforeClass() throws Exception { @@ -135,7 +135,7 @@ public class DbAuditTest extends IntegrityAuditTestBase { logger.info("noEntitiesTest: Entering"); - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); dbDao.deleteAllIntegrityAuditEntities(); try { DbAudit dbAudit = new DbAudit(dbDao); @@ -161,7 +161,7 @@ public class DbAuditTest extends IntegrityAuditTestBase { final ExtractAppender log = watch(debugLogger, "DbAudit: Found only (one) IntegrityAuditEntity entry:"); // Add one entry in the database - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); DbAudit dbAudit = new DbAudit(dbDao); dbAudit.dbAudit(resourceName, A_SEQ_PU, nodeType); @@ -206,24 +206,24 @@ public class DbAuditTest extends IntegrityAuditTestBase { /* * Create entries in DB1 & DB2 for the resource of interest */ - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); - new DbDAO(resourceName, A_SEQ_PU, properties2).destroy(); + new DbDao(resourceName, A_SEQ_PU, properties2).destroy(); /* * Entries in DB1, pointing to DB2, except for pdp3 */ - new DbDAO("pdp2", A_SEQ_PU, properties, dbUrl2).destroy(); - new DbDAO("pdp1", A_SEQ_PU, properties, dbUrl2).destroy(); - new DbDAO("pdp3", A_SEQ_PU, properties).destroy(); // mismatched URL - new DbDAO("pdp4", A_SEQ_PU, properties, dbUrl2).destroy(); + new DbDao("pdp2", A_SEQ_PU, properties, dbUrl2).destroy(); + new DbDao("pdp1", A_SEQ_PU, properties, dbUrl2).destroy(); + new DbDao("pdp3", A_SEQ_PU, properties).destroy(); // mismatched URL + new DbDao("pdp4", A_SEQ_PU, properties, dbUrl2).destroy(); /* * Identical entries in DB2, all pointing to DB2, including pdp3, but leaving out pdp4 */ - new DbDAO("pdp2", A_SEQ_PU, properties2).destroy(); - new DbDAO("pdp1", A_SEQ_PU, properties2).destroy(); - new DbDAO("pdp3", A_SEQ_PU, properties2).destroy(); + new DbDao("pdp2", A_SEQ_PU, properties2).destroy(); + new DbDao("pdp1", A_SEQ_PU, properties2).destroy(); + new DbDao("pdp3", A_SEQ_PU, properties2).destroy(); /* * Run the DB Audit, once it finds a mismatch and sleeps, update DB1 to have the same entry @@ -233,7 +233,7 @@ public class DbAuditTest extends IntegrityAuditTestBase { dbAudit.dbAudit(resourceName, A_SEQ_PU, nodeType); // update pdp3 entry in DB1 to point to DB2 - new DbDAO("pdp3", A_SEQ_PU, properties, dbUrl2).destroy(); + new DbDao("pdp3", A_SEQ_PU, properties, dbUrl2).destroy(); /* * Run the audit again and correct the mismatch, the result should be one entry in the diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbDAOTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbDaoTest.java index 6e93529c..357e638c 100644 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbDAOTest.java +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbDaoTest.java @@ -1,8 +1,8 @@ -/*- +/* * ============LICENSE_START======================================================= * Integrity Audit * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 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. @@ -59,14 +59,14 @@ import org.onap.policy.common.utils.time.TestTime; * where they have write privileges and can execute time-sensitive * tasks. */ -public class DbDAOTest extends IntegrityAuditTestBase { +public class DbDaoTest extends IntegrityAuditTestBase { private static String resourceName = "pdp0"; - private DbDAO dbDao; + private DbDao dbDao; @BeforeClass public static void setUpBeforeClass() throws Exception { - IntegrityAuditTestBase.setUpBeforeClass(DEFAULT_DB_URL_PREFIX + DbDAOTest.class.getSimpleName()); + IntegrityAuditTestBase.setUpBeforeClass(DEFAULT_DB_URL_PREFIX + DbDaoTest.class.getSimpleName()); } @AfterClass @@ -100,13 +100,13 @@ public class DbDAOTest extends IntegrityAuditTestBase { Properties properties = makeProperties(); try (EntityTransCloser et = new EntityTransCloser(em.getTransaction())) { - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); // Find the proper entry in the database Query iaequery = em.createQuery( "Select i from IntegrityAuditEntity i where i.resourceName=:rn and i.persistenceUnit=:pu"); - iaequery.setParameter("rn", DbDAOTest.resourceName); - iaequery.setParameter("pu", DbDAOTest.A_SEQ_PU); + iaequery.setParameter("rn", DbDaoTest.resourceName); + iaequery.setParameter("pu", DbDaoTest.A_SEQ_PU); @SuppressWarnings("rawtypes") List iaeList = iaequery.getResultList(); @@ -127,19 +127,19 @@ public class DbDAOTest extends IntegrityAuditTestBase { public void testUpdateRegistration() throws Exception { Properties properties = makeProperties(); - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); // Change site_name in properties to test that an update was made to // an existing entry in the table properties.put(IntegrityAuditProperties.SITE_NAME, "SiteB"); - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); try (EntityTransCloser et = new EntityTransCloser(em.getTransaction())) { // Find the proper entry in the database Query iaequery = em.createQuery( "Select i from IntegrityAuditEntity i where i.resourceName=:rn and i.persistenceUnit=:pu"); - iaequery.setParameter("rn", DbDAOTest.resourceName); - iaequery.setParameter("pu", DbDAOTest.A_SEQ_PU); + iaequery.setParameter("rn", DbDaoTest.resourceName); + iaequery.setParameter("pu", DbDaoTest.A_SEQ_PU); @SuppressWarnings("rawtypes") List iaeList = iaequery.getResultList(); @@ -169,10 +169,10 @@ public class DbDAOTest extends IntegrityAuditTestBase { Properties properties = makeProperties(); // Add some entries to the DB - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); - new DbDAO("pdp1", A_SEQ_PU, properties).destroy(); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); + new DbDao("pdp1", A_SEQ_PU, properties).destroy(); properties.put(IntegrityAuditProperties.NODE_TYPE, "pdp_drools"); - new DbDAO("pdp2", A_SEQ_PU, properties).destroy(); + new DbDao("pdp2", A_SEQ_PU, properties).destroy(); List<IntegrityAuditEntity> entities; // Obtain entries based on persistenceUnit and nodeType @@ -180,12 +180,12 @@ public class DbDAOTest extends IntegrityAuditTestBase { assertEquals(2, entities.size()); } - /* Tests retrieving a DbDAO instance's IntegrityAuditEntity */ + /* Tests retrieving a DbDao instance's IntegrityAuditEntity */ @Test public void testGetMyIntegrityAuditEntity() throws Exception { Properties properties = makeProperties(); - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); IntegrityAuditEntity iae = dbDao.getMyIntegrityAuditEntity(); // assertEquals("integrityAuditPU", iae.getPersistenceUnit()); assertEquals(A_SEQ_PU, iae.getPersistenceUnit()); @@ -197,13 +197,13 @@ public class DbDAOTest extends IntegrityAuditTestBase { Properties properties = makeProperties(); // Obtain an entry from the database based on ID - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); // Find the proper database entry Query iaequery = em .createQuery("Select i from IntegrityAuditEntity i where i.resourceName=:rn and i.persistenceUnit=:pu"); - iaequery.setParameter("rn", DbDAOTest.resourceName); - iaequery.setParameter("pu", DbDAOTest.A_SEQ_PU); + iaequery.setParameter("rn", DbDaoTest.resourceName); + iaequery.setParameter("pu", DbDaoTest.A_SEQ_PU); @SuppressWarnings("rawtypes") List iaeList = iaequery.getResultList(); @@ -235,7 +235,7 @@ public class DbDAOTest extends IntegrityAuditTestBase { try (EntityTransCloser et = new EntityTransCloser(em.getTransaction())) { // Create an entry and set it's designated field to true - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); dbDao.setDesignated(resourceName, A_SEQ_PU, true); // Find the proper entry in the database @@ -277,7 +277,7 @@ public class DbDAOTest extends IntegrityAuditTestBase { TestTime testTime = getTestTime(); // Create an entry - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); // Find the proper entry in the database Query iaequery = em.createQuery( @@ -323,9 +323,9 @@ public class DbDAOTest extends IntegrityAuditTestBase { Properties properties = makeProperties(); // create entries for the IntegrityAuditEntity table - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); - new DbDAO("pdp1", A_SEQ_PU, properties).destroy(); - new DbDAO("pdp2", A_SEQ_PU, properties).destroy(); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); + new DbDao("pdp1", A_SEQ_PU, properties).destroy(); + new DbDao("pdp2", A_SEQ_PU, properties).destroy(); // Obtain a hash with the persisted objects Map<Object, Object> entries = dbDao.getAllMyEntries("org.onap.policy.common.ia.jpa.IntegrityAuditEntity"); @@ -342,9 +342,9 @@ public class DbDAOTest extends IntegrityAuditTestBase { Properties properties = makeProperties(); // create entries for the IntegrityAuditEntity table - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); - new DbDAO("pdp1", A_SEQ_PU, properties).destroy(); - new DbDAO("pdp2", A_SEQ_PU, properties).destroy(); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); + new DbDao("pdp1", A_SEQ_PU, properties).destroy(); + new DbDao("pdp2", A_SEQ_PU, properties).destroy(); // Obtain all entity keys CriteriaBuilder cb = em.getCriteriaBuilder(); @@ -377,9 +377,9 @@ public class DbDAOTest extends IntegrityAuditTestBase { Properties properties = makeProperties(); // create entries for the IntegrityAuditEntity table - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); - new DbDAO("pdp1", A_SEQ_PU, properties).destroy(); - new DbDAO("pdp2", A_SEQ_PU, properties).destroy(); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); + new DbDao("pdp1", A_SEQ_PU, properties).destroy(); + new DbDao("pdp2", A_SEQ_PU, properties).destroy(); // Obtain a hash with the persisted objects Map<Object, Object> entries = dbDao.getAllEntries("integrityAuditPU", properties, @@ -398,9 +398,9 @@ public class DbDAOTest extends IntegrityAuditTestBase { Properties properties = makeProperties(); // create entries for the IntegrityAuditEntity table - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); - new DbDAO("pdp1", A_SEQ_PU, properties).destroy(); - new DbDAO("pdp2", A_SEQ_PU, properties).destroy(); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); + new DbDao("pdp1", A_SEQ_PU, properties).destroy(); + new DbDao("pdp2", A_SEQ_PU, properties).destroy(); // Obtain all entity keys CriteriaBuilder cb = em.getCriteriaBuilder(); @@ -433,9 +433,9 @@ public class DbDAOTest extends IntegrityAuditTestBase { Properties properties = makeProperties(); // create entries for the IntegrityAuditEntity table - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); - new DbDAO("pdp1", A_SEQ_PU, properties).destroy(); - new DbDAO("pdp2", A_SEQ_PU, properties).destroy(); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); + new DbDao("pdp1", A_SEQ_PU, properties).destroy(); + new DbDao("pdp2", A_SEQ_PU, properties).destroy(); // Obtain a hash with the persisted objects Map<Object, Object> entries = @@ -451,7 +451,7 @@ public class DbDAOTest extends IntegrityAuditTestBase { public void testGetPersistenceClassNames() throws Exception { Properties properties = makeProperties(); - dbDao = new DbDAO(resourceName, A_SEQ_PU, properties); + dbDao = new DbDao(resourceName, A_SEQ_PU, properties); // Retrieve persistence class names Set<String> result = dbDao.getPersistenceClassNames(); diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditDesignationTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditDesignationTest.java index bd3baf49..084c648d 100644 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditDesignationTest.java +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditDesignationTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Integrity Audit * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 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. @@ -261,7 +261,7 @@ public class IntegrityAuditDesignationTest extends IntegrityAuditTestBase { /* * Populate DB for pdp2, which will simulate it having registered but then having died. */ - new DbDAO("pdp2", A_SEQ_PU, makeProperties()).destroy(); + new DbDao("pdp2", A_SEQ_PU, makeProperties()).destroy(); /* * Sleep long enough to allow @@ -431,7 +431,7 @@ public class IntegrityAuditDesignationTest extends IntegrityAuditTestBase { /* * Populate DB for pdp3, which will simulate it having registered but then having died. */ - new DbDAO("pdp3", A_SEQ_PU, makeProperties()).destroy(); + new DbDao("pdp3", A_SEQ_PU, makeProperties()).destroy(); /* * Start audit for pdp4. @@ -488,12 +488,12 @@ public class IntegrityAuditDesignationTest extends IntegrityAuditTestBase { /* * Populate DB for "pdp1", which will simulate it having registered but then having died. */ - new DbDAO("pdp1", A_SEQ_PU, makeProperties()).destroy(); + new DbDao("pdp1", A_SEQ_PU, makeProperties()).destroy(); /* * Populate DB for pdp2, which will simulate it having registered but then having died. */ - new DbDAO("pdp2", A_SEQ_PU, makeProperties()).destroy(); + new DbDao("pdp2", A_SEQ_PU, makeProperties()).destroy(); /* * Start audit for pdp3. @@ -503,7 +503,7 @@ public class IntegrityAuditDesignationTest extends IntegrityAuditTestBase { /* * Populate DB for pdp4, which will simulate it having registered but then having died. */ - new DbDAO("pdp4", A_SEQ_PU, makeProperties()).destroy(); + new DbDao("pdp4", A_SEQ_PU, makeProperties()).destroy(); /* * Sleep long enough to allow |