From: Jim Hahn Date: Wed, 10 Jul 2019 21:09:05 +0000 (-0400) Subject: Fix checkstyle issues in feature-active-standby-management X-Git-Tag: 1.5.1~10^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F92%2F91192%2F2;p=policy%2Fdrools-pdp.git Fix checkstyle issues in feature-active-standby-management Also deleted the checkstyle suppression file. Change-Id: I4a70c7abc8d73803c54a5c9353c7f460f815b4f0 Issue-ID: POLICY-1903 Signed-off-by: Jim Hahn --- diff --git a/feature-active-standby-management/checkstyle-suppressions.xml b/feature-active-standby-management/checkstyle-suppressions.xml deleted file mode 100644 index cce89398..00000000 --- a/feature-active-standby-management/checkstyle-suppressions.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - diff --git a/feature-active-standby-management/pom.xml b/feature-active-standby-management/pom.xml index fea3c486..d5588822 100644 --- a/feature-active-standby-management/pom.xml +++ b/feature-active-standby-management/pom.xml @@ -2,7 +2,7 @@ ============LICENSE_START======================================================= feature-active-standby-management ================================================================================ - Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -100,7 +100,6 @@ true - ${project.baseUri}checkstyle-suppressions.xml true true warning diff --git a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/ActiveStandbyFeature.java b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/ActiveStandbyFeature.java index 6101073a..5b1caeae 100644 --- a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/ActiveStandbyFeature.java +++ b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/ActiveStandbyFeature.java @@ -110,7 +110,7 @@ public class ActiveStandbyFeature implements ActiveStandbyFeatureApi, //Create an instance of the Observer - PMStandbyStateChangeNotifier pmNotifier = new PMStandbyStateChangeNotifier(); + PmStandbyStateChangeNotifier pmNotifier = new PmStandbyStateChangeNotifier(); //Register the PMStandbyStateChangeNotifier Observer stateManagementFeature.addObserver(pmNotifier); diff --git a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/PMStandbyStateChangeNotifier.java b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/PmStandbyStateChangeNotifier.java similarity index 97% rename from feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/PMStandbyStateChangeNotifier.java rename to feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/PmStandbyStateChangeNotifier.java index 53f825d0..9da5d42e 100644 --- a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/PMStandbyStateChangeNotifier.java +++ b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/PmStandbyStateChangeNotifier.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * feature-active-standby-management * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,9 +78,9 @@ import org.slf4j.LoggerFactory; * during the controller stoppages, the PDP is in hotstandby and the standdown occurs. * */ -public class PMStandbyStateChangeNotifier extends StateChangeNotifier { +public class PmStandbyStateChangeNotifier extends StateChangeNotifier { // get an instance of logger - private static final Logger logger = LoggerFactory.getLogger(PMStandbyStateChangeNotifier.class); + private static final Logger logger = LoggerFactory.getLogger(PmStandbyStateChangeNotifier.class); private Timer delayActivateTimer; private int pdpUpdateInterval; private boolean isWaitingForActivation; @@ -96,7 +96,7 @@ public class PMStandbyStateChangeNotifier extends StateChangeNotifier { * Constructor. * */ - public PMStandbyStateChangeNotifier() { + public PmStandbyStateChangeNotifier() { pdpUpdateInterval = Integer.parseInt(ActiveStandbyProperties.getProperty(ActiveStandbyProperties.PDP_UPDATE_INTERVAL)); isWaitingForActivation = false; @@ -104,7 +104,7 @@ public class PMStandbyStateChangeNotifier extends StateChangeNotifier { // delay the activate so the DesignatedWaiter can run twice - give it an extra 2 seconds waitInterval = 2 * pdpUpdateInterval + 2000L; isNowActivating = false; - previousStandbyStatus = PMStandbyStateChangeNotifier.NONE; + previousStandbyStatus = PmStandbyStateChangeNotifier.NONE; } @Override @@ -167,7 +167,7 @@ public class PMStandbyStateChangeNotifier extends StateChangeNotifier { if (logger.isDebugEnabled()) { logger.debug("handleStateChange: standbyStatus={}; standing down PDP={}", standbyStatus, pdpId); } - if (previousStandbyStatus.equals(PMStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY)) { + if (previousStandbyStatus.equals(PmStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY)) { // We were just here and did this successfully if (logger.isDebugEnabled()) { logger.debug("handleStateChange: Is returning because standbyStatus is {}" @@ -193,7 +193,7 @@ public class PMStandbyStateChangeNotifier extends StateChangeNotifier { // Only want to lock the endpoints, not the controllers. PolicyEngine.manager.deactivate(); // The operation was fully successful - previousStandbyStatus = PMStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY; + previousStandbyStatus = PmStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY; } catch (Exception e) { logger.warn("handleStateChange: standbyStatus = {} caught exception: {}", standbyStatus, e.getMessage(), e); @@ -297,7 +297,7 @@ public class PMStandbyStateChangeNotifier extends StateChangeNotifier { } else { logger.error("handleStateChange: Unsupported standbyStatus={}; standing down PDP={}", standbyStatus, pdpId); - if (previousStandbyStatus.equals(PMStandbyStateChangeNotifier.UNSUPPORTED)) { + if (previousStandbyStatus.equals(PmStandbyStateChangeNotifier.UNSUPPORTED)) { // We were just here and did this successfully if (logger.isDebugEnabled()) { logger.debug("handleStateChange: Is returning because standbyStatus is " @@ -322,7 +322,7 @@ public class PMStandbyStateChangeNotifier extends StateChangeNotifier { } PolicyEngine.manager.deactivate(); // We know the standbystatus is unsupported - previousStandbyStatus = PMStandbyStateChangeNotifier.UNSUPPORTED; + previousStandbyStatus = PmStandbyStateChangeNotifier.UNSUPPORTED; } catch (Exception e) { logger.warn("handleStateChange: Unsupported standbyStatus = {} " + "caught exception: {} ", standbyStatus, e.getMessage(), e); diff --git a/feature-active-standby-management/src/test/java/org/onap/policy/drools/controller/test/AllSeemsWellTest.java b/feature-active-standby-management/src/test/java/org/onap/policy/drools/controller/test/AllSeemsWellTest.java index 55ab7c55..719fb62f 100644 --- a/feature-active-standby-management/src/test/java/org/onap/policy/drools/controller/test/AllSeemsWellTest.java +++ b/feature-active-standby-management/src/test/java/org/onap/policy/drools/controller/test/AllSeemsWellTest.java @@ -278,8 +278,8 @@ public class AllSeemsWellTest { logger.debug("testAllSeemsWell: Sleeping {} s, to allow JpaDroolsPdpsConnector " - + "time to check droolspdpentity table", SLEEP_TIME_SEC); - waitForCondition(()-> conn.getPdp(thisPdpId).isDesignated(), SLEEP_TIME_SEC); + + "time to check droolspdpentity table", SLEEP_TIME_SEC); + waitForCondition(() -> conn.getPdp(thisPdpId).isDesignated(), SLEEP_TIME_SEC); // Verify that this formerly un-designated PDP in HOT_STANDBY is now designated and providing service. @@ -305,8 +305,8 @@ public class AllSeemsWellTest { //It takes 10x the update interval (1 sec) before the watcher will declare the election handler dead //and that just stops forward progress counter. So, the fp monitor must then run to determine - //if the fpc has stalled. That will take about another 5 sec. - waitForCondition(()-> smf.getStandbyStatus().equals(StateManagement.COLD_STANDBY), + // if the fpc has stalled. That will take about another 5 sec. + waitForCondition(() -> smf.getStandbyStatus().equals(StateManagement.COLD_STANDBY), STALLED_ELECTION_HANDLER_SLEEP_TIME_SEC); logger.debug("testAllSeemsWell: After isStalled=true, PDP= {} " diff --git a/feature-active-standby-management/src/test/java/org/onap/policy/drools/controller/test/StandbyStateManagementTest.java b/feature-active-standby-management/src/test/java/org/onap/policy/drools/controller/test/StandbyStateManagementTest.java index b07ab76c..b277850c 100644 --- a/feature-active-standby-management/src/test/java/org/onap/policy/drools/controller/test/StandbyStateManagementTest.java +++ b/feature-active-standby-management/src/test/java/org/onap/policy/drools/controller/test/StandbyStateManagementTest.java @@ -51,7 +51,7 @@ import org.onap.policy.drools.activestandby.DroolsPdpImpl; import org.onap.policy.drools.activestandby.DroolsPdpsConnector; import org.onap.policy.drools.activestandby.DroolsPdpsElectionHandler; import org.onap.policy.drools.activestandby.JpaDroolsPdpsConnector; -import org.onap.policy.drools.activestandby.PMStandbyStateChangeNotifier; +import org.onap.policy.drools.activestandby.PmStandbyStateChangeNotifier; import org.onap.policy.drools.core.PolicySessionFeatureApi; import org.onap.policy.drools.statemanagement.StateManagementFeatureApi; import org.slf4j.Logger; @@ -233,10 +233,10 @@ public class StandbyStateManagementTest { //@Ignore //@Test public void testPmStandbyStateChangeNotifier() throws Exception { - logger.debug("\n\ntestPMStandbyStateChangeNotifier: Entering\n\n"); + logger.debug("\n\ntestPmStandbyStateChangeNotifier: Entering\n\n"); cleanXacmlDb(); - logger.debug("testPMStandbyStateChangeNotifier: Reading activeStandbyProperties"); + logger.debug("testPmStandbyStateChangeNotifier: Reading activeStandbyProperties"); Properties activeStandbyProperties = new Properties(); activeStandbyProperties.load(new FileInputStream(new File( @@ -246,14 +246,14 @@ public class StandbyStateManagementTest { activeStandbyProperties.setProperty("resource.name", resourceName); ActiveStandbyProperties.initProperties(activeStandbyProperties); - logger.debug("testPMStandbyStateChangeNotifier: Getting StateManagement instance"); + logger.debug("testPmStandbyStateChangeNotifier: Getting StateManagement instance"); StateManagement sm = new StateManagement(emfx, resourceName); //Create an instance of the Observer - PMStandbyStateChangeNotifier pmNotifier = new PMStandbyStateChangeNotifier(); + PmStandbyStateChangeNotifier pmNotifier = new PmStandbyStateChangeNotifier(); - //Register the PMStandbyStateChangeNotifier Observer + //Register the PmStandbyStateChangeNotifier Observer sm.addObserver(pmNotifier); //At this point the standbystatus = 'null' @@ -267,23 +267,23 @@ public class StandbyStateManagementTest { sm.demote(); System.out.println(pmNotifier.getPreviousStandbyStatus()); assertTrue(pmNotifier.getPreviousStandbyStatus().equals( - PMStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY)); + PmStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY)); //Now making standbystatus=coldstandby sm.lock(); assertTrue(pmNotifier.getPreviousStandbyStatus().equals( - PMStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY)); + PmStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY)); //standbystatus = hotstandby sm.unlock(); assertTrue(pmNotifier.getPreviousStandbyStatus().equals( - PMStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY)); + PmStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY)); //standbystatus = providingservice sm.promote(); //The previousStandbyStatus is not updated until after the delay activation expires assertTrue(pmNotifier.getPreviousStandbyStatus().equals( - PMStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY)); + PmStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY)); //Sleep long enough for the delayActivationTimer to run sleep(5000); @@ -296,17 +296,17 @@ public class StandbyStateManagementTest { //standbystatus = coldstandby sm.lock(); assertTrue(pmNotifier.getPreviousStandbyStatus().equals( - PMStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY)); + PmStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY)); //standbystatus = hotstandby sm.unlock(); assertTrue(pmNotifier.getPreviousStandbyStatus().equals( - PMStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY)); + PmStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY)); //standbystatus = hotstandby sm.demote(); assertTrue(pmNotifier.getPreviousStandbyStatus().equals( - PMStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY)); + PmStandbyStateChangeNotifier.HOTSTANDBY_OR_COLDSTANDBY)); } /**