diff options
author | Jim Hahn <jrh3@att.com> | 2019-07-10 15:58:09 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-07-17 15:21:07 -0400 |
commit | 86512b0d4e3235fca6379b3d7f3f1d8a9a5c606b (patch) | |
tree | 3a03573fc08cba42d9989cd96148012ddb5c7fd3 /feature-active-standby-management/src | |
parent | 6dee9fba7e3c471bab358d8567a9e3e0a3fca769 (diff) |
Fix checkstyle issues in api-state-management
Also deleted the checkstyle suppression file.
Change-Id: Ib43a75c2e214db61a75173be095c380c7c7488f1
Issue-ID: POLICY-1902
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'feature-active-standby-management/src')
4 files changed, 198 insertions, 198 deletions
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 c34f9ace..6101073a 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 @@ -7,9 +7,9 @@ * 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. @@ -31,7 +31,7 @@ import javax.persistence.Persistence; import org.onap.policy.drools.core.PolicySessionFeatureApi; import org.onap.policy.drools.features.PolicyEngineFeatureApi; -import org.onap.policy.drools.statemanagement.StateManagementFeatureAPI; +import org.onap.policy.drools.statemanagement.StateManagementFeatureApi; import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.drools.utils.PropertyUtil; import org.slf4j.Logger; @@ -57,7 +57,7 @@ public class ActiveStandbyFeature implements ActiveStandbyFeatureApi, private static Object myPdpSync = new Object(); private static DroolsPdpsElectionHandler electionHandler; - private StateManagementFeatureAPI stateManagementFeature; + private StateManagementFeatureApi stateManagementFeature; public static final int SEQ_NUM = 1; @@ -82,7 +82,7 @@ public class ActiveStandbyFeature implements ActiveStandbyFeatureApi, // This must come first since it initializes myPdp initializePersistence(configDir); - for (StateManagementFeatureAPI feature : StateManagementFeatureAPI.impl.getList()) { + for (StateManagementFeatureApi feature : StateManagementFeatureApi.impl.getList()) { if (feature.getResourceName().equals(myPdp.getPdpId())) { if (logger.isDebugEnabled()) { logger.debug("ActiveStandbyFeature.globalInit: Found StateManagementFeature" @@ -95,11 +95,11 @@ public class ActiveStandbyFeature implements ActiveStandbyFeatureApi, if (stateManagementFeature == null) { if (logger.isDebugEnabled()) { logger.debug("ActiveStandbyFeature failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", myPdp.getPdpId()); } logger.error("ActiveStandbyFeature failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", myPdp.getPdpId()); // // Cannot add observer since stateManagementFeature is null @@ -137,7 +137,7 @@ public class ActiveStandbyFeature implements ActiveStandbyFeatureApi, private static void initializePersistence(String configDir) { //Get the Active Standby properties try { - Properties activeStandbyProperties = + Properties activeStandbyProperties = PropertyUtil.getProperties(configDir + "/feature-active-standby-management.properties"); ActiveStandbyProperties.initProperties(activeStandbyProperties); logger.info("initializePersistence: ActiveStandbyProperties success"); @@ -188,7 +188,7 @@ public class ActiveStandbyFeature implements ActiveStandbyFeatureApi, * Moved code to instantiate a JpaDroolsPdpsConnector object from main() to * this method, so it can also be accessed from StandbyStateChangeNotifier * class. - * + * * @param pu string * @return connector object */ diff --git a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpsElectionHandler.java b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpsElectionHandler.java index fddf0246..85a0e3ab 100644 --- a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpsElectionHandler.java +++ b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpsElectionHandler.java @@ -2,14 +2,14 @@ * ============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. * 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. @@ -28,12 +28,12 @@ import java.util.Timer; import java.util.TimerTask; import org.onap.policy.common.im.StateManagement; -import org.onap.policy.drools.statemanagement.StateManagementFeatureAPI; +import org.onap.policy.drools.statemanagement.StateManagementFeatureApi; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class DroolsPdpsElectionHandler implements ThreadRunningChecker { - // get an instance of logger + // get an instance of logger private static final Logger logger = LoggerFactory.getLogger(DroolsPdpsElectionHandler.class); private DroolsPdpsConnector pdpsConnector; private Object checkWaitTimerLock = new Object(); @@ -68,14 +68,14 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { */ private Boolean allSeemsWell = null; - private StateManagementFeatureAPI stateManagementFeature; + private StateManagementFeatureApi stateManagementFeature; private static boolean isUnitTesting = false; private static boolean isStalled = false; /** * Constructor. - * + * * @param pdps connectors * @param myPdp pdp */ @@ -115,18 +115,18 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { final long nowMs = now.getTime(); // Create the timer which will update the updateDate in DroolsPdpEntity table. - // This is the heartbeat + // This is the heartbeat updateWorker = new Timer(); // Schedule the TimerUpdateClass to run at 100 ms and run at pdpCheckInterval ms thereafter - // NOTE: The first run of the TimerUpdateClass results in myPdp being added to the + // NOTE: The first run of the TimerUpdateClass results in myPdp being added to the // drools droolsPdpEntity table. updateWorker.scheduleAtFixedRate(new TimerUpdateClass(), 100, pdpCheckInterval); // Create the timer which will run the election algorithm waitTimer = new Timer(); - // Schedule it to start in startMs ms + // Schedule it to start in startMs ms // (so it will run after the updateWorker and run at pdpUpdateInterval ms thereafter long startMs = getDWaiterStartMs(); designationWaiter = new DesignationWaiter(); @@ -135,7 +135,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { //Get the StateManagementFeature instance - for (StateManagementFeatureAPI feature : StateManagementFeatureAPI.impl.getList()) { + for (StateManagementFeatureApi feature : StateManagementFeatureApi.impl.getList()) { if (feature.getResourceName().equals(myPdp.getPdpId())) { if (logger.isDebugEnabled()) { logger.debug("DroolsPdpsElectionHandler: Found StateManagementFeature" @@ -147,7 +147,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { } if (stateManagementFeature == null) { logger.error("DroolsPdpsElectionHandler failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", myPdp.getPdpId()); } } @@ -155,7 +155,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { public static void setIsUnitTesting(boolean val) { isUnitTesting = val; } - + public static void setIsStalled(boolean val) { isStalled = val; } @@ -164,7 +164,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { * When the JpaDroolsPdpsConnector.standDown() method is invoked, it needs * access to myPdp, so it can keep its designation status in sync with the * DB. - * + * * @param designated is designated value */ public static void setMyPdpDesignated(boolean designated) { @@ -175,7 +175,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { } private class DesignationWaiter extends TimerTask { - // get an instance of logger + // get an instance of logger private final Logger logger = LoggerFactory.getLogger(DesignationWaiter.class); @Override @@ -188,7 +188,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { //This is for testing the checkWaitTimer if (isUnitTesting && isStalled) { if (logger.isDebugEnabled()) { - logger.debug("DesignatedWaiter.run: isUnitTesting = {} isStalled = {}", + logger.debug("DesignatedWaiter.run: isUnitTesting = {} isStalled = {}", isUnitTesting, isStalled); } return; @@ -245,10 +245,10 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { /* * There are 4 combinations of isDesignated and isCurrent. We will examine each one in-turn * and evaluate the each pdp in the list of pdps against each combination. - * + * * This is the first combination of isDesignated and isCurrent */ - if (pdp.isDesignated() && isCurrent) { + if (pdp.isDesignated() && isCurrent) { //It is current, but it could have a standbystatus=coldstandby / hotstandby //If so, we need to stand it down and demote it if (!standbyStatus.equals(StateManagement.PROVIDING_SERVICE)) { @@ -260,22 +260,22 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { } // So, we must demote it try { - //Keep the order like this. StateManagement is last since it + //Keep the order like this. StateManagement is last since it //triggers controller shutdown //This will change isDesignated and it can enter another if(combination) below - pdpsConnector.standDownPdp(pdp.getPdpId()); + pdpsConnector.standDownPdp(pdp.getPdpId()); myPdp.setDesignated(false); isDesignated = false; - if (!(standbyStatus.equals(StateManagement.HOT_STANDBY) + if (!(standbyStatus.equals(StateManagement.HOT_STANDBY) || standbyStatus.equals(StateManagement.COLD_STANDBY))) { /* * Only demote it if it appears it has not already been demoted. Don't worry - * about synching with the topic endpoint states. That is done by the + * about synching with the topic endpoint states. That is done by the * refreshStateAudit */ stateManagementFeature.demote(); } - //update the standbystatus to check in a later + //update the standbystatus to check in a later //combination of isDesignated and isCurrent standbyStatus = stateManagementFeature.getStandbyStatus(pdp.getPdpId()); } catch (Exception e) { @@ -289,7 +289,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { logger.debug("\n\nDesignatedWaiter.run: myPdp {} is current and designated, " + "but standbystatus is not providingservice. " + " Cannot execute stateManagement.demote() " - + "since it it is not myPdp\n\n", + + "since it it is not myPdp\n\n", myPdp.getPdpId()); } } @@ -299,7 +299,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { if (logger.isDebugEnabled()) { logger.debug("DesignatedWaiter.run: PDP= {} is designated, " + "current and {} Noting PDP as " - + "designated, standbyStatus= {}", + + "designated, standbyStatus= {}", pdp.getPdpId(), standbyStatus, standbyStatus); } listOfDesignated.add(pdp); @@ -311,8 +311,8 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { /* * The second combination of isDesignated and isCurrent - * - * PDP is designated but not current; it has failed. + * + * PDP is designated but not current; it has failed. * So we stand it down (it doesn't matter what * its standbyStatus is). None of these go on the list. */ @@ -320,14 +320,14 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { if (logger.isDebugEnabled()) { logger.debug("INFO: DesignatedWaiter.run: PDP= {} is currently " + "designated but is not current; " - + "it has failed. Standing down. standbyStatus= {}", + + "it has failed. Standing down. standbyStatus= {}", pdp.getPdpId(), standbyStatus); } /* * Changes designated to 0 but it is still potentially providing service * Will affect isDesignated, so, it can enter an if(combination) below */ - pdpsConnector.standDownPdp(pdp.getPdpId()); + pdpsConnector.standDownPdp(pdp.getPdpId()); //need to change standbystatus to coldstandby if (pdp.getPdpId().equals(myPdp.getPdpId())) { @@ -367,13 +367,13 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { } continue; //we are not going to do anything else with this pdp - } + } /* * The third combination of isDesignated and isCurrent * /* - * If a PDP is not currently designated but is providing service - * (erroneous, but recoverable) or hot standby + * If a PDP is not currently designated but is providing service + * (erroneous, but recoverable) or hot standby * we can add it to the list of possible designated if all the designated have failed */ if (!pdp.isDesignated() && isCurrent) { @@ -390,16 +390,16 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { //demote it if (logger.isDebugEnabled()) { logger.debug("DesignatedWaiter.run: PDP {} going to " - + "setDesignated = false and calling stateManagement.demote", + + "setDesignated = false and calling stateManagement.demote", pdp.getPdpId()); } try { - //Keep the order like this. + //Keep the order like this. //StateManagement is last since it triggers controller shutdown pdpsConnector.setDesignated(myPdp, false); myPdp.setDesignated(false); isDesignated = false; - //This is definitely not a redundant call. + //This is definitely not a redundant call. //It is attempting to correct a problem stateManagementFeature.demote(); //recheck the standbystatus @@ -417,7 +417,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { if (logger.isDebugEnabled()) { logger.debug("INFO: DesignatedWaiter.run: PDP= {}" + " is not designated but is {} and designated PDP " - + "has failed. standbyStatus= {}", pdp.getPdpId(), + + "has failed. standbyStatus= {}", pdp.getPdpId(), standbyStatus, standbyStatus); } listOfDesignated.add(pdp); @@ -427,26 +427,26 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { /* * The fourth combination of isDesignated and isCurrent - * + * * We are not going to put any of these on the list since it appears they have failed. - * + * */ if (!pdp.isDesignated() && !isCurrent) { if (logger.isDebugEnabled()) { logger.debug("INFO: DesignatedWaiter.run: PDP= {} " + "designated= {}, current= {}, " + "designatedPdpHasFailed= {}, " - + "standbyStatus= {}",pdp.getPdpId(), + + "standbyStatus= {}",pdp.getPdpId(), pdp.isDesignated(), isCurrent, designatedPdpHasFailed, standbyStatus); } if (!standbyStatus.equals(StateManagement.COLD_STANDBY)) { //stand it down //disableFail it - pdpsConnector.standDownPdp(pdp.getPdpId()); + pdpsConnector.standDownPdp(pdp.getPdpId()); if (pdp.getPdpId().equals(myPdp.getPdpId())) { /* - * I don't actually know how this condition could happen, + * I don't actually know how this condition could happen, * but if it did, we would want * to declare it failed. */ @@ -456,7 +456,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { } // So, we must disableFail it try { - //Keep the order like this. + //Keep the order like this. //StateManagement is last since it triggers controller shutdown pdpsConnector.setDesignated(myPdp, false); myPdp.setDesignated(false); @@ -464,22 +464,22 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { stateManagementFeature.disableFailed(); } catch (Exception e) { logger.error("DesignatedWaiter.run: myPdp: {} Caught Exception attempting to " - + "disableFail myPdp {}, message= {}", + + "disableFail myPdp {}, message= {}", myPdp.getPdpId(), myPdp.getPdpId(), e); } } else { //it is remote if (logger.isDebugEnabled()) { logger.debug("\n\nDesignatedWaiter.run: myPdp {} is !current and !designated, " - + " Executing stateManagement.disableFailed({})\n\n", + + " Executing stateManagement.disableFailed({})\n\n", myPdp.getPdpId(), pdp.getPdpId()); } // We already called standdown(pdp) which will change designated to false - // Now we need to disableFail it to get its states in sync. + // Now we need to disableFail it to get its states in sync. // StandbyStatus = coldstandby try { stateManagementFeature.disableFailed(pdp.getPdpId()); } catch (Exception e) { - logger.error("DesignatedWaiter.run: for PDP {}" + logger.error("DesignatedWaiter.run: for PDP {}" + " Caught Exception attempting to disableFail({})" + ", message=", pdp.getPdpId(), pdp.getPdpId(), e); } @@ -493,10 +493,10 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { /* * We have checked the four combinations of isDesignated and isCurrent. Where appropriate, * we added the PDPs to the potential list of designated pdps - * + * * We need to give priority to pdps on the same site that is currently being used * First, however, we must sanitize the list of designated to make sure their are - * only designated members or non-designated members. There should not be both in + * only designated members or non-designated members. There should not be both in * the list. Because there are real time delays, it is possible that both types could * be on the list. */ @@ -504,7 +504,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { listOfDesignated = santizeDesignatedList(listOfDesignated); /* - * We need to figure out the last pdp that was the primary so we can get the last site + * We need to figure out the last pdp that was the primary so we can get the last site * name and the last session numbers. We need to create a "dummy" droolspdp since * it will be used in later comparisons and cannot be null. */ @@ -521,8 +521,8 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { * occurs when there is a race condition with multiple nodes coming up at the same time. If that is * the case we must determine which one is the one that should be designated and which one should * be demoted. - * - * It is possible to have 0, 1, 2 or more but not all, or all designated. + * + * It is possible to have 0, 1, 2 or more but not all, or all designated. * If we have one designated and current, we chose it and are done * If we have 2 or more, but not all, we must determine which one is in the same site as * the previously designated pdp. @@ -542,7 +542,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { waitTimerLastRunDate = new Date(); if (logger.isDebugEnabled()) { - logger.debug("DesignatedWaiter.run (designatedPdp == null) waitTimerLastRunDate = {}", + logger.debug("DesignatedWaiter.run (designatedPdp == null) waitTimerLastRunDate = {}", waitTimerLastRunDate); } myPdp.setUpdatedDate(waitTimerLastRunDate); @@ -599,7 +599,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { myPdp.getPdpId(), e1); } - } + } waitTimerLastRunDate = new Date(); if (logger.isDebugEnabled()) { logger.debug("DesignatedWaiter.run (designatedPdp.getPdpId().equals(myPdp.getPdpId())) " @@ -635,7 +635,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { /** * Sanitize designated list. - * + * * @param listOfDesignated list of designated pdps * @return list of drools pdps */ @@ -646,7 +646,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { List<DroolsPdp> listForRemoval = new ArrayList<>(); for (DroolsPdp pdp : listOfDesignated) { if (logger.isDebugEnabled()) { - logger.debug("DesignatedWaiter.run sanitizing: pdp = {}" + logger.debug("DesignatedWaiter.run sanitizing: pdp = {}" + " isDesignated = {}",pdp.getPdpId(), pdp.isDesignated()); } if (pdp.isDesignated()) { @@ -665,7 +665,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { /** * Compute most recent primary. - * + * * @param pdps collection of pdps * @param listOfDesignated list of designated pdps * @return drools pdp object @@ -689,14 +689,14 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { //Only one or none is designated or hot standby. Choose the latest designated date for (DroolsPdp pdp : pdps) { if (logger.isDebugEnabled()) { - logger.debug("DesignatedWaiter.run pdp = {}" - + " pdp.getDesignatedDate() = {}", + logger.debug("DesignatedWaiter.run pdp = {}" + + " pdp.getDesignatedDate() = {}", pdp.getPdpId(), pdp.getDesignatedDate()); } if (pdp.getDesignatedDate().compareTo(mostRecentPrimary.getDesignatedDate()) > 0) { mostRecentPrimary = pdp; if (logger.isDebugEnabled()) { - logger.debug("DesignatedWaiter.run mostRecentPrimary = {}", + logger.debug("DesignatedWaiter.run mostRecentPrimary = {}", mostRecentPrimary.getPdpId()); } } @@ -732,14 +732,14 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { if (logger.isDebugEnabled()) { logger.debug("DesignatedWainter.run: Some but not all are designated or hot standby. "); } - //Some but not all are designated or hot standby. + //Some but not all are designated or hot standby. if (containsDesignated) { if (logger.isDebugEnabled()) { logger.debug("DesignatedWainter.run: containsDesignated = {}", containsDesignated); } /* * The list only contains designated. This is a problem. It is most likely a race - * condition that resulted in two thinking they should be designated. Choose the + * condition that resulted in two thinking they should be designated. Choose the * site with the latest designated date for the pdp not included on the designated list. * This should be the site that had the last designation before this race condition * occurred. @@ -775,7 +775,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { /** * Compue designated pdp. - * + * * @param listOfDesignated list of designated pdps * @param mostRecentPrimary most recent primary pdpd * @return drools pdp object @@ -785,7 +785,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { DroolsPdp lowestPriorityPdp = null; if (listOfDesignated.size() > 1) { if (logger.isDebugEnabled()) { - logger.debug("DesignatedWaiter.run: myPdp: {} listOfDesignated.size(): {}", myPdp.getPdpId(), + logger.debug("DesignatedWaiter.run: myPdp: {} listOfDesignated.size(): {}", myPdp.getPdpId(), listOfDesignated.size()); } DroolsPdp rejectedPdp = null; @@ -805,7 +805,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { } if (pdp.comparePriority(lowestPrioritySameSite) < 0) { if (logger.isDebugEnabled()) { - logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {}" + logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {}" + " has lower priority than pdp ID: {}",myPdp.getPdpId(), pdp.getPdpId(), lowestPrioritySameSite.getPdpId()); } @@ -815,7 +815,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { } else { //we need to reject pdp and keep lowestPrioritySameSite if (logger.isDebugEnabled()) { - logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {} " + logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {} " + " has higher priority than pdp ID: {}", myPdp.getPdpId(),pdp.getPdpId(), lowestPrioritySameSite.getPdpId()); } @@ -836,7 +836,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { } if (pdp.comparePriority(lowestPriorityDifferentSite) < 0) { if (logger.isDebugEnabled()) { - logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {}" + logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {}" + " has lower priority than pdp ID: {}", myPdp.getPdpId(), pdp.getPdpId(), lowestPriorityDifferentSite.getPdpId()); } @@ -846,7 +846,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { } else { //we need to reject pdp and keep lowestPriorityDifferentSite if (logger.isDebugEnabled()) { - logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {}" + logger.debug("\nDesignatedWaiter.run: myPdp {} listOfDesignated pdp ID: {}" + " has higher priority than pdp ID: {}", myPdp.getPdpId(), pdp.getPdpId(), lowestPriorityDifferentSite.getPdpId()); } @@ -858,8 +858,8 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { // for demoting itself if (rejectedPdp != null && nullSafeEquals(rejectedPdp.getPdpId(),myPdp.getPdpId())) { if (logger.isDebugEnabled()) { - logger.debug("\n\nDesignatedWaiter.run: myPdp: {} listOfDesignated myPdp ID: {}" - + " is NOT the lowest priority. Executing stateManagement.demote()\n\n", + logger.debug("\n\nDesignatedWaiter.run: myPdp: {} listOfDesignated myPdp ID: {}" + + " is NOT the lowest priority. Executing stateManagement.demote()\n\n", myPdp.getPdpId(), myPdp.getPdpId()); } @@ -871,7 +871,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { pdpsConnector.setDesignated(myPdp, false); isDesignated = false; String standbyStatus = stateManagementFeature.getStandbyStatus(); - if (!(standbyStatus.equals(StateManagement.HOT_STANDBY) + if (!(standbyStatus.equals(StateManagement.HOT_STANDBY) || standbyStatus.equals(StateManagement.COLD_STANDBY))) { /* * Only call demote if it is not already in the right state. Don't worry about @@ -885,7 +885,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { pdpsConnector.setDesignated(myPdp, false); isDesignated = false; logger.error("DesignatedWaiter.run: myPdp: {} Caught Exception attempting to " - + "demote myPdp {} myPdp.getPdpId(), message= {}", myPdp.getPdpId(), + + "demote myPdp {} myPdp.getPdpId(), message= {}", myPdp.getPdpId(), e); } } @@ -898,7 +898,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { //now we have a valid value for lowestPriorityPdp if (logger.isDebugEnabled()) { logger.debug("\n\nDesignatedWaiter.run: myPdp: {} listOfDesignated " - + "found the LOWEST priority pdp ID: {} " + + "found the LOWEST priority pdp ID: {} " + " It is now the designatedPpd from the perspective of myPdp ID: {} \n\n", myPdp.getPdpId(), lowestPriorityPdp.getPdpId(), myPdp); } @@ -937,7 +937,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { } } } - + @Override public void checkThreadStatus() { checkWaitTimer(); @@ -953,24 +953,24 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { long nowMs = now.getTime(); long waitTimerMs = waitTimerLastRunDate.getTime(); - //give it 10 times leeway + //give it 10 times leeway if ((nowMs - waitTimerMs) > 10 * pdpUpdateInterval) { if (allSeemsWell == null || allSeemsWell) { allSeemsWell = false; if (logger.isDebugEnabled()) { logger.debug("checkWaitTimer: calling allSeemsWell with ALLNOTWELL param"); } - stateManagementFeature.allSeemsWell(this.getClass().getName(), - StateManagementFeatureAPI.ALLNOTWELL_STATE, + stateManagementFeature.allSeemsWell(this.getClass().getName(), + StateManagementFeatureApi.ALLNOTWELL_STATE, "DesignationWaiter/ElectionHandler has STALLED"); } - logger.error("checkWaitTimer: nowMs - waitTimerMs = {}" + logger.error("checkWaitTimer: nowMs - waitTimerMs = {}" + ", exceeds 10* pdpUpdateInterval = {}" + " DesignationWaiter is STALLED!", (nowMs - waitTimerMs), (10 * pdpUpdateInterval)); } else if (allSeemsWell == null || !allSeemsWell) { allSeemsWell = true; - stateManagementFeature.allSeemsWell(this.getClass().getName(), - StateManagementFeatureAPI.ALLSEEMSWELL_STATE, + stateManagementFeature.allSeemsWell(this.getClass().getName(), + StateManagementFeatureApi.ALLSEEMSWELL_STATE, "DesignationWaiter/ElectionHandler has RESUMED"); logger.info("DesignationWaiter/ElectionHandler has RESUMED"); } 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 0c04e3d9..55ab7c55 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 @@ -46,7 +46,7 @@ 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.core.PolicySessionFeatureApi; -import org.onap.policy.drools.statemanagement.StateManagementFeatureAPI; +import org.onap.policy.drools.statemanagement.StateManagementFeatureApi; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -234,8 +234,8 @@ public class AllSeemsWellTest { // Now we want to create a StateManagementFeature and initialize it. It will be // discovered by the ActiveStandbyFeature when the election handler initializes. - StateManagementFeatureAPI stateManagementFeatureApi = null; - for (StateManagementFeatureAPI feature : StateManagementFeatureAPI.impl.getList()) { + StateManagementFeatureApi stateManagementFeatureApi = null; + for (StateManagementFeatureApi feature : stateManagementFeatureApi.impl.getList()) { ((PolicySessionFeatureApi) feature).globalInit(null, configDir); stateManagementFeatureApi = feature; logger.debug("testAllSeemsWell stateManagementFeature.getResourceName(): {}", @@ -244,13 +244,13 @@ public class AllSeemsWellTest { } if (stateManagementFeatureApi == null) { logger.error("testAllSeemsWell failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); logger.debug("testAllSeemsWell failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); } - final StateManagementFeatureAPI smf = stateManagementFeatureApi; + final StateManagementFeatureApi smf = stateManagementFeatureApi; // Create an ActiveStandbyFeature and initialize it. It will discover the StateManagementFeature // that has been created. 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 ac4269a9..b07ab76c 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 @@ -7,9 +7,9 @@ * 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. @@ -53,7 +53,7 @@ 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.core.PolicySessionFeatureApi; -import org.onap.policy.drools.statemanagement.StateManagementFeatureAPI; +import org.onap.policy.drools.statemanagement.StateManagementFeatureApi; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -61,26 +61,26 @@ import org.slf4j.LoggerFactory; * All JUnits are designed to run in the local development environment * where they have write privileges and can execute time-sensitive * tasks. - * + * * These tests can be run as JUnits, but there is some issue with running them * as part of a "mvn install" build. Also, they take a very long time to run * due to many real time breaks. Consequently, they are marked as @Ignore and * only run from the desktop. - */ - + */ + public class StandbyStateManagementTest { private static final Logger logger = LoggerFactory.getLogger(StandbyStateManagementTest.class); /* - * Currently, the DroolsPdpsElectionHandler.DesignationWaiter is invoked every 1 seconds, starting + * Currently, the DroolsPdpsElectionHandler.DesignationWaiter is invoked every 1 seconds, starting * at the start of the next multiple of pdpUpdateInterval, but with a minimum of 5 sec cushion - * to ensure that we wait for the DesignationWaiter to do its job, before + * to ensure that we wait for the DesignationWaiter to do its job, before * checking the results. Add a few seconds for safety - */ + */ long sleepTime = 10000; /* - * DroolsPdpsElectionHandler runs every 1 seconds, so a 6 second sleep should be + * DroolsPdpsElectionHandler runs every 1 seconds, so a 6 second sleep should be * plenty to ensure it has time to re-promote this PDP. */ @@ -106,7 +106,7 @@ public class StandbyStateManagementTest { /** * Setup the class. - * + * * @throws Exception exception */ @BeforeClass @@ -125,7 +125,7 @@ public class StandbyStateManagementTest { /** * Setup. - * + * * @throws Exception exception */ @Before @@ -158,7 +158,7 @@ public class StandbyStateManagementTest { /** * Clean up the xacml database. - * + * */ public void cleanXacmlDb() { et = emx.getTransaction(); @@ -186,21 +186,21 @@ public class StandbyStateManagementTest { } /* - * These JUnit tests must be run one at a time in an eclipse environment - * by right-clicking StandbyStateManagementTest and selecting - * "Run As" -> "JUnit Test". - * - * They will run successfully when you run all of them under runAllTests(), - * however, you will get all sorts of non-fatal errors in the log and on the - * console that result from overlapping threads that are not terminated at the - * end of each test. The problem is that the JUnit environment does not terminate + * These JUnit tests must be run one at a time in an eclipse environment + * by right-clicking StandbyStateManagementTest and selecting + * "Run As" -> "JUnit Test". + * + * They will run successfully when you run all of them under runAllTests(), + * however, you will get all sorts of non-fatal errors in the log and on the + * console that result from overlapping threads that are not terminated at the + * end of each test. The problem is that the JUnit environment does not terminate * all the test threads between tests. This is true even if you break each JUnit - * into a separate file. Consequently, all the tests would have to be refactored - * so all test object initializations are coordinated. In other words, you - * retrieve the ActiveStandbyFeature instance and other class instances only once - * at the beginning of the JUnits and then reuse them throughout the tests. + * into a separate file. Consequently, all the tests would have to be refactored + * so all test object initializations are coordinated. In other words, you + * retrieve the ActiveStandbyFeature instance and other class instances only once + * at the beginning of the JUnits and then reuse them throughout the tests. * Initialization of the state of the objects is pretty straight forward as it - * just amounts to manipulating the entries in StateManagementEntity and + * just amounts to manipulating the entries in StateManagementEntity and * DroolsPdpEntity tables. However, some thought needs to be given to how to * "pause" the processing in ActiveStandbyFeature class. I think we could "pause" * it by calling globalInit() which will, I think, restart it. So long as it @@ -218,7 +218,7 @@ public class StandbyStateManagementTest { testHotStandby1(); testHotStandby2(); testLocking1(); - testLocking2(); + testLocking2(); testPmStandbyStateChangeNotifier(); testSanitizeDesignatedList(); testComputeMostRecentPrimary(); @@ -227,7 +227,7 @@ public class StandbyStateManagementTest { /** * Test the standby state change notifier. - * + * * @throws Exception exception */ //@Ignore @@ -311,7 +311,7 @@ public class StandbyStateManagementTest { /** * Test sanitize designated list. - * + * * @throws Exception exception */ //@Ignore @@ -351,20 +351,20 @@ public class StandbyStateManagementTest { // Now we want to create a StateManagementFeature and initialize it. It will be // discovered by the ActiveStandbyFeature when the election handler initializes. - StateManagementFeatureAPI stateManagementFeature = null; - for (StateManagementFeatureAPI feature : StateManagementFeatureAPI.impl.getList()) { + StateManagementFeatureApi stateManagementFeature = null; + for (StateManagementFeatureApi feature : StateManagementFeatureApi.impl.getList()) { ((PolicySessionFeatureApi) feature).globalInit(null, configDir); stateManagementFeature = feature; - logger.debug("testColdStandby stateManagementFeature.getResourceName(): {}", + logger.debug("testColdStandby stateManagementFeature.getResourceName(): {}", stateManagementFeature.getResourceName()); break; } if (stateManagementFeature == null) { logger.error("testColdStandby failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); logger.debug("testColdStandby failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); } @@ -384,7 +384,7 @@ public class StandbyStateManagementTest { listOfDesignated = droolsPdpsElectionHandler.santizeDesignatedList(listOfDesignated); - logger.debug("\n\ntestSanitizeDesignatedList: listOfDesignated.size after 2 designated = {}\n\n", + logger.debug("\n\ntestSanitizeDesignatedList: listOfDesignated.size after 2 designated = {}\n\n", listOfDesignated.size()); assertTrue(listOfDesignated.size() == 2); @@ -401,7 +401,7 @@ public class StandbyStateManagementTest { listOfDesignated = droolsPdpsElectionHandler.santizeDesignatedList(listOfDesignated); - logger.debug("\n\ntestSanitizeDesignatedList: listOfDesignated.size after all designated = {}\n\n", + logger.debug("\n\ntestSanitizeDesignatedList: listOfDesignated.size after all designated = {}\n\n", listOfDesignated.size()); assertTrue(listOfDesignated.size() == 4); @@ -410,7 +410,7 @@ public class StandbyStateManagementTest { /** * Test Compute most recent primary. - * + * * @throws Exception exception */ //@Ignore @@ -464,26 +464,26 @@ public class StandbyStateManagementTest { listOfDesignated.add(pdp3); listOfDesignated.add(pdp4); - // Because the way we sanitize the listOfDesignated, it will always contain all hot standby + // Because the way we sanitize the listOfDesignated, it will always contain all hot standby // or all designated members. // Now we want to create a StateManagementFeature and initialize it. It will be // discovered by the ActiveStandbyFeature when the election handler initializes. - StateManagementFeatureAPI stateManagementFeature = null; - for (StateManagementFeatureAPI feature : StateManagementFeatureAPI.impl.getList()) { + StateManagementFeatureApi stateManagementFeature = null; + for (StateManagementFeatureApi feature : StateManagementFeatureApi.impl.getList()) { ((PolicySessionFeatureApi) feature).globalInit(null, configDir); stateManagementFeature = feature; - logger.debug("testComputeMostRecentPrimary stateManagementFeature.getResourceName(): {}", + logger.debug("testComputeMostRecentPrimary stateManagementFeature.getResourceName(): {}", stateManagementFeature.getResourceName()); break; } if (stateManagementFeature == null) { logger.error("testComputeMostRecentPrimary failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); logger.debug("testComputeMostRecentPrimary failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); } @@ -492,11 +492,11 @@ public class StandbyStateManagementTest { DroolsPdp mostRecentPrimary = droolsPdpsElectionHandler.computeMostRecentPrimary( listOfAllPdps, listOfDesignated); - logger.debug("\n\ntestComputeMostRecentPrimary: mostRecentPrimary.getPdpId() = {}\n\n", + logger.debug("\n\ntestComputeMostRecentPrimary: mostRecentPrimary.getPdpId() = {}\n\n", mostRecentPrimary.getPdpId()); - // If all of the pdps are included in the listOfDesignated and none are designated, it will choose + // If all of the pdps are included in the listOfDesignated and none are designated, it will choose // the one which has the most recent designated date. @@ -514,11 +514,11 @@ public class StandbyStateManagementTest { mostRecentPrimary = droolsPdpsElectionHandler.computeMostRecentPrimary(listOfAllPdps, listOfDesignated); logger.debug("\n\ntestComputeMostRecentPrimary: All designated all on list, " - + "mostRecentPrimary.getPdpId() = {}\n\n", + + "mostRecentPrimary.getPdpId() = {}\n\n", mostRecentPrimary.getPdpId()); - // If all of the pdps are included in the listOfDesignated and all are designated, it will choose + // If all of the pdps are included in the listOfDesignated and all are designated, it will choose // the one which was designated first @@ -537,7 +537,7 @@ public class StandbyStateManagementTest { mostRecentPrimary = droolsPdpsElectionHandler.computeMostRecentPrimary(listOfAllPdps, listOfDesignated); - logger.debug("\n\ntestComputeMostRecentPrimary: mostRecentPrimary.getPdpId() = {}\n\n", + logger.debug("\n\ntestComputeMostRecentPrimary: mostRecentPrimary.getPdpId() = {}\n\n", mostRecentPrimary.getPdpId()); assertTrue(mostRecentPrimary.getPdpId().equals("pdp4")); @@ -553,13 +553,13 @@ public class StandbyStateManagementTest { mostRecentPrimary = droolsPdpsElectionHandler.computeMostRecentPrimary(listOfAllPdps, listOfDesignated); - logger.debug("\n\ntestComputeMostRecentPrimary: 2 on list mostRecentPrimary.getPdpId() = {}\n\n", + logger.debug("\n\ntestComputeMostRecentPrimary: 2 on list mostRecentPrimary.getPdpId() = {}\n\n", mostRecentPrimary.getPdpId()); assertTrue(mostRecentPrimary.getPdpId().equals("pdp4")); - // If we have only one pdp on in the listOfDesignated, + // If we have only one pdp on in the listOfDesignated, // the most recently designated pdp will be chosen, regardless // of its designation status @@ -568,7 +568,7 @@ public class StandbyStateManagementTest { mostRecentPrimary = droolsPdpsElectionHandler.computeMostRecentPrimary(listOfAllPdps, listOfDesignated); - logger.debug("\n\ntestComputeMostRecentPrimary: 1 on list mostRecentPrimary.getPdpId() = {}\n\n", + logger.debug("\n\ntestComputeMostRecentPrimary: 1 on list mostRecentPrimary.getPdpId() = {}\n\n", mostRecentPrimary.getPdpId()); assertTrue(mostRecentPrimary.getPdpId().equals("pdp4")); @@ -581,7 +581,7 @@ public class StandbyStateManagementTest { mostRecentPrimary = droolsPdpsElectionHandler.computeMostRecentPrimary(listOfAllPdps, listOfDesignated); - logger.debug("\n\ntestComputeMostRecentPrimary: 0 on list mostRecentPrimary.getPdpId() = {}\n\n", + logger.debug("\n\ntestComputeMostRecentPrimary: 0 on list mostRecentPrimary.getPdpId() = {}\n\n", mostRecentPrimary.getPdpId()); assertTrue(mostRecentPrimary.getPdpId().equals("pdp4")); @@ -590,7 +590,7 @@ public class StandbyStateManagementTest { /** * Test compute designated PDP. - * + * * @throws Exception exception */ //@Ignore @@ -652,20 +652,20 @@ public class StandbyStateManagementTest { // Now we want to create a StateManagementFeature and initialize it. It will be // discovered by the ActiveStandbyFeature when the election handler initializes. - StateManagementFeatureAPI stateManagementFeature = null; - for (StateManagementFeatureAPI feature : StateManagementFeatureAPI.impl.getList()) { + StateManagementFeatureApi stateManagementFeature = null; + for (StateManagementFeatureApi feature : StateManagementFeatureApi.impl.getList()) { ((PolicySessionFeatureApi) feature).globalInit(null, configDir); stateManagementFeature = feature; - logger.debug("testComputeDesignatedPdp stateManagementFeature.getResourceName(): {}", + logger.debug("testComputeDesignatedPdp stateManagementFeature.getResourceName(): {}", stateManagementFeature.getResourceName()); break; } if (stateManagementFeature == null) { logger.error("testComputeDesignatedPdp failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); logger.debug("testComputeDesignatedPdp failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); } @@ -726,7 +726,7 @@ public class StandbyStateManagementTest { /** * Test cold standby. - * + * * @throws Exception exception */ //@Ignore @@ -774,7 +774,7 @@ public class StandbyStateManagementTest { * or coldstandby,the Active/Standby selection algorithm must stand down * if thePDP-D is currently the lead/active node and allow another PDP-D * to take over. - * + * * It must also call lock on all engines in the engine management. */ @@ -792,8 +792,8 @@ public class StandbyStateManagementTest { // Now we want to create a StateManagementFeature and initialize it. It will be // discovered by the ActiveStandbyFeature when the election handler initializes. - StateManagementFeatureAPI smf = null; - for (StateManagementFeatureAPI feature : StateManagementFeatureAPI.impl.getList()) { + StateManagementFeatureApi smf = null; + for (StateManagementFeatureApi feature : StateManagementFeatureApi.impl.getList()) { ((PolicySessionFeatureApi) feature).globalInit(null, configDir); smf = feature; logger.debug("testColdStandby stateManagementFeature.getResourceName(): {}", smf.getResourceName()); @@ -801,10 +801,10 @@ public class StandbyStateManagementTest { } if (smf == null) { logger.error("testColdStandby failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); logger.debug("testColdStandby failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); } @@ -814,7 +814,7 @@ public class StandbyStateManagementTest { for (ActiveStandbyFeatureApi feature : ActiveStandbyFeatureApi.impl.getList()) { ((PolicySessionFeatureApi) feature).globalInit(null, configDir); activeStandbyFeature = feature; - logger.debug("testColdStandby activeStandbyFeature.getResourceName(): {}", + logger.debug("testColdStandby activeStandbyFeature.getResourceName(): {}", activeStandbyFeature.getResourceName()); break; } @@ -864,7 +864,7 @@ public class StandbyStateManagementTest { /** * Test hot standby 1. - * + * * @throws Exception exception */ //@Ignore @@ -901,7 +901,7 @@ public class StandbyStateManagementTest { conn.deleteAllPdps(); /* - * Insert this PDP as not designated. Initial standby state will be + * Insert this PDP as not designated. Initial standby state will be * either null or cold standby. Demoting should transit state to * hot standby. */ @@ -923,8 +923,8 @@ public class StandbyStateManagementTest { // Now we want to create a StateManagementFeature and initialize it. It will be // discovered by the ActiveStandbyFeature when the election handler initializes. - StateManagementFeatureAPI smf = null; - for (StateManagementFeatureAPI feature : StateManagementFeatureAPI.impl.getList()) { + StateManagementFeatureApi smf = null; + for (StateManagementFeatureApi feature : StateManagementFeatureApi.impl.getList()) { ((PolicySessionFeatureApi) feature).globalInit(null, configDir); smf = feature; logger.debug("testHotStandby1 stateManagementFeature.getResourceName(): {}", smf.getResourceName()); @@ -932,10 +932,10 @@ public class StandbyStateManagementTest { } if (smf == null) { logger.error("testHotStandby1 failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); logger.debug("testHotStandby1 failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); } @@ -945,7 +945,7 @@ public class StandbyStateManagementTest { for (ActiveStandbyFeatureApi feature : ActiveStandbyFeatureApi.impl.getList()) { ((PolicySessionFeatureApi) feature).globalInit(null, configDir); activeStandbyFeature = feature; - logger.debug("testHotStandby1 activeStandbyFeature.getResourceName(): {}", + logger.debug("testHotStandby1 activeStandbyFeature.getResourceName(): {}", activeStandbyFeature.getResourceName()); break; } @@ -993,7 +993,7 @@ public class StandbyStateManagementTest { /** * Test hot standby 2. - * + * * @throws Exception exception */ //@Ignore @@ -1044,7 +1044,7 @@ public class StandbyStateManagementTest { /* * Promote the designated PDP. - * + * * We have a chicken and egg problem here: we need a StateManagement * object to invoke the deleteAllStateManagementEntities method. */ @@ -1062,7 +1062,7 @@ public class StandbyStateManagementTest { // is providing service. /* - * Insert this PDP as not designated. Initial standby state will be + * Insert this PDP as not designated. Initial standby state will be * either null or cold standby. Demoting should transit state to * hot standby. */ @@ -1080,8 +1080,8 @@ public class StandbyStateManagementTest { // Now we want to create a StateManagementFeature and initialize it. It will be // discovered by the ActiveStandbyFeature when the election handler initializes. - StateManagementFeatureAPI sm2 = null; - for (StateManagementFeatureAPI feature : StateManagementFeatureAPI.impl.getList()) { + StateManagementFeatureApi sm2 = null; + for (StateManagementFeatureApi feature : StateManagementFeatureApi.impl.getList()) { ((PolicySessionFeatureApi) feature).globalInit(null, configDir); sm2 = feature; logger.debug("testHotStandby2 stateManagementFeature.getResourceName(): {}", sm2.getResourceName()); @@ -1089,10 +1089,10 @@ public class StandbyStateManagementTest { } if (sm2 == null) { logger.error("testHotStandby2 failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); logger.debug("testHotStandby2 failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); } @@ -1102,7 +1102,7 @@ public class StandbyStateManagementTest { for (ActiveStandbyFeatureApi feature : ActiveStandbyFeatureApi.impl.getList()) { ((PolicySessionFeatureApi) feature).globalInit(null, configDir); activeStandbyFeature = feature; - logger.debug("testHotStandby2 activeStandbyFeature.getResourceName(): {}", + logger.debug("testHotStandby2 activeStandbyFeature.getResourceName(): {}", activeStandbyFeature.getResourceName()); break; } @@ -1165,24 +1165,24 @@ public class StandbyStateManagementTest { /* * 1) Inserts and designates this PDP, then verifies that startTransaction * is successful. - * + * * 2) Demotes PDP, and verifies that because there is only one PDP, it will * be immediately re-promoted, thus allowing startTransaction to be * successful. - * + * * 3) Locks PDP and verifies that startTransaction results in * AdministrativeStateException. - * + * * 4) Unlocks PDP and verifies that startTransaction results in * StandbyStatusException. - * + * * 5) Promotes PDP and verifies that startTransaction is once again * successful. */ /** * Test locking. - * + * * @throws Exception exception */ //@Ignore @@ -1218,9 +1218,9 @@ public class StandbyStateManagementTest { conn.deleteAllPdps(); /* - * Insert this PDP as designated. Initial standby state will be + * Insert this PDP as designated. Initial standby state will be * either null or cold standby. - */ + */ logger.debug("testLocking1: Inserting PDP= {} as designated", thisPdpId); DroolsPdpImpl pdp = new DroolsPdpImpl(thisPdpId, true, 4, new Date()); @@ -1237,8 +1237,8 @@ public class StandbyStateManagementTest { // Now we want to create a StateManagementFeature and initialize it. It will be // discovered by the ActiveStandbyFeature when the election handler initializes. - StateManagementFeatureAPI sm = null; - for (StateManagementFeatureAPI feature : StateManagementFeatureAPI.impl.getList()) { + StateManagementFeatureApi sm = null; + for (StateManagementFeatureApi feature : StateManagementFeatureApi.impl.getList()) { ((PolicySessionFeatureApi) feature).globalInit(null, configDir); sm = feature; logger.debug("testLocking1 stateManagementFeature.getResourceName(): {}", sm.getResourceName()); @@ -1246,10 +1246,10 @@ public class StandbyStateManagementTest { } if (sm == null) { logger.error("testLocking1 failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); logger.debug("testLocking1 failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); } @@ -1259,7 +1259,7 @@ public class StandbyStateManagementTest { for (ActiveStandbyFeatureApi feature : ActiveStandbyFeatureApi.impl.getList()) { ((PolicySessionFeatureApi) feature).globalInit(null, configDir); activeStandbyFeature = feature; - logger.debug("testLocking1 activeStandbyFeature.getResourceName(): {}", + logger.debug("testLocking1 activeStandbyFeature.getResourceName(): {}", activeStandbyFeature.getResourceName()); break; } @@ -1281,7 +1281,7 @@ public class StandbyStateManagementTest { sm.promote(); logger.debug("testLocking1: Sleeping {} ms, to allow time for " - + "policy-management.Main class to come up, designated= {}", + + "policy-management.Main class to come up, designated= {}", sleepTime, conn.getPdp(thisPdpId).isDesignated()); sleep(sleepTime); @@ -1419,16 +1419,16 @@ public class StandbyStateManagementTest { /* * 1) Inserts and designates this PDP, then verifies that startTransaction * is successful. - * + * * 2) Inserts another PDP in hotstandby. - * + * * 3) Demotes this PDP, and verifies 1) that other PDP is not promoted (because one * PDP cannot promote another PDP) and 2) that this PDP is re-promoted. */ /** * Test locking 2. - * + * * @throws Exception exception */ //@Ignore @@ -1465,7 +1465,7 @@ public class StandbyStateManagementTest { conn.deleteAllPdps(); /* - * Insert this PDP as designated. Initial standby state will be + * Insert this PDP as designated. Initial standby state will be * either null or cold standby. Demoting should transit state to * hot standby. */ @@ -1485,8 +1485,8 @@ public class StandbyStateManagementTest { // Now we want to create a StateManagementFeature and initialize it. It will be // discovered by the ActiveStandbyFeature when the election handler initializes. - StateManagementFeatureAPI sm = null; - for (StateManagementFeatureAPI feature : StateManagementFeatureAPI.impl.getList()) { + StateManagementFeatureApi sm = null; + for (StateManagementFeatureApi feature : StateManagementFeatureApi.impl.getList()) { ((PolicySessionFeatureApi) feature).globalInit(null, configDir); sm = feature; logger.debug("testLocking2 stateManagementFeature.getResourceName(): {}", sm.getResourceName()); @@ -1494,10 +1494,10 @@ public class StandbyStateManagementTest { } if (sm == null) { logger.error("testLocking2 failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); logger.debug("testLocking2 failed to initialize. " - + "Unable to get instance of StateManagementFeatureAPI " + + "Unable to get instance of StateManagementFeatureApi " + "with resourceID: {}", thisPdpId); } @@ -1507,7 +1507,7 @@ public class StandbyStateManagementTest { for (ActiveStandbyFeatureApi feature : ActiveStandbyFeatureApi.impl.getList()) { ((PolicySessionFeatureApi) feature).globalInit(null, configDir); activeStandbyFeature = feature; - logger.debug("testLocking2 activeStandbyFeature.getResourceName(): {}", + logger.debug("testLocking2 activeStandbyFeature.getResourceName(): {}", activeStandbyFeature.getResourceName()); break; } @@ -1521,7 +1521,7 @@ public class StandbyStateManagementTest { } /* - * Insert another PDP as not designated. Initial standby state will be + * Insert another PDP as not designated. Initial standby state will be * either null or cold standby. Demoting should transit state to * hot standby. */ @@ -1532,7 +1532,7 @@ public class StandbyStateManagementTest { pdp = new DroolsPdpImpl(standbyPdpId, false, 4, yesterday); conn.insertPdp(pdp); droolsPdpEntity = conn.getPdp(standbyPdpId); - logger.debug("testLocking2: After insertion, PDP={} has DESIGNATED= {}", + logger.debug("testLocking2: After insertion, PDP={} has DESIGNATED= {}", standbyPdpId, droolsPdpEntity.isDesignated()); assertTrue(droolsPdpEntity.isDesignated() == false); |