Address junit failure in active-standby 92/96092/1
authorJim Hahn <jrh3@att.com>
Thu, 19 Sep 2019 21:58:19 +0000 (17:58 -0400)
committerJim Hahn <jrh3@att.com>
Fri, 20 Sep 2019 16:10:21 +0000 (12:10 -0400)
commit68b17b2a1ee2b6d1920cfc72f08dae25565bbe6a
tree3179d27f33f72f063d4b9fa5be20814eede6ac01
parent50cd3fbf4561fe445751d299c53efc499df6dfb6
Address junit failure in active-standby

In testLocking1(), the sleep() call after the final demote() was
allowing the background FPManager thread to re-promote the PDP before
the next test in the test case.  Removed the sleep() call, thus
preventing it from being re-promoted before the test.  As that's
the last test in that particular test case, it shouldn't cause a
problem.
In the process of diagnosing and fixing the problem, made the
additional changes below.
Made each junit runnable independently so that background threads
could be terminated and started afresh with each test.
Decreased the maximum "real" wait time of the tests, as the
main thread only needs to wait an instant for the other threads
to fire.
Modified code to use common entity manager factories rather than
creating them for each test.
Deleted unnecessary sleeps at the end of tests.
Deleted unnecessary db clean-ups at the start of tests (already
done by the @Before method.

Change-Id: Ia9f1053be564d85f1b29e47379ab184ffdbac235
Issue-ID: POLICY-2080
Signed-off-by: Jim Hahn <jrh3@att.com>
feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/StandbyStateManagementTest.java