aboutsummaryrefslogtreecommitdiffstats
path: root/integrity-monitor/src/main/java/org/onap
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2018-11-27 15:15:57 -0500
committerJim Hahn <jrh3@att.com>2018-11-27 15:17:07 -0500
commit1ff3457738007037364a103c28836d582098f764 (patch)
treeb8a9b146aee6178079b7bb60fe6d341fda12e5a7 /integrity-monitor/src/main/java/org/onap
parentdc569fec077a6d6acce415925685699d5907cd2d (diff)
Remove Factory from IntegrityMonitor
Also removed unneeded method override in junit test. Change-Id: I7186e9f75443f7b8ba8376aa0e00a5cf4c573696 Issue-ID: POLICY-1287 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'integrity-monitor/src/main/java/org/onap')
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java68
1 files changed, 31 insertions, 37 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 8e9dd3dd..9801b530 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
@@ -75,9 +75,6 @@ public class IntegrityMonitor {
*/
private static final String QUERY_STRING = "Select f from ForwardProgressEntity f where f.resourceName=:rn";
- // may be changed by junit tests
- private static Factory factory = new Factory();
-
private static String resourceName = null;
boolean alarmExists = false;
@@ -224,13 +221,13 @@ public class IntegrityMonitor {
//
// Create the entity manager factory
//
- emf = Persistence.createEntityManagerFactory(factory.getPersistenceUnit(), properties);
+ emf = Persistence.createEntityManagerFactory(getPersistenceUnit(), properties);
//
// 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: {}",
+ getPersistenceUnit());
throw new IntegrityMonitorException("Unable to create IM Entity Manager Factory");
}
@@ -1714,13 +1711,13 @@ public class IntegrityMonitor {
logger.debug("FPManager thread running");
try {
- factory.runStarted();
+ runStarted();
while (!stopRequested) {
MonitorTime.getInstance().sleep(CYCLE_INTERVAL_MILLIS);
-
- this.runOnce();
- factory.monitorCompleted();
+
+ runOnce();
+ monitorCompleted();
}
} catch (InterruptedException e) {
@@ -1865,38 +1862,35 @@ public class IntegrityMonitor {
public Map<String, String> getAllNotWellMap() {
return allNotWellMap;
}
+
+ // these methods may be overridden by junit tests
/**
- * Wrapper used to access various objects. Overridden by junit tests.
+ * Indicates that the {@link FpManager#run()} method has started. This method
+ * simply returns.
+ *
+ * @throws InterruptedException can be interrupted
*/
- public static class Factory {
-
- /**
- * Indicates that the {@link FpManager#run()} method has started. This method simply returns.
- *
- * @throws InterruptedException can be interrupted
- */
- public void runStarted() throws InterruptedException {
- // does nothing
- }
+ protected void runStarted() throws InterruptedException {
+ // does nothing
+ }
- /**
- * Indicates that a monitor activity has completed. This method simply returns.
- *
- * @throws InterruptedException can be interrupted
- */
- public void monitorCompleted() throws InterruptedException {
- // does nothing
- }
+ /**
+ * Indicates that a monitor activity has completed. This method simply returns.
+ *
+ * @throws InterruptedException can be interrupted
+ */
+ protected void monitorCompleted() throws InterruptedException {
+ // does nothing
+ }
- /**
- * Get persistence unit.
- *
- * @return the persistence unit to be used
- */
- public String getPersistenceUnit() {
- return PERSISTENCE_UNIT;
- }
+ /**
+ * Get persistence unit.
+ *
+ * @return the persistence unit to be used
+ */
+ protected String getPersistenceUnit() {
+ return PERSISTENCE_UNIT;
}
/*