From 56a15039437ba5bf5d0fb422551bfb12e1f59eb1 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 19 Jun 2020 14:32:10 -0400 Subject: Address checkstyle version issues in drools-pdp Also added serializationId to several classes to address eclipse warnings. Issue-ID: POLICY-2188 Change-Id: I3df5e8abaad8da9261c0d5cd19a93ed68dceb870 Signed-off-by: Jim Hahn --- .../policy/drools/activestandby/AllSeemsWellTest.java | 2 +- .../policy/drools/activestandby/DroolsPdpObjectTest.java | 11 ++++------- .../drools/activestandby/StandbyStateManagementTest.java | 16 ++++++++-------- 3 files changed, 13 insertions(+), 16 deletions(-) (limited to 'feature-active-standby-management/src/test/java/org/onap') diff --git a/feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/AllSeemsWellTest.java b/feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/AllSeemsWellTest.java index 9457ce18..0ce12dfc 100644 --- a/feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/AllSeemsWellTest.java +++ b/feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/AllSeemsWellTest.java @@ -119,7 +119,7 @@ public class AllSeemsWellTest { String userDir = System.getProperty("user.dir"); logger.debug("setUpClass: userDir={}", userDir); System.setProperty("com.sun.management.jmxremote.port", "9980"); - System.setProperty("com.sun.management.jmxremote.authenticate","false"); + System.setProperty("com.sun.management.jmxremote.authenticate", "false"); DroolsPdpsElectionHandler.setIsUnitTesting(true); diff --git a/feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/DroolsPdpObjectTest.java b/feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/DroolsPdpObjectTest.java index 3f4a31b2..78902ec7 100644 --- a/feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/DroolsPdpObjectTest.java +++ b/feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/DroolsPdpObjectTest.java @@ -21,7 +21,6 @@ package org.onap.policy.drools.activestandby; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import java.util.Date; @@ -29,8 +28,6 @@ import lombok.Getter; import lombok.Setter; import org.junit.Before; import org.junit.Test; -import org.onap.policy.drools.activestandby.DroolsPdp; -import org.onap.policy.drools.activestandby.DroolsPdpObject; public class DroolsPdpObjectTest { private static final String PDP_ID = "my-id"; @@ -50,19 +47,19 @@ public class DroolsPdpObjectTest { @Test public void testEqualsObject() { // self - assertEquals(pdp,pdp); + assertEquals(pdp, pdp); // same id MyPdp pdp2 = new MyPdp(); pdp2.setPdpId(PDP_ID); - assertEquals(pdp,pdp2); + assertEquals(pdp, pdp2); // different id pdp2.setPdpId(PDP_ID2); - assertNotEquals(pdp,pdp2); + assertNotEquals(pdp, pdp2); // different type of object - assertNotEquals(pdp,""); + assertNotEquals(pdp, ""); } @Test diff --git a/feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/StandbyStateManagementTest.java b/feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/StandbyStateManagementTest.java index 866ad5ef..52f8b27a 100644 --- a/feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/StandbyStateManagementTest.java +++ b/feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/StandbyStateManagementTest.java @@ -127,7 +127,7 @@ public class StandbyStateManagementTest { String userDir = System.getProperty("user.dir"); logger.debug("setUpClass: userDir={}", userDir); System.setProperty("com.sun.management.jmxremote.port", "9980"); - System.setProperty("com.sun.management.jmxremote.authenticate","false"); + System.setProperty("com.sun.management.jmxremote.authenticate", "false"); saveTime = Whitebox.getInternalState(MonitorTime.class, MONITOR_FIELD_NAME); saveFactory = Factory.getInstance(); @@ -359,7 +359,7 @@ public class StandbyStateManagementTest { listOfDesignated = droolsPdpsElectionHandler.santizeDesignatedList(listOfDesignated); - logger.debug("\n\ntestSanitizeDesignatedList: listOfDesignated.size = {}\n\n",listOfDesignated.size()); + logger.debug("\n\ntestSanitizeDesignatedList: listOfDesignated.size = {}\n\n", listOfDesignated.size()); assertEquals(4, listOfDesignated.size()); @@ -901,7 +901,7 @@ public class StandbyStateManagementTest { sm.deleteAllStateManagementEntities(); - sm = new StateManagement(emfx, activePdpId);//pdp2 + sm = new StateManagement(emfx, activePdpId); //pdp2 // Artificially putting a PDP into service is really a two step process, 1) // inserting it as designated and 2) promoting it so that its standbyStatus @@ -955,16 +955,16 @@ public class StandbyStateManagementTest { //At this point, the newly created pdp will have set the state to disabled/failed/cold standby //because it is stale. So, it cannot be promoted. We need to call sm.enableNotFailed() so we //can promote it and demote the other pdp - else the other pdp will just spring back to providingservice - sm.enableNotFailed();//pdp2 + sm.enableNotFailed(); //pdp2 sm.promote(); String standbyStatus = sm.getStandbyStatus(activePdpId); logger.info("testHotStandby2: After promoting, PDP= {} has standbyStatus= {}", activePdpId, standbyStatus); // demoting PDP should ensure that state transits to hotstandby logger.info("testHotStandby2: Runner started; demoting PDP= {}", thisPdpId); - sm2.demote();//pdp1 + sm2.demote(); //pdp1 standbyStatus = sm.getStandbyStatus(thisPdpId); - logger.info("testHotStandby2: After demoting, PDP={} has standbyStatus= {}",thisPdpId , standbyStatus); + logger.info("testHotStandby2: After demoting, PDP={} has standbyStatus= {}", thisPdpId, standbyStatus); logger.info("testHotStandby2: Sleeping {} ms, to allow JpaDroolsPdpsConnector " + "time to check droolspdpentity table", SLEEP_TIME); @@ -1079,7 +1079,7 @@ public class StandbyStateManagementTest { sleep(SLEEP_TIME); logger.debug("testLocking1: Waking up and invoking startTransaction on active PDP={}" - + ", designated= {}",thisPdpId, conn.getPdp(thisPdpId).isDesignated()); + + ", designated= {}", thisPdpId, conn.getPdp(thisPdpId).isDesignated()); IntegrityMonitor droolsPdpIntegrityMonitor = IntegrityMonitor.getInstance(); @@ -1133,7 +1133,7 @@ public class StandbyStateManagementTest { sleep(100); logger.debug("testLocking1: Invoking startTransaction on locked PDP= {}" - + ", designated= {}",thisPdpId, conn.getPdp(thisPdpId).isDesignated()); + + ", designated= {}", thisPdpId, conn.getPdp(thisPdpId).isDesignated()); try { droolsPdpIntegrityMonitor.startTransaction(); logger.error("testLocking1: startTransaction unexpectedly successful"); -- cgit 1.2.3-korg