diff options
Diffstat (limited to 'integrity-audit/src/test')
5 files changed, 40 insertions, 7 deletions
diff --git a/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/AuditPeriodTest.java b/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/AuditPeriodTest.java index 649b71f2..d0c64065 100644 --- a/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/AuditPeriodTest.java +++ b/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/AuditPeriodTest.java @@ -49,6 +49,11 @@ import org.openecomp.policy.common.ia.IntegrityAuditProperties; import org.openecomp.policy.common.logging.flexlogger.FlexLogger; import org.openecomp.policy.common.logging.flexlogger.Logger; +/* + * All JUnits are designed to run in the local development environment + * where they have write privileges and can execute time-sensitive + * tasks. + */ public class AuditPeriodTest { private static Logger logger = FlexLogger.getLogger(AuditPeriodTest.class); diff --git a/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/DbAuditCompareEntriesTest.java b/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/DbAuditCompareEntriesTest.java index f109689d..5b3c7550 100644 --- a/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/DbAuditCompareEntriesTest.java +++ b/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/DbAuditCompareEntriesTest.java @@ -51,6 +51,11 @@ import org.openecomp.policy.common.ia.test.jpa.PersonTest; import org.openecomp.policy.common.logging.flexlogger.FlexLogger; import org.openecomp.policy.common.logging.flexlogger.Logger; +/* + * All JUnits are designed to run in the local development environment + * where they have write privileges and can execute time-sensitive + * tasks. + */ public class DbAuditCompareEntriesTest { private static Logger logger = FlexLogger.getLogger(DbAuditCompareEntriesTest.class); diff --git a/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/DbAuditTest.java b/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/DbAuditTest.java index a84281dd..21e3bfab 100644 --- a/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/DbAuditTest.java +++ b/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/DbAuditTest.java @@ -55,6 +55,11 @@ import org.openecomp.policy.common.ia.jpa.IntegrityAuditEntity; import org.openecomp.policy.common.logging.flexlogger.FlexLogger; import org.openecomp.policy.common.logging.flexlogger.Logger; +/* + * All JUnits are designed to run in the local development environment + * where they have write privileges and can execute time-sensitive + * tasks. + */ public class DbAuditTest { private static Logger logger = FlexLogger.getLogger(DbAuditTest.class); diff --git a/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/DbDAOTest.java b/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/DbDAOTest.java index 31fd0be6..351fe5f8 100644 --- a/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/DbDAOTest.java +++ b/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/DbDAOTest.java @@ -22,6 +22,11 @@ package org.openecomp.policy.common.ia.test; import static org.junit.Assert.*; +/* + * All JUnits are designed to run in the local development environment + * where they have write privileges and can execute time-sensitive + * tasks. + */ import java.util.Date; import java.util.HashMap; import java.util.HashSet; @@ -49,6 +54,11 @@ import org.openecomp.policy.common.ia.DbDaoTransactionException; import org.openecomp.policy.common.ia.IntegrityAuditProperties; import org.openecomp.policy.common.ia.jpa.IntegrityAuditEntity; +/* + * All JUnits are designed to run in the local development environment + * where they have write privileges and can execute time-sensitive + * tasks. + */ public class DbDAOTest { private static String persistenceUnit; private static Properties properties; diff --git a/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/IntegrityAuditDesignationTest.java b/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/IntegrityAuditDesignationTest.java index 6eb5fa4e..69936bfe 100644 --- a/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/IntegrityAuditDesignationTest.java +++ b/integrity-audit/src/test/java/org/openecomp/policy/common/ia/test/IntegrityAuditDesignationTest.java @@ -51,6 +51,11 @@ import org.openecomp.policy.common.ia.IntegrityAuditProperties; import org.openecomp.policy.common.logging.flexlogger.FlexLogger; import org.openecomp.policy.common.logging.flexlogger.Logger; +/* + * All JUnits are designed to run in the local development environment + * where they have write privileges and can execute time-sensitive + * tasks. + */ public class IntegrityAuditDesignationTest { private static Logger logger = FlexLogger.getLogger(IntegrityAuditDesignationTest.class); @@ -58,7 +63,7 @@ public class IntegrityAuditDesignationTest { /* * Provides a little cushion for timing events. */ - private static int FUDGE_FACTOR = 5000; + private static int FUDGE_FACTOR = 15000; private static String persistenceUnit; private static Properties properties; @@ -1028,29 +1033,31 @@ public class IntegrityAuditDesignationTest { IntegrityAudit integrityAudit3 = new IntegrityAudit(resourceName3, persistenceUnit3, properties3); // Start audit on pdp1 + logger.info("testDesignatedNodeDead: Start audit on pdp1"); integrityAudit.startAuditThread(); - // Sleep long enough for pdp1 figure out that it should be auditing and start the audit. - Thread.sleep(500); - // Start the auditing threads on other nodes. + logger.info("testDesignatedNodeDead: Start audit on pdp2"); integrityAudit2.startAuditThread(); + logger.info("testDesignatedNodeDead: Start audit on pdp3"); integrityAudit3.startAuditThread(); - // Sleep long enough to ensure the other two audits have registered. - Thread.sleep(500); - + // Kill audit on pdp1 + logger.info("testDesignatedNodeDead: Kill audit on pdp1"); integrityAudit.stopAuditThread(); // Sleep long enough for pdp1 to get stale and pdp2 to take over + logger.info("testDesignatedNodeDead: Sleep long enough for pdp1 to get stale and pdp2 to take over"); Thread.sleep(AuditThread.AUDIT_COMPLETION_INTERVAL + FUDGE_FACTOR); // Start audit thread on pdp1 again. + logger.info("testDesignatedNodeDead: Start audit thread on pdp1 again."); integrityAudit.startAuditThread(); // Sleep long enough for pdp2 to complete its audit and get stale, at // which point pdp3 should take over + logger.info("testDesignatedNodeDead: Sleep long enough for pdp2 to complete its audit and get stale, at which point pdp3 should take over"); Thread.sleep((AuditThread.AUDIT_SIMULATION_SLEEP_INTERVAL * AuditThread.AUDIT_SIMULATION_ITERATIONS) + AuditThread.AUDIT_COMPLETION_INTERVAL + FUDGE_FACTOR); @@ -1059,6 +1066,7 @@ public class IntegrityAuditDesignationTest { integrityAudit3.stopAuditThread(); // Sleep long enough for pdp3 to get stale and pdp1 to take over + logger.info("testDesignatedNodeDead: Sleep long enough for pdp3 to get stale and pdp1 to take over"); Thread.sleep(AuditThread.AUDIT_COMPLETION_INTERVAL + FUDGE_FACTOR); FileInputStream fstream = new FileInputStream(TEST_LOG); |