Fix checkstyle issues in feature-active-standby-management 92/91192/2
authorJim Hahn <jrh3@att.com>
Wed, 10 Jul 2019 21:09:05 +0000 (17:09 -0400)
committerJim Hahn <jrh3@att.com>
Thu, 18 Jul 2019 13:49:09 +0000 (09:49 -0400)
Also deleted the checkstyle suppression file.

Change-Id: I4a70c7abc8d73803c54a5c9353c7f460f815b4f0
Issue-ID: POLICY-1903
Signed-off-by: Jim Hahn <jrh3@att.com>
feature-active-standby-management/checkstyle-suppressions.xml [deleted file]
feature-active-standby-management/pom.xml
feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/ActiveStandbyFeature.java
feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/PmStandbyStateChangeNotifier.java [moved from feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/PMStandbyStateChangeNotifier.java with 97% similarity]
feature-active-standby-management/src/test/java/org/onap/policy/drools/controller/test/AllSeemsWellTest.java
feature-active-standby-management/src/test/java/org/onap/policy/drools/controller/test/StandbyStateManagementTest.java

diff --git a/feature-active-standby-management/checkstyle-suppressions.xml b/feature-active-standby-management/checkstyle-suppressions.xml
deleted file mode 100644 (file)
index cce8939..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  ============LICENSE_START=======================================================
-   Copyright (C) 2018 AT&T Technologies. 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.
-  You may obtain a copy of the License at
-  
-       http://www.apache.org/licenses/LICENSE-2.0
-  
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-  
-  SPDX-License-Identifier: Apache-2.0
-  ============LICENSE_END=========================================================
--->
-
-<!DOCTYPE suppressions PUBLIC
-     "-//Puppy Crawl//DTD Suppressions 1.0//EN"
-     "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
-<suppressions>
-  <suppress checks="AbbreviationAsWordInName"
-    files="PMStandbyStateChangeNotifier.java"
-    lines="1-9999"/>
-</suppressions>
index fea3c48..d558882 100644 (file)
@@ -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.
                             <includeTestResources>true</includeTestResources>
                             <excludes>
                             </excludes>
-                            <suppressionsLocation>${project.baseUri}checkstyle-suppressions.xml</suppressionsLocation>
                             <consoleOutput>true</consoleOutput>
                             <failsOnViolation>true</failsOnViolation>
                             <violationSeverity>warning</violationSeverity>
index 6101073..5b1caea 100644 (file)
@@ -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);
@@ -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);
index 55ab7c5..719fb62 100644 (file)
@@ -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= {} "
index b07ab76..b277850 100644 (file)
@@ -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));
     }
 
     /**