diff options
8 files changed, 108 insertions, 143 deletions
diff --git a/gson/src/test/java/org/onap/policy/common/gson/internal/MethodAdapterTest.java b/gson/src/test/java/org/onap/policy/common/gson/internal/MethodAdapterTest.java index 9f39e3ce..6c13865d 100644 --- a/gson/src/test/java/org/onap/policy/common/gson/internal/MethodAdapterTest.java +++ b/gson/src/test/java/org/onap/policy/common/gson/internal/MethodAdapterTest.java @@ -1,8 +1,8 @@ -/* +/*-- * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2020 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. @@ -26,7 +26,6 @@ import static org.junit.Assert.assertEquals; import com.google.gson.Gson; import com.google.gson.JsonParseException; import org.junit.Test; -import org.onap.policy.common.gson.internal.MethodAdapter; public class MethodAdapterTest { private static final Gson gson = new Gson(); @@ -36,16 +35,16 @@ public class MethodAdapterTest { @Test public void testMethodAdapter_testInvoke() throws Exception { MethodAdapter adapter = - new MethodAdapter(gson, MethodAdapterTest.class.getDeclaredMethod("getValue"), String.class); + new MethodAdapter(gson, MethodAdapterTest.class.getDeclaredMethod("getValue"), String.class); assertEquals("hello", adapter.invoke(this)); MethodAdapter adapter2 = new MethodAdapter(gson, - MethodAdapterTest.class.getDeclaredMethod("setValue", String.class), String.class); + MethodAdapterTest.class.getDeclaredMethod("setValue", String.class), String.class); adapter2.invoke(this, "world"); assertEquals("world", saved); assertThatThrownBy(() -> adapter2.invoke(this, 100)).isInstanceOf(JsonParseException.class) - .hasMessage(MethodAdapter.INVOKE_ERR + MethodAdapterTest.class.getName() + ".setValue"); + .hasMessage(MethodAdapter.INVOKE_ERR + MethodAdapterTest.class.getName() + ".setValue"); } public String getValue() { diff --git a/gson/src/test/java/org/onap/policy/common/gson/internal/MethodDeserializerTest.java b/gson/src/test/java/org/onap/policy/common/gson/internal/MethodDeserializerTest.java index 338644ae..7fcfca18 100644 --- a/gson/src/test/java/org/onap/policy/common/gson/internal/MethodDeserializerTest.java +++ b/gson/src/test/java/org/onap/policy/common/gson/internal/MethodDeserializerTest.java @@ -1,8 +1,8 @@ -/* +/*-- * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2020 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. @@ -32,7 +32,6 @@ import java.util.List; import org.junit.Test; import org.onap.policy.common.gson.JacksonExclusionStrategy; import org.onap.policy.common.gson.internal.DataAdapterFactory.Data; -import org.onap.policy.common.gson.internal.MethodDeserializer; public class MethodDeserializerTest { private static final String PROP_NAME = "text"; @@ -43,7 +42,7 @@ public class MethodDeserializerTest { private static DataAdapterFactory dataAdapter = new DataAdapterFactory(); private static Gson gson = new GsonBuilder().registerTypeAdapterFactory(dataAdapter) - .setExclusionStrategies(new JacksonExclusionStrategy()).create(); + .setExclusionStrategies(new JacksonExclusionStrategy()).create(); private MethodDeserializer deser; diff --git a/gson/src/test/java/org/onap/policy/common/gson/internal/MethodSerializerTest.java b/gson/src/test/java/org/onap/policy/common/gson/internal/MethodSerializerTest.java index 586bf54d..ed240513 100644 --- a/gson/src/test/java/org/onap/policy/common/gson/internal/MethodSerializerTest.java +++ b/gson/src/test/java/org/onap/policy/common/gson/internal/MethodSerializerTest.java @@ -1,8 +1,8 @@ -/* +/*-- * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2020 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. @@ -31,7 +31,6 @@ import java.util.List; import org.junit.Test; import org.onap.policy.common.gson.JacksonExclusionStrategy; import org.onap.policy.common.gson.internal.DataAdapterFactory.Data; -import org.onap.policy.common.gson.internal.MethodSerializer; public class MethodSerializerTest { private static final String PROP_NAME = "text"; @@ -40,7 +39,7 @@ public class MethodSerializerTest { private static DataAdapterFactory dataAdapter = new DataAdapterFactory(); private static Gson gson = new GsonBuilder().registerTypeAdapterFactory(dataAdapter) - .setExclusionStrategies(new JacksonExclusionStrategy()).create(); + .setExclusionStrategies(new JacksonExclusionStrategy()).create(); private MethodSerializer ser; diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java index 717ae7a3..1372b4fc 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Integrity Monitor * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2020 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. @@ -69,8 +69,8 @@ public class IntegrityMonitor { private static final String IGNORE_INVALID_PROPERTY_STRING = "Ignored invalid property: {}"; private static final String PROPERTY_EXCEPTION_STRING = "IntegrityMonitor Property Exception: "; private static final String EXCEPTION_STRING = "IntegrityMonitor threw exception."; - private static final String STATE_CHECK_STRING = "IntegrityMonitor.stateCheck(): " - + "Failed to disableFail dependent resource = "; + private static final String STATE_CHECK_STRING = + "IntegrityMonitor.stateCheck(): " + "Failed to disableFail dependent resource = "; private static final String RESOURCE_STRING = "Resource "; private static final String LC_RESOURCE_STRING = "resource"; @@ -83,8 +83,8 @@ public class IntegrityMonitor { boolean alarmExists = false; /* - * Error message that is written by the dependencyCheck() method. It is made available - * externally through the evaluateSanity() method. + * Error message that is written by the dependencyCheck() method. It is made available externally through the + * evaluateSanity() method. */ private String dependencyCheckErrorMsg = ""; @@ -233,8 +233,7 @@ public class IntegrityMonitor { // Did it get created? // if (emf == null) { - logger.error("Error creating IM entity manager factory with persistence unit: {}", - getPersistenceUnit()); + logger.error("Error creating IM entity manager factory with persistence unit: {}", getPersistenceUnit()); throw new IntegrityMonitorException("Unable to create IM Entity Manager Factory"); } @@ -331,11 +330,10 @@ public class IntegrityMonitor { stateManager = new StateManagement(emf, resourceName); /** - * Initialize the state and status attributes. This will maintain any Administrative - * state value but will set the operational state = enabled, availability status = null, - * standby status = null. The integrity monitor will set the operational state via the - * FPManager and the owning application must set the standby status by calling - * promote/demote on the StateManager. + * Initialize the state and status attributes. This will maintain any Administrative state value but will + * set the operational state = enabled, availability status = null, standby status = null. The integrity + * monitor will set the operational state via the FPManager and the owning application must set the standby + * status by calling promote/demote on the StateManager. */ stateManager.initializeState(); @@ -530,28 +528,28 @@ public class IntegrityMonitor { AtomicReference<StateManagementEntity> stateManagementEntity = new AtomicReference<>(); String errorMsg = - withinTransaction(dep + ": ForwardProgressEntity DB operation failed with exception: ", () -> { - Query query = em.createQuery( - "Select p from ForwardProgressEntity p where p.resourceName=:resource"); - query.setParameter(LC_RESOURCE_STRING, dep); - - @SuppressWarnings("rawtypes") - List fpList = query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT) - .getResultList(); - - if (!fpList.isEmpty()) { - // exists - forwardProgressEntity.set((ForwardProgressEntity) fpList.get(0)); - // refresh the object from DB in case cached data was - // returned - em.refresh(forwardProgressEntity.get()); - logger.debug("Found entry in ForwardProgressEntity table for dependent Resource={}", dep); - return null; - - } else { - return dep + ": resource not found in ForwardProgressEntity database table"; - } - }); + withinTransaction(dep + ": ForwardProgressEntity DB operation failed with exception: ", () -> { + Query query = + em.createQuery("Select p from ForwardProgressEntity p where p.resourceName=:resource"); + query.setParameter(LC_RESOURCE_STRING, dep); + + @SuppressWarnings("rawtypes") + List fpList = + query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList(); + + if (!fpList.isEmpty()) { + // exists + forwardProgressEntity.set((ForwardProgressEntity) fpList.get(0)); + // refresh the object from DB in case cached data was + // returned + em.refresh(forwardProgressEntity.get()); + logger.debug("Found entry in ForwardProgressEntity table for dependent Resource={}", dep); + return null; + + } else { + return dep + ": resource not found in ForwardProgressEntity database table"; + } + }); if (errorMsg == null) { errorMsg = withinTransaction(dep + ": StateManagementEntity DB read failed with exception: ", () -> { @@ -630,7 +628,7 @@ public class IntegrityMonitor { } private void checkForwardProgress(String dep, ForwardProgressEntity forwardProgressEntity, - StateManagementEntity stateManagementEntity) { + StateManagementEntity stateManagementEntity) { if (forwardProgressEntity != null && stateManagementEntity != null) { Date date = MonitorTime.getInstance().getDate(); long diffMs = date.getTime() - forwardProgressEntity.getLastUpdated().getTime(); @@ -647,12 +645,10 @@ public class IntegrityMonitor { } else { if (forwardProgressEntity == null) { - String msg = STATE_CHECK_STRING + dep - + "; " + " forwardProgressEntity == null."; + String msg = STATE_CHECK_STRING + dep + "; " + " forwardProgressEntity == null."; logger.error("{}", msg); } else { - String msg = STATE_CHECK_STRING + dep - + "; " + " stateManagementEntity == null."; + String msg = STATE_CHECK_STRING + dep + "; " + " stateManagementEntity == null."; logger.error("{}", msg); } } @@ -703,7 +699,7 @@ public class IntegrityMonitor { em.refresh(fpx); if (logger.isDebugEnabled()) { logger.debug("Dependent resource {} - fpc= {}, lastUpdated={}", dep, fpx.getFpcCount(), - fpx.getLastUpdated()); + fpx.getLastUpdated()); } long currTime = MonitorTime.getInstance().getMillis(); // if dependent resource FPC has not been updated, consider it @@ -735,7 +731,7 @@ public class IntegrityMonitor { withinTransaction("getAllForwardProgessEntity DB read failed with exception: ", () -> { Query fquery = em.createQuery("Select e from ForwardProgressEntity e"); fquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList() - .forEach(obj -> fpList.add((ForwardProgressEntity) obj)); + .forEach(obj -> fpList.add((ForwardProgressEntity) obj)); return null; }); @@ -747,7 +743,7 @@ public class IntegrityMonitor { int index = 0; for (ForwardProgressEntity fpe : fpList) { logger.debug("getAllForwardProgressEntity: fpList.get({}).getResourceName(): {}", index++, - fpe.getResourceName()); + fpe.getResourceName()); } return fpList; @@ -759,9 +755,8 @@ public class IntegrityMonitor { // get the JMX URL from the database AtomicReference<String> jmxUrl = new AtomicReference<>(); - String errorMsg = - withinTransaction(dep + ": ResourceRegistrationEntity DB read failed with exception: ", - () -> getJmxUrlFromDb(dep, jmxUrl)); + String errorMsg = withinTransaction(dep + ": ResourceRegistrationEntity DB read failed with exception: ", + () -> getJmxUrlFromDb(dep, jmxUrl)); if (jmxUrl.get() != null) { errorMsg = jmxCheck2(dep, jmxUrl.get(), errorMsg); @@ -772,13 +767,11 @@ public class IntegrityMonitor { private String getJmxUrlFromDb(String dep, AtomicReference<String> jmxUrl) { // query if ResourceRegistration entry exists for resourceName - Query rquery = em.createQuery( - "Select r from ResourceRegistrationEntity r where r.resourceName=:rn"); + Query rquery = em.createQuery("Select r from ResourceRegistrationEntity r where r.resourceName=:rn"); rquery.setParameter("rn", dep); @SuppressWarnings("rawtypes") - List rrList = rquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT) - .getResultList(); + List rrList = rquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList(); ResourceRegistrationEntity rrx = null; if (!rrList.isEmpty()) { @@ -789,8 +782,7 @@ public class IntegrityMonitor { em.refresh(rrx); jmxUrl.set(rrx.getResourceUrl()); if (logger.isDebugEnabled()) { - logger.debug("Dependent Resource={}, url={}, createdDate={}", dep, jmxUrl.get(), - rrx.getCreatedDate()); + logger.debug("Dependent Resource={}, url={}, createdDate={}", dep, jmxUrl.get(), rrx.getCreatedDate()); } return null; @@ -846,18 +838,17 @@ public class IntegrityMonitor { dependencyOk = checkDependencies(errorMsg) && dependencyOk; /* - * We have checked all the dependency groups. If all are ok and subsystemTest - * passed, dependencyFailure == false + * We have checked all the dependency groups. If all are ok and subsystemTest passed, dependencyFailure + * == false */ if (dependencyOk) { dependenciesGood(errorMsg); } } else if (dependencyOk) { /* - * This is put here to clean up when no dependency group should exist, but one was - * erroneously added which caused the state to be disabled/dependency/coldstandby - * and later removed. We saw this happen in the lab, but is not very likely in a - * production environment...but you never know. + * This is put here to clean up when no dependency group should exist, but one was erroneously added + * which caused the state to be disabled/dependency/coldstandby and later removed. We saw this happen in + * the lab, but is not very likely in a production environment...but you never know. */ noDependencyGroups(errorMsg); } @@ -893,10 +884,8 @@ public class IntegrityMonitor { // This indicates a subsystemTest failure try { if (logger.isDebugEnabled()) { - logger.debug( - "{}: There has been a subsystemTest failure with error:{} Updating this resource's " - + "state to disableDependency", - resourceName, e.getMessage()); + logger.debug("{}: There has been a subsystemTest failure with error:{} Updating this resource's " + + "state to disableDependency", resourceName, e.getMessage()); } // Capture the subsystemTest failure info appendSeparator(errorMsg); @@ -1012,9 +1001,9 @@ public class IntegrityMonitor { try { logger.debug("All dependents in group {} have failed their health check. Updating this " + "resource's state to disableDependency", group); - if (stateManager.getAvailStatus() == null || !((stateManager.getAvailStatus()) - .equals(StateManagement.DEPENDENCY) - || (stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY_FAILED))) { + if (stateManager.getAvailStatus() == null + || !((stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY) + || (stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY_FAILED))) { // Note: redundant calls are made by // refreshStateAudit this.stateManager.disableDependency(); @@ -1033,12 +1022,11 @@ public class IntegrityMonitor { private void dependenciesGood(StringBuilder errorMsg) { try { - logger.debug( - "All dependency groups have at least one viable member. Updating this resource's state" - + " to enableNoDependency"); + logger.debug("All dependency groups have at least one viable member. Updating this resource's state" + + " to enableNoDependency"); if (stateManager.getAvailStatus() != null && ((stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY) - || (stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY_FAILED))) { + || (stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY_FAILED))) { // Note: redundant calls are made by // refreshStateAudit this.stateManager.enableNoDependency(); @@ -1058,7 +1046,7 @@ public class IntegrityMonitor { logger.debug("There are no dependents. Updating this resource's state to enableNoDependency"); if (stateManager.getAvailStatus() != null && ((stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY) - || (stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY_FAILED))) { + || (stateManager.getAvailStatus()).equals(StateManagement.DEPENDENCY_FAILED))) { // Note: redundant calls are made by refreshStateAudit this.stateManager.enableNoDependency(); } @@ -1124,7 +1112,7 @@ public class IntegrityMonitor { if ((stateManager.getStandbyStatus() != null) && (stateManager.getStandbyStatus().equals(StateManagement.HOT_STANDBY) - || stateManager.getStandbyStatus().equals(StateManagement.COLD_STANDBY))) { + || stateManager.getStandbyStatus().equals(StateManagement.COLD_STANDBY))) { String msg = RESOURCE_STRING + resourceName + " is standby"; throw new StandbyStatusException("IntegrityMonitor Standby Status Exception: " + msg); @@ -1144,8 +1132,8 @@ public class IntegrityMonitor { if (getAllNotWellMap() != null) { if (!(getAllNotWellMap().isEmpty())) { /* - * An entity has reported that it is not well. We must not allow the the forward - * progress counter to advance. + * An entity has reported that it is not well. We must not allow the the forward progress counter to + * advance. */ String msg = "allNotWellMap:"; for (Entry<String, String> entry : allNotWellMap.entrySet()) { @@ -1161,9 +1149,8 @@ public class IntegrityMonitor { for (Entry<String, String> entry : allSeemsWellMap.entrySet()) { msg = msg.concat("\nkey = " + entry.getKey() + " msg = " + entry.getValue()); } - logger.debug( - "endTransaction: allNotWellMap IS EMPTY and allSeemsWellMap is NOT EMPTY. " - + "Advancing forward progress counter. \n{}\n", msg); + logger.debug("endTransaction: allNotWellMap IS EMPTY and allSeemsWellMap is NOT EMPTY. " + + "Advancing forward progress counter. \n{}\n", msg); } } // increment local FPC @@ -1219,7 +1206,7 @@ public class IntegrityMonitor { } catch (Exception e1) { logger.error(EXCEPTION_STRING, e1); } - logger.error("writeFpc DB table commit failed with exception: {}", e); + logger.error("writeFpc DB table commit failed with exception", e); throw e; } } @@ -1241,17 +1228,13 @@ public class IntegrityMonitor { checkNonNull(prop, IntegrityMonitorProperties.DB_USER); checkNonNull(prop, IntegrityMonitorProperties.DB_PWD); - setLong(prop, IntegrityMonitorProperties.FP_MONITOR_INTERVAL, - value -> monitorIntervalMs = toMillis(value)); + setLong(prop, IntegrityMonitorProperties.FP_MONITOR_INTERVAL, value -> monitorIntervalMs = toMillis(value)); - setInt(prop, IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD, - value -> failedCounterThreshold = value); + setInt(prop, IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD, value -> failedCounterThreshold = value); - setLong(prop, IntegrityMonitorProperties.TEST_TRANS_INTERVAL, - value -> testTransIntervalMs = toMillis(value)); + setLong(prop, IntegrityMonitorProperties.TEST_TRANS_INTERVAL, value -> testTransIntervalMs = toMillis(value)); - setLong(prop, IntegrityMonitorProperties.WRITE_FPC_INTERVAL, - value -> writeFpcIntervalMs = toMillis(value)); + setLong(prop, IntegrityMonitorProperties.WRITE_FPC_INTERVAL, value -> writeFpcIntervalMs = toMillis(value)); setLong(prop, IntegrityMonitorProperties.CHECK_DEPENDENCY_INTERVAL, value -> checkDependencyIntervalMs = toMillis(value)); @@ -1285,8 +1268,7 @@ public class IntegrityMonitor { setLong(prop, IntegrityMonitorProperties.MAX_FPC_UPDATE_INTERVAL, value -> maxFpcUpdateIntervalMs = toMillis(value)); - setLong(prop, IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, - value -> stateAuditIntervalMs = value); + setLong(prop, IntegrityMonitorProperties.STATE_AUDIT_INTERVAL_MS, value -> stateAuditIntervalMs = value); setLong(prop, IntegrityMonitorProperties.REFRESH_STATE_AUDIT_INTERVAL_MS, value -> refreshStateAuditIntervalMs = value); @@ -1302,8 +1284,7 @@ public class IntegrityMonitor { } } - private static String checkNonNull(Properties props, String propName) - throws IntegrityMonitorPropertiesException { + private static String checkNonNull(Properties props, String propName) throws IntegrityMonitorPropertiesException { String propValue = props.getProperty(propName); if (propValue == null) { @@ -1425,8 +1406,7 @@ public class IntegrityMonitor { lastFpCounter = fpCounter; missedCycles = 0; // set op state to enabled - logger.debug("Forward progress detected for resource {}. Setting state to enable not failed.", - resourceName); + logger.debug("Forward progress detected for resource {}. Setting state to enable not failed.", resourceName); if (!(stateManager.getOpState()).equals(StateManagement.ENABLED)) { // Note: The refreshStateAudit will make redundant calls stateManager.enableNotFailed(); @@ -1527,6 +1507,7 @@ public class IntegrityMonitor { /** * Disables the entity. + * * @param entrans entity transaction * @param fpe entity of interest * @return the corresponding state management entity @@ -1536,13 +1517,11 @@ public class IntegrityMonitor { try { // query if StateManagement entry exists for fpe resource - Query query = - em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource"); + Query query = em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource"); query.setParameter(LC_RESOURCE_STRING, fpe.getResourceName()); @SuppressWarnings("rawtypes") - List smList = - query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList(); + List smList = query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList(); if (!smList.isEmpty()) { // exists sme = (StateManagementEntity) smList.get(0); @@ -1550,10 +1529,8 @@ public class IntegrityMonitor { // returned em.refresh(sme); if (logger.isDebugEnabled()) { - logger.debug( - "IntegrityMonitor.executeStateAudit(): Found entry in StateManagementEntity table " - + "for Resource={}", - sme.getResourceName()); + logger.debug("IntegrityMonitor.executeStateAudit(): Found entry in StateManagementEntity table " + + "for Resource={}", sme.getResourceName()); } } else { String msg = "IntegrityMonitor.executeStateAudit(): " + fpe.getResourceName() @@ -1584,8 +1561,7 @@ public class IntegrityMonitor { stateManager.disableFailed(dep); } } catch (Exception e) { - String msg = STATE_CHECK_STRING + dep - + "; " + e.getMessage(); + String msg = STATE_CHECK_STRING + dep + "; " + e.getMessage(); logger.error("{}", msg, e); } } @@ -1607,6 +1583,7 @@ public class IntegrityMonitor { /** * Indicates a failure to disable an entity. + * * @param sme entity of interest */ private void disableFailed(StateManagementEntity sme) { @@ -1702,13 +1679,13 @@ public class IntegrityMonitor { } /* - * This is a simple refresh audit which is periodically run to assure that the states and status - * attributes are aligned and notifications are sent to any listeners. It is possible for - * state/status to get out of sync and notified systems to be out of synch due to database - * corruption (manual or otherwise) or because a node became isolated. + * This is a simple refresh audit which is periodically run to assure that the states and status attributes are + * aligned and notifications are sent to any listeners. It is possible for state/status to get out of sync and + * notified systems to be out of synch due to database corruption (manual or otherwise) or because a node became + * isolated. * - * When the operation (lock/unlock) is called, it will cause a re-evaluation of the state and - * send a notification to all registered observers. + * When the operation (lock/unlock) is called, it will cause a re-evaluation of the state and send a notification to + * all registered observers. */ private void refreshStateAudit() { logger.debug("refreshStateAudit(): entry"); @@ -1816,8 +1793,7 @@ public class IntegrityMonitor { * @param msg message to add for the key * @throws AllSeemsWellException if an error occurs */ - public void allSeemsWell(String key, Boolean asw, String msg) - throws AllSeemsWellException { + public void allSeemsWell(String key, Boolean asw, String msg) throws AllSeemsWellException { logger.debug("allSeemsWell entry: key = {}, asw = {}, msg = {}", key, asw, msg); if (StringUtils.isEmpty(key)) { @@ -1884,8 +1860,7 @@ public class IntegrityMonitor { // these methods may be overridden by junit tests /** - * Indicates that the {@link FpManager#run()} method has started. This method - * simply returns. + * Indicates that the {@link FpManager#run()} method has started. This method simply returns. * * @throws InterruptedException can be interrupted */ diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/listeners/MessageTypeDispatcherTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/listeners/MessageTypeDispatcherTest.java index 1c5a175d..e4c84f3a 100644 --- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/listeners/MessageTypeDispatcherTest.java +++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/listeners/MessageTypeDispatcherTest.java @@ -1,4 +1,4 @@ -/* +/*-- * ============LICENSE_START======================================================= * ONAP * ================================================================================ @@ -37,8 +37,6 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher; -import org.onap.policy.common.endpoints.listeners.ScoListener; import org.onap.policy.common.utils.coder.StandardCoderObject; import org.onap.policy.common.utils.test.log.logback.ExtractAppender; import org.slf4j.LoggerFactory; diff --git a/utils-test/src/main/java/org/onap/policy/common/utils/time/PeriodicItem.java b/utils-test/src/main/java/org/onap/policy/common/utils/time/PeriodicItem.java index 79d2f226..04a9b3f6 100644 --- a/utils-test/src/main/java/org/onap/policy/common/utils/time/PeriodicItem.java +++ b/utils-test/src/main/java/org/onap/policy/common/utils/time/PeriodicItem.java @@ -1,8 +1,8 @@ -/* +/*-- * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2020 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. @@ -20,8 +20,6 @@ package org.onap.policy.common.utils.time; -import org.onap.policy.common.utils.time.TestTime; - /** * Work item that runs periodically. */ diff --git a/utils-test/src/main/java/org/onap/policy/common/utils/time/RunnableItem.java b/utils-test/src/main/java/org/onap/policy/common/utils/time/RunnableItem.java index 54560316..67371bb9 100644 --- a/utils-test/src/main/java/org/onap/policy/common/utils/time/RunnableItem.java +++ b/utils-test/src/main/java/org/onap/policy/common/utils/time/RunnableItem.java @@ -1,8 +1,8 @@ -/* +/*- * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2020 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. @@ -23,7 +23,6 @@ package org.onap.policy.common.utils.time; import java.util.concurrent.Future; import lombok.AccessLevel; import lombok.Getter; -import org.onap.policy.common.utils.time.TestTime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -80,7 +79,7 @@ class RunnableItem extends WorkItem { try { action.run(); } catch (RuntimeException e) { - logger.warn("work item {} threw an exception {}", this, e); + logger.warn("work item {} threw an exception", this, e); } } diff --git a/utils/src/main/java/org/onap/policy/common/utils/coder/StandardValCoder.java b/utils/src/main/java/org/onap/policy/common/utils/coder/StandardValCoder.java index 6e08e722..85505a98 100644 --- a/utils/src/main/java/org/onap/policy/common/utils/coder/StandardValCoder.java +++ b/utils/src/main/java/org/onap/policy/common/utils/coder/StandardValCoder.java @@ -1,4 +1,4 @@ -/* +/*-- * ============LICENSE_START======================================================= * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -36,8 +36,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Extension to the StandardCoder to support streaming validation - * against a Draft-07 Json schema specification. + * Extension to the StandardCoder to support streaming validation against a Draft-07 Json schema specification. */ @ToString @@ -56,16 +55,15 @@ public class StandardValCoder extends StandardCoder { * StandardCoder with validation. */ public StandardValCoder(@NonNull String jsonSchema, @NonNull String name) { - SchemaSource schemaSource = - new StringSchemaSource(jsonSchema, JsonSchemaVersion.DRAFT07, null, name); + SchemaSource schemaSource = new StringSchemaSource(jsonSchema, JsonSchemaVersion.DRAFT07, null, name); this.validator = validatorApi.loadSchema(schemaSource); } @Override protected String toPrettyJson(Object object) { /* - * The validator strips off the "pretty" stuff (i.e., spaces), thus we have to validate - * and generate the pretty JSON in separate steps. + * The validator strips off the "pretty" stuff (i.e., spaces), thus we have to validate and generate the pretty + * JSON in separate steps. */ getGSON().toJson(object, object.getClass(), validatorApi.createJsonWriter(validator, new StringWriter())); @@ -102,7 +100,7 @@ public class StandardValCoder extends StandardCoder { try { conformance(json); } catch (CoderException e) { - logger.info("JSON is not conformant to schema {}", e); + logger.info("JSON is not conformant to schema", e); return false; } return true; |