diff options
author | Jim Hahn <jrh3@att.com> | 2021-06-17 22:22:41 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-06-17 22:22:41 +0000 |
commit | 94e970a0df2c8a92af7945214e80a9d70e4c6372 (patch) | |
tree | d3e35dec73f96bebae4f4d43f4dc2dc9c64d9e67 /integrity-monitor/src/main/java | |
parent | 435c3bd346a5f8050cc22df9df223479e5f32573 (diff) | |
parent | 20ec0e70ce690083d65286815ed5e866042881a2 (diff) |
Merge "Use lombok annotations in IM and ONAP logging"
Diffstat (limited to 'integrity-monitor/src/main/java')
9 files changed, 54 insertions, 278 deletions
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 71a5db06..d4454db3 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 @@ -44,6 +44,8 @@ import javax.persistence.FlushModeType; import javax.persistence.LockModeType; import javax.persistence.Persistence; import javax.persistence.TypedQuery; +import lombok.Getter; +import lombok.Setter; import org.apache.commons.lang3.StringUtils; import org.eclipse.persistence.config.PersistenceUnitProperties; import org.onap.policy.common.im.jmx.ComponentAdmin; @@ -104,6 +106,7 @@ public class IntegrityMonitor { public static final long CYCLE_INTERVAL_MILLIS = 1000L; + @Getter private StateManagement stateManager = null; /** @@ -162,7 +165,9 @@ public class IntegrityMonitor { // For non-lead subsystems, the dependency_group property will be absent. private static String[] depGroups = null; - private static boolean isUnitTesting = false; + @Getter + @Setter + private static boolean unitTesting = false; // can turn on health checking of dependents via jmx test() call by setting // this property to true @@ -198,7 +203,9 @@ public class IntegrityMonitor { private final Object refreshStateAuditLock = new Object(); private final Object imFlushLock = new Object(); + @Getter private Map<String, String> allSeemsWellMap; + @Getter private Map<String, String> allNotWellMap; /** @@ -1254,11 +1261,6 @@ public class IntegrityMonitor { } } - // retrieve state manager reference - public final StateManagement getStateManager() { - return this.stateManager; - } - /** * Read and validate properties. * @@ -1894,14 +1896,6 @@ public class IntegrityMonitor { return (value < 0 ? -1 : value * 1000L); } - public Map<String, String> getAllSeemsWellMap() { - return allSeemsWellMap; - } - - public Map<String, String> getAllNotWellMap() { - return allNotWellMap; - } - // these methods may be overridden by junit tests /** @@ -1930,16 +1924,4 @@ public class IntegrityMonitor { protected String getPersistenceUnit() { return PERSISTENCE_UNIT; } - - /* - * The remaining methods are used by JUnit tests. - */ - - public static boolean isUnitTesting() { - return isUnitTesting; - } - - public static void setUnitTesting(boolean isUnitTesting) { - IntegrityMonitor.isUnitTesting = isUnitTesting; - } } diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorProperties.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorProperties.java index 252fd27b..75aed5b3 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorProperties.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitorProperties.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Integrity Monitor * ================================================================================ - * Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018, 2020-2021 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,7 +20,11 @@ package org.onap.policy.common.im; -public class IntegrityMonitorProperties { +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class IntegrityMonitorProperties { public static final String DB_DRIVER = "javax.persistence.jdbc.driver"; public static final String DB_URL = "javax.persistence.jdbc.url"; @@ -54,8 +58,4 @@ public class IntegrityMonitorProperties { // AllSeemsWell types public static final Boolean ALLNOTWELL = Boolean.FALSE; public static final Boolean ALLSEEMSWELL = Boolean.TRUE; - - private IntegrityMonitorProperties() { - // Private constructor to prevent subclassing - } } diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/MonitorTime.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/MonitorTime.java index e489a8c1..61afb682 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/MonitorTime.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/MonitorTime.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * Integrity Monitor * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018, 2021 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. @@ -20,31 +20,20 @@ package org.onap.policy.common.im; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; import org.onap.policy.common.utils.time.CurrentTime; /** * "Current" time used by IntegrityMonitor classes. */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) public class MonitorTime { /** * Instance to be used. This is overridden by junit tests. */ + @Getter private static CurrentTime instance = new CurrentTime(); - - /** - * Constructor. - */ - private MonitorTime() { - super(); - } - - /** - * Get instance. - * - * @return the CurrentTime singleton - */ - public static CurrentTime getInstance() { - return instance; - } } diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateChangeNotifier.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateChangeNotifier.java index eee3a9ef..5fc111e0 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateChangeNotifier.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateChangeNotifier.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Integrity Monitor * ================================================================================ - * Copyright (C) 2017, 2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2020-2021 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,6 +20,7 @@ package org.onap.policy.common.im; +import lombok.Getter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /* @@ -43,6 +44,7 @@ import org.slf4j.LoggerFactory; * StateManagement class. * */ +@Getter public class StateChangeNotifier { private static final Logger logger = LoggerFactory.getLogger(StateChangeNotifier.class); // The observable class @@ -71,12 +73,4 @@ public class StateChangeNotifier { logger.debug("handleStateChange, message: {}", this.message); } } - - public StateManagement getStateManagement() { - return stateManagement; - } - - public String getMessage() { - return message; - } } diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateElement.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateElement.java index 73724b30..d1bc9cc1 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateElement.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateElement.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Integrity Monitor * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019, 2021 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. @@ -21,12 +21,14 @@ package org.onap.policy.common.im; import lombok.Getter; +import lombok.NoArgsConstructor; import lombok.Setter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Getter @Setter +@NoArgsConstructor public class StateElement { private static final Logger logger = LoggerFactory.getLogger(StateElement.class); @@ -41,10 +43,6 @@ public class StateElement { String endingStandbyStatus = null; String exception = null; - public StateElement() { - // Empty constructor - } - /** * Display the state element. */ diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java index 2f9544e9..ad1ef365 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java @@ -33,6 +33,10 @@ import javax.persistence.PreUpdate; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; /* * The Entity class to persist a policy object ForwardProgress */ @@ -43,7 +47,9 @@ import org.onap.policy.common.im.MonitorTime; @NamedQuery(name = " ForwardProgressEntity.findAll", query = "SELECT e FROM ForwardProgressEntity e ") @NamedQuery(name = "ForwardProgressEntity.deleteAll", query = "DELETE FROM ForwardProgressEntity WHERE 1=1") // @SequenceGenerator(name="seqForwardProgress", initialValue=1, allocationSize=1) - +@Getter +@Setter +@NoArgsConstructor public class ForwardProgressEntity implements Serializable { private static final long serialVersionUID = 1L; @@ -51,6 +57,7 @@ public class ForwardProgressEntity implements Serializable { // @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqForwardProgress") @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "forwardProgressId") + @Setter(AccessLevel.NONE) private long forwardProgressId; @Column(name = "resourceName", nullable = false, length = 100, unique = true) @@ -67,10 +74,6 @@ public class ForwardProgressEntity implements Serializable { @Column(name = "last_updated") private Date lastUpdated; - public ForwardProgressEntity() { - // default constructor - } - /** * PrePersist callback method. */ @@ -86,57 +89,4 @@ public class ForwardProgressEntity implements Serializable { public void preUpdate() { this.lastUpdated = MonitorTime.getInstance().getDate(); } - - /** - * Get the forward progress Id. - * - * @return the Id - */ - public long getForwardProgressId() { - return forwardProgressId; - } - - public String getResourceName() { - return this.resourceName; - } - - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - - /** - * Get the fpcCount. - * - * @return the fpcCount - */ - public long getFpcCount() { - return fpcCount; - } - - /** - * Set the fpcCount. - * - * @param fpcCount the fpcCount to set - */ - public void setFpcCount(long fpcCount) { - this.fpcCount = fpcCount; - } - - /** - * Get the lastUpdated. - * - * @return the lastUpdated - */ - public Date getLastUpdated() { - return lastUpdated; - } - - /** - * Set the lastUpdated. - * - * @param lastUpdated the lastUpdated to set - */ - public void setLastUpdated(Date lastUpdated) { - this.lastUpdated = lastUpdated; - } } diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java index 858a3f77..2b7b3d74 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java @@ -33,6 +33,10 @@ import javax.persistence.PreUpdate; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.onap.policy.common.im.MonitorTime; @Entity @@ -40,7 +44,9 @@ import org.onap.policy.common.im.MonitorTime; @NamedQuery(name = " ImTestEntity.findAll", query = "SELECT e FROM ImTestEntity e ") @NamedQuery(name = "ImTestEntity.deleteAll", query = "DELETE FROM ImTestEntity WHERE 1=1") // @SequenceGenerator(name="seqImTest", initialValue=1, allocationSize=1) - +@Getter +@Setter +@NoArgsConstructor public class ImTestEntity implements Serializable { private static final long serialVersionUID = 1L; @@ -48,6 +54,7 @@ public class ImTestEntity implements Serializable { // @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqImTest") @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "ImTestId") + @Setter(AccessLevel.NONE) private long imTestId; @Column(name = "created_by", nullable = false, length = 255) @@ -64,10 +71,6 @@ public class ImTestEntity implements Serializable { @Column(name = "modified_date", nullable = false) private Date modifiedDate; - public ImTestEntity() { - // default constructor - } - /** * PrePersist callback method. */ @@ -82,76 +85,4 @@ public class ImTestEntity implements Serializable { public void preUpdate() { this.modifiedDate = MonitorTime.getInstance().getDate(); } - - /** - * Get the Im test Id. - * - * @return the Id - */ - public long getImTestId() { - return imTestId; - } - - /** - * Get the createdBy. - * - * @return the createdBy - */ - public String getCreatedBy() { - return createdBy; - } - - /** - * Set the createdBy. - * - * @param createdBy the createdBy to set - */ - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - /** - * Get the modifiedBy. - * - * @return the modifiedBy - */ - public String getModifiedBy() { - return modifiedBy; - } - - /** - * Set the ModifiedBy. - * - * @param modifiedBy the modifiedBy to set - */ - public void setModifiedBy(String modifiedBy) { - this.modifiedBy = modifiedBy; - } - - /** - * Get the modifiedDate. - * - * @return the modifiedDate - */ - public Date getModifiedDate() { - return modifiedDate; - } - - /** - * Set the modifiedDate. - * - * @param modifiedDate the modifiedDate to set - */ - public void setModifiedDate(Date modifiedDate) { - this.modifiedDate = modifiedDate; - } - - /** - * Get the createdDate. - * - * @return the createdDate - */ - public Date getCreatedDate() { - return createdDate; - } } diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java index 0e654d36..1754c405 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java @@ -33,6 +33,10 @@ import javax.persistence.PreUpdate; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.onap.policy.common.im.MonitorTime; /* * The Entity class to persist a policy object ResourceRegistration @@ -43,7 +47,9 @@ import org.onap.policy.common.im.MonitorTime; @NamedQuery(name = " ResourceRegistrationEntity.findAll", query = "SELECT e FROM ResourceRegistrationEntity e ") @NamedQuery(name = "ResourceRegistrationEntity.deleteAll", query = "DELETE FROM ResourceRegistrationEntity WHERE 1=1") // @SequenceGenerator(name="seqResourceRegistration", initialValue=1, allocationSize=1) - +@Getter +@Setter +@NoArgsConstructor public class ResourceRegistrationEntity implements Serializable { private static final long serialVersionUID = 1L; @@ -51,6 +57,7 @@ public class ResourceRegistrationEntity implements Serializable { // @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqResourceRegistration") @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "ResourceRegistrationId") + @Setter(AccessLevel.NONE) private long resourceRegistrationId; @Column(name = "resourceName", nullable = false, length = 100, unique = true) @@ -73,10 +80,6 @@ public class ResourceRegistrationEntity implements Serializable { @Column(name = "last_updated") private Date lastUpdated; - public ResourceRegistrationEntity() { - // default constructor - } - /** * PrePersist callback method. */ @@ -91,72 +94,4 @@ public class ResourceRegistrationEntity implements Serializable { public void preUpdate() { this.lastUpdated = MonitorTime.getInstance().getDate(); } - - /** - * Get the resource registration Id. - * - * @return the Id - */ - public long getResourceRegistrationId() { - return resourceRegistrationId; - } - - public String getResourceName() { - return this.resourceName; - } - - public void setResourceName(String resourceName) { - this.resourceName = resourceName; - } - - public String getResourceUrl() { - return this.resourceUrl; - } - - public void setResourceUrl(String resourceUrl) { - this.resourceUrl = resourceUrl; - } - - public String getSite() { - return this.site; - } - - public void setSite(String site) { - this.site = site; - } - - public String getNodeType() { - return this.nodeType; - } - - public void setNodeType(String nodeType) { - this.nodeType = nodeType; - } - - /** - * Get the createdDate. - * - * @return the createdDate - */ - public Date getCreatedDate() { - return createdDate; - } - - /** - * Get the lastUpdated. - * - * @return the lastUpdated - */ - public Date getLastUpdated() { - return lastUpdated; - } - - /** - * Set the lastUpdated. - * - * @param lastUpdated the lastUpdated to set - */ - public void setLastUpdated(Date lastUpdated) { - this.lastUpdated = lastUpdated; - } } diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java index b13d3a76..c04a1b3a 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java @@ -35,6 +35,7 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import lombok.AccessLevel; import lombok.Getter; +import lombok.NoArgsConstructor; import lombok.Setter; import org.onap.policy.common.im.MonitorTime; @@ -45,7 +46,7 @@ import org.onap.policy.common.im.MonitorTime; @Getter @Setter - +@NoArgsConstructor public class StateManagementEntity implements Serializable { private static final long serialVersionUID = 1L; @@ -81,10 +82,6 @@ public class StateManagementEntity implements Serializable { @Column(name = "modifiedDate", nullable = false) private Date modifiedDate; - public StateManagementEntity() { - // default constructor - } - @PrePersist public void prePersist() { this.createdDate = MonitorTime.getInstance().getDate(); |