Miscellaneous code clean up 86/98186/5
authorjhh <jorge.hernandez-herrero@att.com>
Fri, 8 Nov 2019 14:42:55 +0000 (08:42 -0600)
committerjhh <jorge.hernandez-herrero@att.com>
Fri, 8 Nov 2019 20:40:02 +0000 (14:40 -0600)
Issue-ID: POLICY-2203
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: I5731d4636bd2aaecbc486406298bcba1b19e8f4d
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
40 files changed:
api-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/ActiveStandbyFeatureApi.java
api-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeatureApi.java
feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdp.java
feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpsConnector.java
feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpsElectionHandler.java
feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/PmStandbyStateChangeNotifier.java
feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/ThreadRunningChecker.java
feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/AllSeemsWellTest.java
feature-active-standby-management/src/test/java/org/onap/policy/drools/activestandby/StandbyStateManagementTest.java
feature-controller-logging/src/test/java/org/onap/policy/drools/controller/logging/ControllerLoggingTest.java
feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/HealthCheck.java
feature-mdc-filters/src/test/java/org/onap/policy/drools/mdc/filters/MdcFilterFeatureTest.java
feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/CancellableScheduledTask.java
feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java
feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingManager.java
feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/extractor/Extractor.java
feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/StateTimerTask.java
feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java
feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java
feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/extractor/ClassExtractorsTest.java
feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/message/SupportBasicMessageTester.java
feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSession.java
feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSessionConnector.java
feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/GenSchema.java
feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/PersistenceFeatureTest.java
feature-test-transaction/src/main/java/org/onap/policy/drools/testtransaction/TestTransaction.java
policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java
policy-core/src/main/java/org/onap/policy/drools/core/PolicySessionFeatureApi.java
policy-core/src/main/java/org/onap/policy/drools/core/jmx/PdpJmxMBean.java
policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockManager.java
policy-core/src/main/java/org/onap/policy/drools/util/KieUtils.java
policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java
policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java
policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java
policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java
policy-management/src/main/java/org/onap/policy/drools/protocol/coders/EventProtocolCoder.java
policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java
policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java
policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsController3Test.java
policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java

index 5be1c52..751ca28 100644 (file)
@@ -35,7 +35,7 @@ public interface ActiveStandbyFeatureApi extends OrderedService {
      *
      * @return String (resourceName)
      */
-    public String getPdpdNowActive();
+    String getPdpdNowActive();
 
     /**
      * Returns the resourceName (PDP ID) for the Drools-PDP that is
@@ -43,12 +43,12 @@ public interface ActiveStandbyFeatureApi extends OrderedService {
      *
      * @return String (resourceName)
      */
-    public String getPdpdLastActive();
+    String getPdpdLastActive();
 
     /**
      * Returns the resourceName associated with this instance of the feature.
      *
      * @return String (resourceName)
      */
-    public String getResourceName();
+    String getResourceName();
 }
index d2c7b39..bdac688 100644 (file)
@@ -53,7 +53,7 @@ public interface StateManagementFeatureApi extends OrderedService, Lockable {
      *        problem that has resolved).
      * @throws AllSeemsWellException exception
      */
-    public void allSeemsWell(@NotNull String key, @NotNull Boolean asw, @NotNull String msg)
+    void allSeemsWell(@NotNull String key, @NotNull Boolean asw, @NotNull String msg)
             throws AllSeemsWellException;
 
     /**
@@ -61,35 +61,35 @@ public interface StateManagementFeatureApi extends OrderedService, Lockable {
      *
      * @param stateChangeObserver observer
      */
-    public void addObserver(Observer stateChangeObserver);
+    void addObserver(Observer stateChangeObserver);
 
     /**
      * Returns the X.731 Administrative State for this resource.
      *
      * @return String (locked, unlocked)
      */
-    public String getAdminState();
+    String getAdminState();
 
     /**
      * Returns the X.731 Operational State for this resource.
      *
      * @return String (enabled, disabled)
      */
-    public String getOpState();
+    String getOpState();
 
     /**
      * Returns the X.731 Availability Status for this resource.
      *
      * @return String (failed; dependency; dependency,failed)
      */
-    public String getAvailStatus();
+    String getAvailStatus();
 
     /**
      * Returns the X.731 Standby Status for this resource.
      *
      * @return String (providingservice, hotstandby or coldstandby)
      */
-    public String getStandbyStatus();
+    String getStandbyStatus();
 
     /**
      * Returns the X.731 Standby Status for the named resource
@@ -97,7 +97,7 @@ public interface StateManagementFeatureApi extends OrderedService, Lockable {
      * @param resourceName the resource name
      * @return String (providingservice, hotstandby or coldstandby)
      */
-    public String getStandbyStatus(String resourceName);
+    String getStandbyStatus(String resourceName);
 
     /**
      * This method moves the X.731 Operational State for the named resource into a value of disabled
@@ -107,7 +107,7 @@ public interface StateManagementFeatureApi extends OrderedService, Lockable {
      * @param resourceName resource name
      * @throws Exception exception
      */
-    public void disableFailed(String resourceName) throws Exception;
+    void disableFailed(String resourceName) throws Exception;
 
     /**
      * This method moves the X.731 Operational State for this resource into a value of disabled and
@@ -116,7 +116,7 @@ public interface StateManagementFeatureApi extends OrderedService, Lockable {
      *
      * @throws Exception exception
      */
-    public void disableFailed() throws Exception;
+    void disableFailed() throws Exception;
 
     /**
      * This method moves the X.731 Standby Status for this resource from hotstandby to
@@ -126,7 +126,7 @@ public interface StateManagementFeatureApi extends OrderedService, Lockable {
      *
      * @throws Exception exception
      */
-    public void promote() throws Exception;
+    void promote() throws Exception;
 
     /**
      * This method moves the X.731 Standby Status for this resource from providingservice to
@@ -135,7 +135,7 @@ public interface StateManagementFeatureApi extends OrderedService, Lockable {
      *
      * @throws Exception exception
      */
-    public void demote() throws Exception;
+    void demote() throws Exception;
 
     /**
      * Returns the resourceName associated with this instance of the
@@ -143,7 +143,7 @@ public interface StateManagementFeatureApi extends OrderedService, Lockable {
      *
      * @return String (resourceName)
      */
-    public String getResourceName();
+    String getResourceName();
 
     /**
      * This Lockable method will lock the StateManagement object Admin state.
@@ -151,7 +151,7 @@ public interface StateManagementFeatureApi extends OrderedService, Lockable {
      * @return true if successful, false otherwise
      */
     @Override
-    public boolean lock();
+    boolean lock();
 
     /**
      * This Lockable method will unlock the StateManagement object Admin state.
@@ -159,7 +159,7 @@ public interface StateManagementFeatureApi extends OrderedService, Lockable {
      * @return true if successfull, false otherwise
      */
     @Override
-    public boolean unlock();
+    boolean unlock();
 
     /**
      * This Lockable method indicates the Admin state StateManagement object.
@@ -167,5 +167,5 @@ public interface StateManagementFeatureApi extends OrderedService, Lockable {
      * @return true if locked, false otherwise
      */
     @Override
-    public boolean isLocked();
+    boolean isLocked();
 }
index 8fada96..12c7592 100644 (file)
@@ -24,27 +24,27 @@ import java.util.Date;
 
 public interface DroolsPdp {
 
-    public String getPdpId();
+    String getPdpId();
 
-    public boolean isDesignated();
+    boolean isDesignated();
 
-    public int getPriority();
+    int getPriority();
 
-    public Date getUpdatedDate();
+    Date getUpdatedDate();
 
-    public void setDesignated(boolean isDesignated);
+    void setDesignated(boolean isDesignated);
 
-    public void setUpdatedDate(Date updatedDate);
+    void setUpdatedDate(Date updatedDate);
 
-    public int comparePriority(DroolsPdp other);
+    int comparePriority(DroolsPdp other);
 
-    public int comparePriority(DroolsPdp other,String previousSite);
+    int comparePriority(DroolsPdp other, String previousSite);
 
-    public String getSite();
+    String getSite();
 
-    public void setSite(String site);
+    void setSite(String site);
 
-    public Date getDesignatedDate();
+    Date getDesignatedDate();
 
-    public void setDesignatedDate(Date designatedDate);
+    void setDesignatedDate(Date designatedDate);
 }
index fdb8737..6e06272 100644 (file)
@@ -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.
@@ -26,39 +26,39 @@ public interface DroolsPdpsConnector {
 
 
     //return a list of PDPs, NOT including this PDP
-    public Collection<DroolsPdp> getDroolsPdps();
+    Collection<DroolsPdp> getDroolsPdps();
 
-    public void update(DroolsPdp pdp);
+    void update(DroolsPdp pdp);
 
-    //determines if the DroolsPdp parameter is considered "current" or expired 
+    //determines if the DroolsPdp parameter is considered "current" or expired
     //(has it been too long since the Pdp sent an update)
-    public boolean isPdpCurrent(DroolsPdp pdp);
+    boolean isPdpCurrent(DroolsPdp pdp);
 
     // Updates DESIGNATED boolean in PDP record.
-    public void setDesignated(DroolsPdp pdp, boolean designated);
+    void setDesignated(DroolsPdp pdp, boolean designated);
 
     // Marks droolspdpentity.DESIGNATED=false, so another PDP-D will go active.
-    public void standDownPdp(String pdpId);
+    void standDownPdp(String pdpId);
 
     // This is used in a JUnit test environment to manually
     // insert a PDP
-    public void insertPdp(DroolsPdp pdp);
+    void insertPdp(DroolsPdp pdp);
 
     // This is used in a JUnit test environment to manually
     // delete a PDP
-    public void deletePdp(String pdpId);
+    void deletePdp(String pdpId);
 
     // This is used in a JUnit test environment to manually
     // clear the droolspdpentity table.
-    public void deleteAllPdps();
+    void deleteAllPdps();
 
     // This is used in a JUnit test environment to manually
     // get a PDP
-    public DroolsPdpEntity getPdp(String pdpId);
+    DroolsPdpEntity getPdp(String pdpId);
 
     // Used by DroolsPdpsElectionHandler to determine if the currently designated
     // PDP has failed.
-    public boolean hasDesignatedPdpFailed(Collection<DroolsPdp> pdps);
+    boolean hasDesignatedPdpFailed(Collection<DroolsPdp> pdps);
 
 
 }
index 5308cbe..37382e8 100644 (file)
@@ -49,14 +49,8 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
      */
     private static DroolsPdp myPdp;
 
-    private DesignationWaiter designationWaiter;
-    private Timer updateWorker;
-    private Timer waitTimer;
     private Date waitTimerLastRunDate;
 
-    // The interval between checks of the DesignationWaiter to be sure it is running.
-    private int pdpCheckInterval;
-
     // The interval between runs of the DesignationWaiter
     private int pdpUpdateInterval;
 
@@ -100,12 +94,14 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
         this.pdpsConnector = pdps;
         DroolsPdpsElectionHandler.myPdp = myPdp;
         this.isDesignated = false;
-        pdpCheckInterval = 3000;
+
+        // The interval between checks of the DesignationWaiter to be sure it is running.
+        int pdpCheckInterval = 3000;
         try {
             pdpCheckInterval = Integer.parseInt(ActiveStandbyProperties.getProperty(
                     ActiveStandbyProperties.PDP_CHECK_INVERVAL));
         } catch (Exception e) {
-            logger.error("Could not get pdpCheckInterval property. Using default {}",pdpCheckInterval, e);
+            logger.error("Could not get pdpCheckInterval property. Using default {}", pdpCheckInterval, e);
         }
         pdpUpdateInterval = 2000;
         try {
@@ -122,7 +118,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
 
         // Create the timer which will update the updateDate in DroolsPdpEntity table.
         // This is the heartbeat
-        updateWorker = Factory.getInstance().makeTimer();
+        Timer updateWorker = Factory.getInstance().makeTimer();
 
         // 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
@@ -130,12 +126,12 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker {
         updateWorker.scheduleAtFixedRate(new TimerUpdateClass(), 100, pdpCheckInterval);
 
         // Create the timer which will run the election algorithm
-        waitTimer = Factory.getInstance().makeTimer();
+        Timer waitTimer = Factory.getInstance().makeTimer();
 
         // 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();
+        DesignationWaiter designationWaiter = new DesignationWaiter();
         waitTimer.scheduleAtFixedRate(designationWaiter, startMs, pdpUpdateInterval);
         waitTimerLastRunDate = new Date(nowMs + startMs);
 
index 735e3a2..f350bb0 100644 (file)
@@ -64,7 +64,6 @@ public class PmStandbyStateChangeNotifier extends StateChangeNotifier {
     // get an instance of logger
     private static final Logger logger = LoggerFactory.getLogger(PmStandbyStateChangeNotifier.class);
     private Timer delayActivateTimer;
-    private int pdpUpdateInterval;
     private boolean isWaitingForActivation;
     private long startTimeWaitingForActivationMs;
     private long waitInterval;
@@ -81,8 +80,8 @@ public class PmStandbyStateChangeNotifier extends StateChangeNotifier {
      *
      */
     public PmStandbyStateChangeNotifier() {
-        pdpUpdateInterval =
-                Integer.parseInt(ActiveStandbyProperties.getProperty(ActiveStandbyProperties.PDP_UPDATE_INTERVAL));
+        int pdpUpdateInterval =
+            Integer.parseInt(ActiveStandbyProperties.getProperty(ActiveStandbyProperties.PDP_UPDATE_INTERVAL));
         isWaitingForActivation = false;
         startTimeWaitingForActivationMs = currentTime.getMillis();
         // delay the activate so the DesignatedWaiter can run twice - give it an extra 2 seconds
index cb7e4c3..2616ac3 100644 (file)
@@ -20,6 +20,7 @@
 
 package org.onap.policy.drools.activestandby;
 
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.mock;
@@ -262,7 +263,7 @@ public class AllSeemsWellTest {
         DroolsPdpEntity droolsPdpEntity = conn.getPdp(thisPdpId);
         logger.debug("testAllSeemsWell: After insertion, PDP={} has DESIGNATED={}",
                 thisPdpId, droolsPdpEntity.isDesignated());
-        assertTrue(droolsPdpEntity.isDesignated() == false);
+        assertFalse(droolsPdpEntity.isDesignated());
 
         logger.debug("testAllSeemsWell: Instantiating stateManagement object");
         StateManagement sm = new StateManagement(emfXacml, "dummy");
@@ -311,7 +312,7 @@ public class AllSeemsWellTest {
         droolsPdpEntity = conn.getPdp(thisPdpId);
         logger.debug("testAllSeemsWell: After sm.demote() invoked, DESIGNATED= {} "
                 + "for PDP= {}", droolsPdpEntity.isDesignated(), thisPdpId);
-        assertTrue(droolsPdpEntity.isDesignated() == true);
+        assertTrue(droolsPdpEntity.isDesignated());
         String standbyStatus = smf.getStandbyStatus(thisPdpId);
         logger.debug("testAllSeemsWell: After demotion, PDP= {} "
                 + "has standbyStatus= {}", thisPdpId, standbyStatus);
index 32648eb..f51d620 100644 (file)
@@ -20,6 +20,7 @@
 
 package org.onap.policy.drools.activestandby;
 
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.mock;
@@ -688,7 +689,7 @@ public class StandbyStateManagementTest {
         DroolsPdpEntity droolsPdpEntity = conn.getPdp(thisPdpId);
         logger.debug("testColdStandby: After insertion, DESIGNATED= {} "
                 + "for PDP= {}", droolsPdpEntity.isDesignated(), thisPdpId);
-        assertTrue(droolsPdpEntity.isDesignated() == true);
+        assertTrue(droolsPdpEntity.isDesignated());
 
         /*
          * When the Standby Status changes (from providingservice) to hotstandby
@@ -760,7 +761,7 @@ public class StandbyStateManagementTest {
         droolsPdpEntity = conn.getPdp(thisPdpId);
         logger.debug("testColdStandby: After lock sm.lock() invoked, "
                 + "DESIGNATED= {} for PDP={}", droolsPdpEntity.isDesignated(), thisPdpId);
-        assertTrue(droolsPdpEntity.isDesignated() == false);
+        assertFalse(droolsPdpEntity.isDesignated());
 
         logger.debug("\n\ntestColdStandby: Exiting\n\n");
     }
@@ -795,7 +796,7 @@ public class StandbyStateManagementTest {
         DroolsPdpEntity droolsPdpEntity = conn.getPdp(thisPdpId);
         logger.debug("testHotStandby1: After insertion, PDP={} has DESIGNATED={}",
                 thisPdpId, droolsPdpEntity.isDesignated());
-        assertTrue(droolsPdpEntity.isDesignated() == false);
+        assertFalse(droolsPdpEntity.isDesignated());
 
         logger.debug("testHotStandby1: Instantiating stateManagement object");
         StateManagement sm = new StateManagement(emfx, "dummy");
@@ -842,7 +843,7 @@ public class StandbyStateManagementTest {
         droolsPdpEntity = conn.getPdp(thisPdpId);
         logger.debug("testHotStandby1: After sm.demote() invoked, DESIGNATED= {} "
                 + "for PDP= {}", droolsPdpEntity.isDesignated(), thisPdpId);
-        assertTrue(droolsPdpEntity.isDesignated() == true);
+        assertTrue(droolsPdpEntity.isDesignated());
         String standbyStatus = smf.getStandbyStatus(thisPdpId);
         logger.debug("testHotStandby1: After demotion, PDP= {} "
                 + "has standbyStatus= {}", thisPdpId, standbyStatus);
@@ -883,7 +884,7 @@ public class StandbyStateManagementTest {
         DroolsPdpEntity droolsPdpEntity = conn.getPdp(activePdpId);
         logger.info("testHotStandby2: After insertion, PDP= {}, which is "
                 + "not current, has DESIGNATED= {}", activePdpId, droolsPdpEntity.isDesignated());
-        assertTrue(droolsPdpEntity.isDesignated() == true);
+        assertTrue(droolsPdpEntity.isDesignated());
 
         /*
          * Promote the designated PDP.
@@ -917,7 +918,7 @@ public class StandbyStateManagementTest {
         droolsPdpEntity = conn.getPdp(thisPdpId);
         logger.info("testHotStandby2: After insertion, PDP={} "
                 + "has DESIGNATED= {}", thisPdpId, droolsPdpEntity.isDesignated());
-        assertTrue(droolsPdpEntity.isDesignated() == false);
+        assertFalse(droolsPdpEntity.isDesignated());
 
 
         // Now we want to create a StateManagementFeature and initialize it.  It will be
@@ -976,7 +977,7 @@ public class StandbyStateManagementTest {
         logger.info("testHotStandby2: After demoting PDP={}"
                 + ", DESIGNATED= {}"
                 + " for PDP= {}", activePdpId, droolsPdpEntity.isDesignated(), thisPdpId);
-        assertTrue(droolsPdpEntity.isDesignated() == true);
+        assertTrue(droolsPdpEntity.isDesignated());
         standbyStatus = sm2.getStandbyStatus(thisPdpId);
         logger.info("testHotStandby2: After demoting PDP={}"
                 + ", PDP={} has standbyStatus= {}",
@@ -1032,7 +1033,7 @@ public class StandbyStateManagementTest {
         DroolsPdpEntity droolsPdpEntity = conn.getPdp(thisPdpId);
         logger.debug("testLocking1: After insertion, PDP= {} has DESIGNATED= {}",
                 thisPdpId, droolsPdpEntity.isDesignated());
-        assertTrue(droolsPdpEntity.isDesignated() == true);
+        assertTrue(droolsPdpEntity.isDesignated());
 
         logger.debug("testLocking1: Instantiating stateManagement object");
         StateManagement smDummy = new StateManagement(emfx, "dummy");
@@ -1237,7 +1238,7 @@ public class StandbyStateManagementTest {
         DroolsPdpEntity droolsPdpEntity = conn.getPdp(thisPdpId);
         logger.debug("testLocking2: After insertion, PDP= {} has DESIGNATED= {}",
                 thisPdpId, droolsPdpEntity.isDesignated());
-        assertTrue(droolsPdpEntity.isDesignated() == true);
+        assertTrue(droolsPdpEntity.isDesignated());
 
         logger.debug("testLocking2: Instantiating stateManagement object and promoting PDP={}", thisPdpId);
         StateManagement smDummy = new StateManagement(emfx, "dummy");
@@ -1281,7 +1282,7 @@ public class StandbyStateManagementTest {
         droolsPdpEntity = conn.getPdp(standbyPdpId);
         logger.debug("testLocking2: After insertion, PDP={} has DESIGNATED= {}",
                 standbyPdpId, droolsPdpEntity.isDesignated());
-        assertTrue(droolsPdpEntity.isDesignated() == false);
+        assertFalse(droolsPdpEntity.isDesignated());
 
         logger.debug("testLocking2: Demoting PDP= {}", standbyPdpId);
         final StateManagement sm2 = new StateManagement(emfx, standbyPdpId);
@@ -1347,8 +1348,7 @@ public class StandbyStateManagementTest {
         }
 
         logger.debug("testLocking2: Verifying designated status for PDP= {}", standbyPdpId);
-        boolean standbyPdpDesignated = conn.getPdp(standbyPdpId).isDesignated();
-        assertTrue(standbyPdpDesignated == false);
+        assertFalse(conn.getPdp(standbyPdpId).isDesignated());
 
         logger.debug("\n\ntestLocking2: Exiting\n\n");
     }
index 8c3e1c7..ecbb320 100755 (executable)
@@ -75,10 +75,6 @@ public class ControllerLoggingTest {
     private static final String TEST_TOPIC = "test-topic";
     private static final String TEST_SERVER = "http://test.com";
 
-    /**
-     * These are used for sending PDPD configuration notifications to a policy controller.
-     */
-    private static Properties controllerProps = null;
     private static String message = null;
     private static PdpdConfiguration pdpdNotification = null;
     private static PolicyController policyController = null;
@@ -110,14 +106,15 @@ public class ControllerLoggingTest {
         KieUtils.installArtifact(Paths.get(JUNIT_KMODULE_PATH).toFile(), Paths.get(JUNIT_KMODULE_POM_PATH).toFile(),
                         JUNIT_KJAR_DRL_PATH, Paths.get(JUNIT_KMODULE_DRL_PATH).toFile());
 
-        controllerProps = new Properties();
+        // These properties are used for sending PDPD configuration notifications to a policy controller.
+        Properties controllerProps = new Properties();
         controllerProps.put(DroolsPropertyConstants.PROPERTY_CONTROLLER_NAME, TEST_CONTROLLER_NAME);
         controllerProps.put(DroolsPropertyConstants.RULES_GROUPID, TEST_GROUP_ID);
         controllerProps.put(DroolsPropertyConstants.RULES_ARTIFACTID, TEST_ARTIFACT_ID);
         controllerProps.put(DroolsPropertyConstants.RULES_VERSION, TEST_VERSION);
 
-        policyController = PolicyEngineConstants.getManager().createPolicyController(TEST_CONTROLLER_NAME,
-                        controllerProps);
+        policyController =
+            PolicyEngineConstants.getManager().createPolicyController(TEST_CONTROLLER_NAME, controllerProps);
 
         message = "{\"requestID\":\"38adde30-cc22-11e8-a8d5-f2801f1b9fd1\",\"entity\":\"controller\",\"controllers\":"
                         + "[{\"name\":\"test-controller\",\"drools\":{\"groupId\":\"org.onap.policy.drools.test\","
index b1b28f7..b729799 100644 (file)
@@ -156,5 +156,5 @@ public interface HealthCheck extends Startable {
      *
      * @return a report
      */
-    public Reports healthCheck();
+    Reports healthCheck();
 }
index 51ff3e9..a8e0cf1 100755 (executable)
@@ -56,11 +56,6 @@ public class MdcFilterFeatureTest {
     private static final String TEST_TOPIC_A = "org.onap.policy.test-topic-a";
     private static final String TEST_TOPIC_B = "org.onap.policy.test-topic-b";
 
-    /**
-     * The mock PolicyController to be used for the junits.
-     */
-    private PolicyController controller;
-
     /**
      * The mock properties to be used for the junits.
      */
@@ -85,12 +80,14 @@ public class MdcFilterFeatureTest {
         message = new String(Files.readAllBytes(Paths.get("src/test/resources/onset.json")));
 
         props = mockFeatureProperties();
-        controller = mock(PolicyController.class);
 
         props.setProperty("dmaap.source.topics", TEST_TOPIC_A);
         props.setProperty("dmaap.source.topics." + TEST_TOPIC_A + ".servers", "http://testing123.com/");
         props.setProperty("noop.sink.topics", TEST_TOPIC_B);
 
+        // The mock PolicyController to be used for the junits.
+        PolicyController controller = mock(PolicyController.class);
+
         List<TopicSource> topicSources = TopicEndpointManager.getManager().addTopicSources(props);
         doReturn(topicSources).when(controller).getTopicSources();
 
index b16f44a..f0d3b26 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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.
@@ -29,5 +29,5 @@ public interface CancellableScheduledTask {
     /**
      * Cancels the scheduled task.
      */
-    public void cancel();
+    void cancel();
 }
index d4704af..da8a918 100644 (file)
@@ -339,7 +339,7 @@ public class PoolingFeature implements PolicyEngineFeatureApi, PolicyControllerF
          * @return {@code true} if the request was handled by the manager, {@code false} otherwise
          * @throws PoolingFeatureException feature exception
          */
-        public boolean apply(PoolingManagerImpl mgr) throws PoolingFeatureException;
+        boolean apply(PoolingManagerImpl mgr) throws PoolingFeatureException;
     }
 
     /**
index e8e0174..e3576b8 100644 (file)
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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.
@@ -33,108 +33,108 @@ public interface PoolingManager {
 
     /**
      * Gets the properties used to configure the manager.
-     * 
+     *
      * @return pooling properties
      */
-    public PoolingProperties getProperties();
+    PoolingProperties getProperties();
 
     /**
      * Gets the host id.
-     * 
+     *
      * @return the host id
      */
-    public String getHost();
+    String getHost();
 
     /**
      * Gets the name of the internal DMaaP topic used by this manager to communicate with
      * its other hosts.
-     * 
+     *
      * @return the name of the internal DMaaP topic
      */
-    public String getTopic();
+    String getTopic();
 
     /**
      * Starts distributing requests according to the given bucket assignments.
-     * 
+     *
      * @param assignments must <i>not</i> be {@code null}
      */
-    public void startDistributing(BucketAssignments assignments);
+    void startDistributing(BucketAssignments assignments);
 
     /**
      * Gets the current bucket assignments.
-     * 
+     *
      * @return the current bucket assignments, or {@code null} if no assignments have been
      *         made
      */
-    public BucketAssignments getAssignments();
+    BucketAssignments getAssignments();
 
     /**
      * Publishes a message to the internal topic on the administrative channel.
-     * 
+     *
      * @param msg message to be published
      */
-    public void publishAdmin(Message msg);
+    void publishAdmin(Message msg);
 
     /**
      * Publishes a message to the internal topic on a particular channel.
-     * 
+     *
      * @param channel channel on which the message should be published
      * @param msg message to be published
      */
-    public void publish(String channel, Message msg);
+    void publish(String channel, Message msg);
 
     /**
      * Handles a {@link Forward} event that was received from the internal topic.
-     * 
+     *
      * @param event event
      */
-    public void handle(Forward event);
+    void handle(Forward event);
 
     /**
      * Schedules a timer to fire after a delay.
-     * 
+     *
      * @param delayMs delay, in milliseconds
      * @param task task
      * @return a new scheduled task
      */
-    public CancellableScheduledTask schedule(long delayMs, StateTimerTask task);
+    CancellableScheduledTask schedule(long delayMs, StateTimerTask task);
 
     /**
      * Schedules a timer to fire repeatedly.
-     * 
+     *
      * @param initialDelayMs initial delay, in milliseconds
      * @param delayMs delay, in milliseconds
      * @param task task
      * @return a new scheduled task
      */
-    public CancellableScheduledTask scheduleWithFixedDelay(long initialDelayMs, long delayMs, StateTimerTask task);
+    CancellableScheduledTask scheduleWithFixedDelay(long initialDelayMs, long delayMs, StateTimerTask task);
 
     /**
      * Transitions to the "start" state.
-     * 
+     *
      * @return the new state
      */
-    public State goStart();
+    State goStart();
 
     /**
      * Transitions to the "query" state.
-     * 
+     *
      * @return the new state
      */
-    public State goQuery();
+    State goQuery();
 
     /**
      * Transitions to the "active" state.
-     * 
+     *
      * @return the new state
      */
-    public State goActive();
+    State goActive();
 
     /**
      * Transitions to the "inactive" state.
-     * 
+     *
      * @return the new state
      */
-    public State goInactive();
+    State goInactive();
 
 }
index 38d440c..5e02d60 100644 (file)
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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,9 +28,9 @@ public interface Extractor {
 
     /**
      * Extracts an object contained within another object.
-     * 
+     *
      * @param object object from which to extract the contained object
      * @return the extracted value, or {@code null} if it cannot be extracted
      */
-    public Object extract(Object object);
+    Object extract(Object object);
 }
index 346d449..e4607f8 100644 (file)
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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,9 +28,9 @@ public interface StateTimerTask {
 
     /**
      * Fires the timer.
-     * 
+     *
      * @return the new state, or {@code null} if the state is unchanged
      */
-    public State fire();
+    State fire();
 
 }
index 5768e1d..d51e61e 100644 (file)
@@ -1105,6 +1105,6 @@ public class FeatureTest {
     @FunctionalInterface
     private static interface VoidFunction {
 
-        public void apply();
+        void apply();
     }
 }
index a711a7e..5293b79 100644 (file)
@@ -95,7 +95,6 @@ public class PoolingManagerImplTest {
      */
     private Queue<ScheduledFuture<?>> futures;
 
-    private Properties plainProps;
     private PoolingProperties poolProps;
     private ListeningController controller;
     private ClassExtractors extractors;
@@ -111,12 +110,12 @@ public class PoolingManagerImplTest {
 
     /**
      * Setup.
-     * 
+     *
      * @throws Exception throws exception
      */
     @Before
     public void setUp() throws Exception {
-        plainProps = new Properties();
+        Properties plainProps = new Properties();
 
         poolProps = mock(PoolingProperties.class);
         when(poolProps.getSource()).thenReturn(plainProps);
index c277a00..0bf087a 100644 (file)
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * ONAP
  * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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.
@@ -412,7 +412,7 @@ public class ClassExtractorsTest {
      */
     private static interface WithString {
 
-        public String getStrValue();
+        String getStrValue();
     }
 
     /**
index 19e7ab0..8624783 100644 (file)
@@ -207,7 +207,7 @@ public abstract class SupportBasicMessageTester<T extends Message> {
 
     /**
      * Verifies that fields are set as expected by {@link #makeValidMessage()}.
-     * 
+     *
      * @param msg message whose fields are to be validated
      */
     public void testValidFields(T msg) {
@@ -217,7 +217,7 @@ public abstract class SupportBasicMessageTester<T extends Message> {
 
     /**
      * Function that updates a message.
-     * 
+     *
      * @param <T> type of Message the function updates
      */
     @FunctionalInterface
@@ -225,15 +225,15 @@ public abstract class SupportBasicMessageTester<T extends Message> {
 
         /**
          * Updates a message.
-         * 
+         *
          * @param msg message to be updated
          */
-        public void update(T msg);
+        void update(T msg);
     }
 
     /**
      * Function that updates a single field within a message.
-     * 
+     *
      * @param <T> type of Message the function updates
      */
     @FunctionalInterface
@@ -241,10 +241,10 @@ public abstract class SupportBasicMessageTester<T extends Message> {
 
         /**
          * Updates a field within a message.
-         * 
+         *
          * @param msg message to be updated
          * @param newValue new field value
          */
-        public void update(T msg, String newValue);
+        void update(T msg, String newValue);
     }
 }
index e8b5081..3b3c942 100644 (file)
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * feature-session-persistence
  * ================================================================================
- * 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.
@@ -24,19 +24,19 @@ import java.util.Date;
 
 public interface DroolsSession {
 
-    public String getSessionName();
-    
-    public void setSessionName(String sessionName);
-    
-    public long getSessionId();
-    
-    public void setSessionId(long sessionId);
-    
-    public Date getCreatedDate();
-    
-    public void setCreatedDate(Date createdDate);
-    
-    public Date getUpdatedDate();
-    
-    public void setUpdatedDate(Date updatedDate);
+    String getSessionName();
+
+    void setSessionName(String sessionName);
+
+    long getSessionId();
+
+    void setSessionId(long sessionId);
+
+    Date getCreatedDate();
+
+    void setCreatedDate(Date createdDate);
+
+    Date getUpdatedDate();
+
+    void setUpdatedDate(Date updatedDate);
 }
index 3a8885f..4656f9f 100644 (file)
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * feature-session-persistence
  * ================================================================================
- * 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.
@@ -26,12 +26,12 @@ public interface DroolsSessionConnector {
      * @param sessName session name
      * @return a session, or {@code null} if it is not found
      */
-    public DroolsSession get(String sessName);
+    DroolsSession get(String sessName);
 
     /**
      * Replaces a session, adding it if it does not exist.
      * @param sess session to be replaced
      */
-    public void replace(DroolsSession sess);
+    void replace(DroolsSession sess);
 
 }
index 38e3ec2..4091831 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * feature-session-persistence
  * ================================================================================
- * 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.
@@ -34,8 +34,6 @@ public class GenSchema {
 
     private static final Logger logger = LoggerFactory.getLogger(PersistenceFeatureTest.class);
 
-    private EntityManagerFactory emf;
-
     /**
      * Opens the EMF, which generates the schema, as a side-effect.
      *
@@ -47,9 +45,7 @@ public class GenSchema {
         propMap.put("javax.persistence.jdbc.driver", "org.h2.Driver");
         propMap.put("javax.persistence.jdbc.url", "jdbc:h2:mem:JpaDroolsSessionConnectorTest");
 
-        emf = Persistence.createEntityManagerFactory("schemaDroolsPU", propMap);
-
-        emf.close();
+        Persistence.createEntityManagerFactory("schemaDroolsPU", propMap).close();
     }
 
     /**
index 1bab197..e15f57c 100644 (file)
@@ -114,7 +114,6 @@ public class PersistenceFeatureTest {
     private KieSessionConfiguration kiecfg;
     private KieBase kiebase;
     private KieStoreServices kiestore;
-    private KieContainer kiecont;
     private TransactionManager transmgr;
     private UserTransaction usertrans;
     private TransactionSynchronizationRegistry transreg;
@@ -166,7 +165,6 @@ public class PersistenceFeatureTest {
         kiecfg = mock(KieSessionConfiguration.class);
         kiebase = mock(KieBase.class);
         kiestore = mock(KieStoreServices.class);
-        kiecont = mock(KieContainer.class);
         transmgr = mock(TransactionManager.class);
         usertrans = mock(UserTransaction.class);
         transreg = mock(TransactionSynchronizationRegistry.class);
@@ -176,7 +174,7 @@ public class PersistenceFeatureTest {
         emfCount = 0;
         jpaCount = 0;
         propName = null;
-        
+
         feat = new PersistenceFeatureImpl();
 
         props.putAll(stdprops);
@@ -188,6 +186,7 @@ public class PersistenceFeatureTest {
         when(kiesvc.getStoreServices()).thenReturn(kiestore);
         when(kiesvc.newKieSessionConfiguration()).thenReturn(kiecfg);
 
+        KieContainer kiecont = mock(KieContainer.class);
         when(polcont.getKieContainer()).thenReturn(kiecont);
 
         when(polsess.getPolicyContainer()).thenReturn(polcont);
index 0a4ef93..3ae4d59 100644 (file)
@@ -30,12 +30,12 @@ public interface TestTransaction {
      *
      * @param controller policy controller
      */
-    public void register(PolicyController controller);
+    void register(PolicyController controller);
 
     /**
      * unregisters a controller for monitoring test transactions.
      *
      * @param controller policy controller
      */
-    public void unregister(PolicyController controller);
+    void unregister(PolicyController controller);
 }
index c2b72fb..69ca87c 100644 (file)
@@ -382,19 +382,19 @@ public class PolicySession
         /**
          * Start the thread or threads that do the 'KieSession' processing.
          */
-        public void start();
+        void start();
 
         /**
          * Stop the thread or threads that do the 'KieSession' processing.
          */
-        public void stop();
+        void stop();
 
         /**
          * This method is called to notify the running session that
          * 'KieContainer.updateToVersion(...)' has been called (meaning the
          * full name of this session has changed).
          */
-        public default void updated() {
+        default void updated() {
         }
     }
 
index f68747d..181fbe5 100644 (file)
@@ -40,7 +40,7 @@ public interface PolicySessionFeatureApi extends OrderedService {
      * @param args standard 'main' arguments, which are currently ignored
      * @param configDir the relative directory containing configuration files
      */
-    public default void globalInit(String[] args, String configDir) {}
+    default void globalInit(String[] args, String configDir) {}
 
     /**
      * This method is used to create a 'KieSession' as part of a
@@ -57,7 +57,7 @@ public interface PolicySessionFeatureApi extends OrderedService {
      *     (this depends on the capabilities and state of the object implementing
      *     this interface)
      */
-    public default KieSession activatePolicySession(PolicyContainer policyContainer, String name, String kieBaseName) {
+    default KieSession activatePolicySession(PolicyContainer policyContainer, String name, String kieBaseName) {
         return null;
     }
 
@@ -67,13 +67,13 @@ public interface PolicySessionFeatureApi extends OrderedService {
      *
      * @param policySession the new 'PolicySession' instance
      */
-    public default void newPolicySession(PolicySession policySession) {}
+    default void newPolicySession(PolicySession policySession) {}
 
     /**
      * This method is called to select the 'ThreadModel' instance associated
      * with a 'PolicySession' instance.
      */
-    public default PolicySession.ThreadModel selectThreadModel(PolicySession session) {
+    default PolicySession.ThreadModel selectThreadModel(PolicySession session) {
         return null;
     }
 
@@ -88,7 +88,7 @@ public interface PolicySessionFeatureApi extends OrderedService {
      * @return 'true' if this feature is handling the operation,
      *     and 'false' if not.
      */
-    public default boolean insertDrools(PolicySession session, Object object) {
+    default boolean insertDrools(PolicySession session, Object object) {
         return false;
     }
 
@@ -98,7 +98,7 @@ public interface PolicySessionFeatureApi extends OrderedService {
      * @param policySession the 'PolicySession' object that wrapped the
      *     'KieSession'
      */
-    public default void disposeKieSession(PolicySession policySession) {}
+    default void disposeKieSession(PolicySession policySession) {}
 
     /**
      * This method is called after 'KieSession.destroy()' is called.
@@ -106,5 +106,5 @@ public interface PolicySessionFeatureApi extends OrderedService {
      * @param policySession the 'PolicySession' object that wrapped the
      *     'KieSession'
      */
-    public default void destroyKieSession(PolicySession policySession) {}
+    default void destroyKieSession(PolicySession policySession) {}
 }
index d2c05f8..390e00e 100644 (file)
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * policy-core
  * ================================================================================
- * 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.
@@ -22,7 +22,7 @@ package org.onap.policy.drools.core.jmx;
 
 public interface PdpJmxMBean {
 
-    public long getRulesFired();
-    
-    public long getUpdates();
+    long getRulesFired();
+
+    long getUpdates();
 }
index bbf7d22..905e31a 100644 (file)
@@ -50,6 +50,6 @@ public interface PolicyResourceLockManager extends Startable, Lockable {
      *        {@code false} otherwise
      * @return a new lock
      */
-    public Lock createLock(String resourceId, String ownerKey, int holdSec, LockCallback callback,
-                    boolean waitForLock);
+    Lock createLock(String resourceId, String ownerKey, int holdSec, LockCallback callback,
+        boolean waitForLock);
 }
index babc041..a5d577a 100644 (file)
@@ -24,7 +24,6 @@ import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -50,8 +49,6 @@ import org.slf4j.LoggerFactory;
  */
 public class KieUtils {
 
-    private static final Logger logger = LoggerFactory.getLogger(KieUtils.class);
-
     private KieUtils() {
         // Utility class
     }
index dd654b1..8e78b07 100644 (file)
@@ -137,7 +137,7 @@ public interface DroolsController extends Startable, Lockable {
      * @param modelHash the hash for the model
      * @return true it owns it
      */
-    boolean ownsCoder(Class<? extends Object> coderClass, int modelHash);
+    boolean ownsCoder(Class<?> coderClass, int modelHash);
 
     /**
      * fetches a class from the model.
index b641f24..7652a67 100644 (file)
@@ -43,8 +43,8 @@ public interface DroolsControllerFactory {
      * @throws IllegalArgumentException with invalid parameters
      * @throws LinkageError Failure to link rules and models in Drools Libraries
      */
-    public DroolsController build(Properties properties, List<? extends TopicSource> eventSources,
-            List<? extends TopicSink> eventSinks) throws LinkageError;
+    DroolsController build(Properties properties, List<? extends TopicSource> eventSources,
+        List<? extends TopicSink> eventSinks) throws LinkageError;
 
     /**
      * Explicit construction of a Drools Controller.
@@ -59,33 +59,33 @@ public interface DroolsControllerFactory {
      * @throws IllegalArgumentException with invalid parameters
      * @throws LinkageError Failure to link rules and models in Drools Libraries
      */
-    public DroolsController build(String groupId, String artifactId, String version,
-            List<TopicCoderFilterConfiguration> decoderConfigurations,
-            List<TopicCoderFilterConfiguration> encoderConfigurations) throws LinkageError;
+    DroolsController build(String groupId, String artifactId, String version,
+        List<TopicCoderFilterConfiguration> decoderConfigurations,
+        List<TopicCoderFilterConfiguration> encoderConfigurations) throws LinkageError;
 
     /**
      * Releases the Drools Controller from operation.
      *
      * @param controller the Drools Controller to shut down
      */
-    public void shutdown(DroolsController controller);
+    void shutdown(DroolsController controller);
 
     /**
      * Disables all Drools Controllers from operation.
      */
-    public void shutdown();
+    void shutdown();
 
     /**
      * Destroys and releases resources for a Drools Controller.
      *
      * @param controller the Drools Controller to destroy
      */
-    public void destroy(DroolsController controller);
+    void destroy(DroolsController controller);
 
     /**
      * Destroys all Drools Controllers.
      */
-    public void destroy();
+    void destroy();
 
     /**
      * Gets the Drools Controller associated with the maven group and artifact id.
@@ -97,12 +97,12 @@ public interface DroolsControllerFactory {
      * @return the Drools Controller
      * @throws IllegalArgumentException with invalid parameters
      */
-    public DroolsController get(String groupId, String artifactId, String version);
+    DroolsController get(String groupId, String artifactId, String version);
 
     /**
      * returns the current inventory of Drools Controllers.
      *
      * @return a list of Drools Controllers
      */
-    public List<DroolsController> inventory();
+    List<DroolsController> inventory();
 }
index 77bfcf9..9b832b0 100644 (file)
@@ -375,7 +375,7 @@ public class MavenDroolsController implements DroolsController {
 
 
     @Override
-    public boolean ownsCoder(Class<? extends Object> coderClass, int modelHash) {
+    public boolean ownsCoder(Class<?> coderClass, int modelHash) {
         if (!isClass(coderClass.getName())) {
             logger.error("{}{} cannot be retrieved. ", this, coderClass.getName());
             return false;
index 5416d32..a43a146 100644 (file)
@@ -138,7 +138,7 @@ public class NullDroolsController implements DroolsController {
     }
 
     @Override
-    public boolean ownsCoder(Class<? extends Object> coderClass, int modelHash) {
+    public boolean ownsCoder(Class<?> coderClass, int modelHash) {
         throw new IllegalStateException(makeInvokeMsg());
     }
 
index 6cbe94a..7e26859 100644 (file)
@@ -120,7 +120,7 @@ public interface EventProtocolCoder {
      * @param eventProtocolParams parameter object for event protocol
      * @throw IllegalArgumentException if an invalid parameter is passed
      */
-    public void addDecoder(EventProtocolParams eventProtocolParams);
+    void addDecoder(EventProtocolParams eventProtocolParams);
 
     /**
      * removes all decoders associated with the controller id.
@@ -140,7 +140,7 @@ public interface EventProtocolCoder {
      * @param topic      the topic
      * @throws IllegalArgumentException if invalid arguments have been provided
      */
-    public void removeDecoders(String groupId, String artifactId, String topic);
+    void removeDecoders(String groupId, String artifactId, String topic);
 
     /**
      * Given a controller id and a topic, it gives back its filters.
@@ -151,7 +151,7 @@ public interface EventProtocolCoder {
      * @return list of decoders
      * @throw IllegalArgumentException if an invalid parameter is passed
      */
-    public List<CoderFilters> getDecoderFilters(String groupId, String artifactId, String topic);
+    List<CoderFilters> getDecoderFilters(String groupId, String artifactId, String topic);
 
     /**
      * gets all decoders associated with the group and artifact ids.
@@ -160,7 +160,7 @@ public interface EventProtocolCoder {
      * @param artifactId of the controller
      * @throws IllegalArgumentException if invalid arguments have been provided
      */
-    public List<CoderFilters> getDecoderFilters(String groupId, String artifactId);
+    List<CoderFilters> getDecoderFilters(String groupId, String artifactId);
 
     /**
      * Given a controller id, a topic, and a classname, it gives back the classes that implements the decoding.
@@ -172,8 +172,8 @@ public interface EventProtocolCoder {
      * @return list of decoders
      * @throw IllegalArgumentException if an invalid parameter is passed
      */
-    public CoderFilters getDecoderFilters(
-            String groupId, String artifactId, String topic, String classname);
+    CoderFilters getDecoderFilters(
+        String groupId, String artifactId, String topic, String classname);
 
     /**
      * Given a controller id and a topic, it gives back the decoding configuration.
@@ -184,7 +184,7 @@ public interface EventProtocolCoder {
      * @return decoding toolset
      * @throw IllegalArgumentException if an invalid parameter is passed
      */
-    public ProtocolCoderToolset getDecoders(String groupId, String artifactId, String topic);
+    ProtocolCoderToolset getDecoders(String groupId, String artifactId, String topic);
 
     /**
      * Given a controller id and a topic, it gives back all the decoding configurations.
@@ -194,7 +194,7 @@ public interface EventProtocolCoder {
      * @return decoding toolset
      * @throw IllegalArgumentException if an invalid parameter is passed
      */
-    public List<ProtocolCoderToolset> getDecoders(String groupId, String artifactId);
+    List<ProtocolCoderToolset> getDecoders(String groupId, String artifactId);
 
     /**
      * Given a controller id and a topic, it gives back the classes that implements the encoding.
@@ -205,7 +205,7 @@ public interface EventProtocolCoder {
      * @return list of decoders
      * @throw IllegalArgumentException if an invalid parameter is passed
      */
-    public List<CoderFilters> getEncoderFilters(String groupId, String artifactId, String topic);
+    List<CoderFilters> getEncoderFilters(String groupId, String artifactId, String topic);
 
     /**
      * gets all encoders associated with the group and artifact ids.
@@ -215,7 +215,7 @@ public interface EventProtocolCoder {
      * @return List of filters
      * @throws IllegalArgumentException if invalid arguments have been provided
      */
-    public List<CoderFilters> getEncoderFilters(String groupId, String artifactId);
+    List<CoderFilters> getEncoderFilters(String groupId, String artifactId);
 
     /**
      * get encoder based on coordinates and classname.
@@ -227,8 +227,8 @@ public interface EventProtocolCoder {
      * @return CoderFilters decoders
      * @throws IllegalArgumentException invalid arguments passed in
      */
-    public CoderFilters getEncoderFilters(
-            String groupId, String artifactId, String topic, String classname);
+    CoderFilters getEncoderFilters(
+        String groupId, String artifactId, String topic, String classname);
 
     /**
      * is there a decoder supported for the controller id and topic.
@@ -238,7 +238,7 @@ public interface EventProtocolCoder {
      * @param topic      protocol
      * @return true if supported
      */
-    public boolean isDecodingSupported(String groupId, String artifactId, String topic);
+    boolean isDecodingSupported(String groupId, String artifactId, String topic);
 
     /**
      * Adds a Encoder class to encode the protocol over this topic.
@@ -246,7 +246,7 @@ public interface EventProtocolCoder {
      * @param eventProtocolParams parameter object for event protocol
      * @throw IllegalArgumentException if an invalid parameter is passed
      */
-    public void addEncoder(EventProtocolParams eventProtocolParams);
+    void addEncoder(EventProtocolParams eventProtocolParams);
 
     /**
      * is there an encoder supported for the controller id and topic.
@@ -256,7 +256,7 @@ public interface EventProtocolCoder {
      * @param topic      protocol
      * @return true if supported
      */
-    public boolean isEncodingSupported(String groupId, String artifactId, String topic);
+    boolean isEncodingSupported(String groupId, String artifactId, String topic);
 
     /**
      * get encoder based on topic and encoded class.
@@ -266,7 +266,7 @@ public interface EventProtocolCoder {
      * @return list of filters
      * @throws IllegalArgumentException invalid arguments passed in
      */
-    public List<CoderFilters> getReverseEncoderFilters(String topic, String encodedClass);
+    List<CoderFilters> getReverseEncoderFilters(String topic, String encodedClass);
 
     /**
      * gets the identifier of the creator of the encoder.
@@ -276,7 +276,7 @@ public interface EventProtocolCoder {
      * @return a drools controller
      * @throws IllegalArgumentException invalid arguments passed in
      */
-    public DroolsController getDroolsController(String topic, Object encodedClass);
+    DroolsController getDroolsController(String topic, Object encodedClass);
 
     /**
      * gets the identifier of the creator of the encoder.
@@ -286,7 +286,7 @@ public interface EventProtocolCoder {
      * @return list of drools controllers
      * @throws IllegalArgumentException invalid arguments passed in
      */
-    public List<DroolsController> getDroolsControllers(String topic, Object encodedClass);
+    List<DroolsController> getDroolsControllers(String topic, Object encodedClass);
 
     /**
      * decode topic's stringified event (json) to corresponding Event Object.
@@ -300,7 +300,7 @@ public interface EventProtocolCoder {
      * @throws UnsupportedOperationException if the operation is not supported
      * @throws IllegalStateException         if the system is in an illegal state
      */
-    public Object decode(String groupId, String artifactId, String topic, String json);
+    Object decode(String groupId, String artifactId, String topic, String json);
 
     /**
      * encodes topic's stringified event (json) to corresponding Event Object.
@@ -312,7 +312,7 @@ public interface EventProtocolCoder {
      * @return encoded string
      * @throws IllegalArgumentException invalid arguments passed in
      */
-    public String encode(String groupId, String artifactId, String topic, Object event);
+    String encode(String groupId, String artifactId, String topic, Object event);
 
     /**
      * encodes topic's stringified event (json) to corresponding Event Object.
@@ -323,7 +323,7 @@ public interface EventProtocolCoder {
      * @throws IllegalArgumentException      invalid arguments passed in
      * @throws UnsupportedOperationException operation cannot be performed
      */
-    public String encode(String topic, Object event);
+    String encode(String topic, Object event);
 
     /**
      * encodes topic's stringified event (json) to corresponding Event Object.
@@ -335,5 +335,5 @@ public interface EventProtocolCoder {
      * @throws IllegalArgumentException      invalid arguments passed in
      * @throws UnsupportedOperationException operation cannot be performed
      */
-    public String encode(String topic, Object event, DroolsController droolsController);
+    String encode(String topic, Object event, DroolsController droolsController);
 }
index cb0749d..db09cb4 100644 (file)
@@ -309,8 +309,8 @@ public interface PolicyEngine extends Startable, Lockable, TopicListener {
      *        {@code false} otherwise
      * @return a new lock
      */
-    public Lock createLock(String resourceId, String ownerKey, int holdSec, LockCallback callback,
-                    boolean waitForLock);
+    Lock createLock(String resourceId, String ownerKey, int holdSec, LockCallback callback,
+        boolean waitForLock);
 
     /**
      * Invoked when the host goes into the active state.
index 6e529c7..0f046d2 100644 (file)
@@ -221,7 +221,7 @@ class PolicyEngineManager implements PolicyEngine {
         defaultConfig.put(
                 PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + TELEMETRY_SERVER_DEFAULT_NAME
                         + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX,
-                "" + Integer.toString(TELEMETRY_SERVER_DEFAULT_PORT));
+                "" + TELEMETRY_SERVER_DEFAULT_PORT);
         defaultConfig.put(
                 PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + TELEMETRY_SERVER_DEFAULT_NAME
                         + PolicyEndPointProperties.PROPERTY_HTTP_REST_PACKAGES_SUFFIX,
@@ -663,7 +663,7 @@ class PolicyEngineManager implements PolicyEngine {
 
     @FunctionalInterface
     private static interface PredicateWithEx<T> {
-        public boolean test(T value) throws InterruptedException;
+        boolean test(T value) throws InterruptedException;
     }
 
     @Override
index e237a45..e7f6529 100644 (file)
@@ -32,7 +32,6 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
-import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.kie.api.builder.ReleaseId;
index 2bbb08b..8607fd6 100644 (file)
@@ -84,8 +84,8 @@ public class ProtocolCoderToolsetTest {
     public void testGsonToolset(JsonProtocolFilter protocolFilter) {
         GsonProtocolCoderToolset gsonToolset = new GsonProtocolCoderToolset(
                 EventProtocolParams.builder().topic(JUNIT_PROTOCOL_CODER_TOPIC)
-                        .groupId(this.releaseId.getGroupId())
-                        .artifactId(this.releaseId.getArtifactId())
+                        .groupId(releaseId.getGroupId())
+                        .artifactId(releaseId.getArtifactId())
                         .eventClass(Triple.class.getName())
                         .protocolFilter(protocolFilter)
                         .customGsonCoder(null)
@@ -193,8 +193,8 @@ public class ProtocolCoderToolsetTest {
 
     private void validateInitialization(JsonProtocolFilter protocolFilter, ProtocolCoderToolset coderToolset) {
         Assert.assertTrue(CONTROLLER_ID.equals(coderToolset.getControllerId()));
-        Assert.assertTrue(this.releaseId.getGroupId().equals(coderToolset.getGroupId()));
-        Assert.assertTrue(this.releaseId.getArtifactId().equals(coderToolset.getArtifactId()));
+        Assert.assertTrue(releaseId.getGroupId().equals(coderToolset.getGroupId()));
+        Assert.assertTrue(releaseId.getArtifactId().equals(coderToolset.getArtifactId()));
         Assert.assertNull(coderToolset.getCustomCoder());
 
         Assert.assertTrue(coderToolset.getCoders().size() == 1);