From eac53deaf9aec175e36f32bef30919392227f8e5 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 1 Oct 2018 13:52:03 -0400 Subject: Add junit coverage to drools-pdp Added coverage to distributed locking. Added coverage to test-transaction - still more to do. Added coverage to healthcheck - still more to do. Also fixed "code smell" in pooling. Also fixed "code smell" in session persistence. Fixed typo in comment. Removed unneeded setUp() method from test. Fixed new checkstyle errors. Fixed another new checkstyle error. Change-Id: I0d2ab13fcbd64486af88affb02e114e624c6a3d1 Issue-ID: POLICY-1148 Signed-off-by: Jim Hahn --- .../drools/testtransaction/TestTransactionFeature.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'feature-test-transaction/src/main/java/org') diff --git a/feature-test-transaction/src/main/java/org/onap/policy/drools/testtransaction/TestTransactionFeature.java b/feature-test-transaction/src/main/java/org/onap/policy/drools/testtransaction/TestTransactionFeature.java index 956304b9..bb8a7598 100644 --- a/feature-test-transaction/src/main/java/org/onap/policy/drools/testtransaction/TestTransactionFeature.java +++ b/feature-test-transaction/src/main/java/org/onap/policy/drools/testtransaction/TestTransactionFeature.java @@ -40,7 +40,7 @@ public class TestTransactionFeature implements PolicyControllerFeatureAPI { logger.info("TEST_TRANSACTION FEATURE LOADED"); if (controller.isAlive() && !controller.isLocked() && controller.getDrools().isBrained()) { - TestTransaction.manager.register(controller); + getTestTransMgr().register(controller); } return false; } @@ -49,7 +49,7 @@ public class TestTransactionFeature implements PolicyControllerFeatureAPI { public boolean afterLock(PolicyController controller) { logger.info("controller {} locked", controller.getName()); - TestTransaction.manager.unregister(controller); + getTestTransMgr().unregister(controller); return false; } @@ -58,7 +58,7 @@ public class TestTransactionFeature implements PolicyControllerFeatureAPI { logger.info("controller {} unlocked", controller.getName()); if (controller.isAlive() && !controller.isLocked() && controller.getDrools().isBrained()) { - TestTransaction.manager.register(controller); + getTestTransMgr().register(controller); } return false; @@ -68,7 +68,7 @@ public class TestTransactionFeature implements PolicyControllerFeatureAPI { public boolean beforeStop(PolicyController controller) { logger.info("controller {} stopping", controller.getName()); - TestTransaction.manager.unregister(controller); + getTestTransMgr().unregister(controller); return false; } @@ -77,4 +77,12 @@ public class TestTransactionFeature implements PolicyControllerFeatureAPI { public int getSequenceNumber() { return 1000; } + + /** + * Gets the test transaction manager. + * @return the test transaction manager + */ + protected TestTransaction getTestTransMgr() { + return TestTransaction.manager; + } } -- cgit 1.2.3-korg