From 7602a4380488d872b25cd718176b23369bf9e472 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Wed, 24 Jul 2019 13:19:28 -0400 Subject: Add coverage to feature-active-standby-management Also removed some logger.isXxx() tests, which should reduce the number of branches that need to be tested. Removed unneeded objects and methods from feature-lifecyle. Change-Id: Ic3eb9c0b63a2ad5585846525eb0ebda81fc55d5e Issue-ID: POLICY-1772 Signed-off-by: Jim Hahn --- .../controller/internal/MavenDroolsController.java | 42 ++++++---------------- 1 file changed, 11 insertions(+), 31 deletions(-) (limited to 'policy-management') diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java index d0b98450..818cae80 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java @@ -218,9 +218,7 @@ public class MavenDroolsController implements DroolsController { /* upgrade */ String messages = this.policyContainer.updateToVersion(newVersion); - if (logger.isWarnEnabled()) { - logger.warn("{} UPGRADE results: {}", this, messages); - } + logger.warn("{} UPGRADE results: {}", this, messages); /* * If all sucessful (can load new container), now we can remove all coders from previous sessions @@ -232,9 +230,7 @@ public class MavenDroolsController implements DroolsController { */ this.init(decoderConfigurations, encoderConfigurations); - if (logger.isInfoEnabled()) { - logger.info("UPDATE-TO-VERSION: completed " + this); - } + logger.info("UPDATE-TO-VERSION: completed {}", this); } /** @@ -247,9 +243,7 @@ public class MavenDroolsController implements DroolsController { protected void initCoders(List coderConfigurations, boolean decoder) { - if (logger.isInfoEnabled()) { - logger.info("INIT-CODERS: " + this); - } + logger.info("INIT-CODERS: {}", this); if (coderConfigurations == null) { return; @@ -337,9 +331,7 @@ public class MavenDroolsController implements DroolsController { * remove decoders. */ protected void removeDecoders() { - if (logger.isInfoEnabled()) { - logger.info("REMOVE-DECODERS: {}", this); - } + logger.info("REMOVE-DECODERS: {}", this); if (this.decoderConfigurations == null) { return; @@ -357,9 +349,7 @@ public class MavenDroolsController implements DroolsController { */ protected void removeEncoders() { - if (logger.isInfoEnabled()) { - logger.info("REMOVE-ENCODERS: {}", this); - } + logger.info("REMOVE-ENCODERS: {}", this); if (this.encoderConfigurations == null) { return; @@ -380,18 +370,12 @@ public class MavenDroolsController implements DroolsController { } if (modelHash == this.modelClassLoaderHash) { - if (logger.isInfoEnabled()) { - logger.info(coderClass.getName() - + this + " class loader matches original drools controller rules classloader " - + coderClass.getClassLoader()); - } + logger.info("{}{} class loader matches original drools controller rules classloader {}", + coderClass.getName(), this, coderClass.getClassLoader()); return true; } else { - if (logger.isWarnEnabled()) { - logger.warn(this + coderClass.getName() + " class loaders don't match " - + coderClass.getClassLoader() + " vs " - + this.policyContainer.getClassLoader()); - } + logger.warn("{}{} class loaders don't match {} vs {}", this, coderClass.getName(), + coderClass.getClassLoader(), this.policyContainer.getClassLoader()); return false; } } @@ -399,9 +383,7 @@ public class MavenDroolsController implements DroolsController { @Override public boolean start() { - if (logger.isInfoEnabled()) { - logger.info("START: {}", this); - } + logger.info("START: {}", this); synchronized (this) { if (this.alive) { @@ -572,9 +554,7 @@ public class MavenDroolsController implements DroolsController { @Override public boolean deliver(TopicSink sink, Object event) { - if (logger.isInfoEnabled()) { - logger.info("{}DELIVER: {} FROM {} TO {}", this, event, this, sink); - } + logger.info("{}DELIVER: {} FROM {} TO {}", this, event, this, sink); for (DroolsControllerFeatureApi feature : DroolsControllerFeatureApi.providers.getList()) { try { -- cgit 1.2.3-korg