summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRam Krishna Verma <ram.krishna.verma@est.tech>2019-07-18 15:28:32 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-18 15:28:32 +0000
commit6beaea5bafd3e8b87a770ad7ee6b5e3b668111a4 (patch)
treee0bede11d7e7b1ef5119de8cda8e25b2376dc220
parentb9b2f08186ede73d7231040fcb75321a68b1d765 (diff)
parentf56dbc888dd7ef8c1abd31b726525cf57ede8aa7 (diff)
Merge "Fix checkstyle issues in feature-active-standby-management"
-rw-r--r--feature-active-standby-management/checkstyle-suppressions.xml30
-rw-r--r--feature-active-standby-management/pom.xml3
-rw-r--r--feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/ActiveStandbyFeature.java2
-rw-r--r--feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/PmStandbyStateChangeNotifier.java (renamed from feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/PMStandbyStateChangeNotifier.java)18
-rw-r--r--feature-active-standby-management/src/test/java/org/onap/policy/drools/controller/test/AllSeemsWellTest.java8
-rw-r--r--feature-active-standby-management/src/test/java/org/onap/policy/drools/controller/test/StandbyStateManagementTest.java26
6 files changed, 28 insertions, 59 deletions
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 @@
-<?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>
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 @@
<includeTestResources>true</includeTestResources>
<excludes>
</excludes>
- <suppressionsLocation>${project.baseUri}checkstyle-suppressions.xml</suppressionsLocation>
<consoleOutput>true</consoleOutput>
<failsOnViolation>true</failsOnViolation>
<violationSeverity>warning</violationSeverity>
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
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));
}
/**