diff options
Diffstat (limited to 'integrity-monitor/src')
6 files changed, 24 insertions, 10 deletions
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java index eee77056..9845fc71 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java @@ -213,7 +213,8 @@ public class IntegrityMonitor { // Did it get created? // if (emf == null) { - logger.error("Error creating IM entity manager factory with persistence unit: {}", factory.getPersistenceUnit()); + logger.error("Error creating IM entity manager factory with persistence unit: {}", + factory.getPersistenceUnit()); throw new IntegrityMonitorException("Unable to create IM Entity Manager Factory"); } @@ -1713,7 +1714,7 @@ public class IntegrityMonitor { try { factory.runStarted(); - while(!stopRequested) { + while (!stopRequested) { MonitorTime.getInstance().sleep(CYCLE_INTERVAL_MILLIS); IntegrityMonitor.this.runOnce(); @@ -1873,7 +1874,7 @@ public class IntegrityMonitor { * Indicates that the {@link FpManager#run()} method has started. This method * simply returns. * - * @throws InterruptedException + * @throws InterruptedException can be interrupted */ public void runStarted() throws InterruptedException { // does nothing @@ -1882,13 +1883,15 @@ public class IntegrityMonitor { /** * Indicates that a monitor activity has completed. This method simply returns. * - * @throws InterruptedException + * @throws InterruptedException can be interrupted */ public void monitorCompleted() throws InterruptedException { // does nothing } /** + * Get persistence unit. + * * @return the persistence unit to be used */ public String getPersistenceUnit() { diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/MonitorTime.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/MonitorTime.java index 271fa656..e489a8c1 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/MonitorTime.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/MonitorTime.java @@ -33,13 +33,15 @@ public class MonitorTime { private static CurrentTime instance = new CurrentTime(); /** - * + * Constructor. */ private MonitorTime() { super(); } /** + * Get instance. + * * @return the CurrentTime singleton */ public static CurrentTime getInstance() { diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java index 8aec2f0b..fe408931 100644 --- a/integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java +++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java @@ -22,6 +22,7 @@ package org.onap.policy.common.im; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; + import java.util.Map; import java.util.Properties; import java.util.concurrent.Semaphore; diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java index f7ffa217..3c4fba23 100644 --- a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java +++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java @@ -23,6 +23,7 @@ package org.onap.policy.common.im; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; + import java.util.Date; import java.util.List; import java.util.Properties; @@ -645,8 +646,6 @@ public class IntegrityMonitorTest extends IntegrityMonitorTestBase { myProp.put(IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL, "5"); myProp.put(IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, "5"); - IntegrityMonitor im = makeMonitor(resourceName, myProp); - // Note: do ***NOT*** do waitStep() here // Add a group1 dependent resources to put an entry in the forward @@ -663,6 +662,8 @@ public class IntegrityMonitorTest extends IntegrityMonitorTestBase { new StateManagement(emf, "group1_dep1"); + IntegrityMonitor im = makeMonitor(resourceName, myProp); + assertNoException(im, imx -> { imx.evaluateSanity(); }); diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java index adde768e..ba1fc344 100644 --- a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java +++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTestBase.java @@ -22,6 +22,7 @@ package org.onap.policy.common.im; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties; @@ -233,6 +234,8 @@ public class IntegrityMonitorTestBase { } /** + * Get saved factory. + * * @return the original integrity monitor factory */ static Factory getSavedFactory() { @@ -252,6 +255,8 @@ public class IntegrityMonitorTestBase { } /** + * Get current test time. + * * @return the "current" time, in milliseconds */ protected static long getCurrentTestTime() { @@ -272,7 +277,7 @@ public class IntegrityMonitorTestBase { /** * Waits for a semaphore to be acquired. * - * @param sem + * @param sem semaphore to wait on * @throws InterruptedException if the thread is interrupted * @throws AssertionError if the semaphore was not acquired within the allotted time */ diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/MonitorTimeTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/MonitorTimeTest.java index 5f20a831..69d2f851 100644 --- a/integrity-monitor/src/test/java/org/onap/policy/common/im/MonitorTimeTest.java +++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/MonitorTimeTest.java @@ -20,12 +20,14 @@ package org.onap.policy.common.im; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import org.junit.Test; import org.onap.policy.common.utils.time.CurrentTime; /** - * + * Class that tests MonitorTime. */ public class MonitorTimeTest { |