summaryrefslogtreecommitdiffstats
path: root/integrity-audit/src/main/java/org
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-06-16 17:45:03 -0400
committerJim Hahn <jrh3@att.com>2021-06-16 18:06:08 -0400
commit435c3bd346a5f8050cc22df9df223479e5f32573 (patch)
treec7561a9af77cad9e6e95da1dc602544d7e738af4 /integrity-audit/src/main/java/org
parent8bec395a3d4ddff8bd0daca685f3e2162a9b5193 (diff)
Use lombok in common params
Also condensed some Map calls. Issue-ID: POLICY-3394 Change-Id: I850fcad5a72d92271da76b0731195e8b93dd4089 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'integrity-audit/src/main/java/org')
-rw-r--r--integrity-audit/src/main/java/org/onap/policy/common/ia/AuditorTime.java18
-rw-r--r--integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAudit.java32
-rw-r--r--integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAuditProperties.java11
-rw-r--r--integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java118
4 files changed, 33 insertions, 146 deletions
diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditorTime.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditorTime.java
index 95eecbc3..5bfedaac 100644
--- a/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditorTime.java
+++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditorTime.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* Integrity Audit
* ================================================================================
- * 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.
@@ -21,11 +21,14 @@
package org.onap.policy.common.ia;
import java.util.function.Supplier;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
import org.onap.policy.common.utils.time.CurrentTime;
/**
* "Current" time used by IntegrityMonitor classes.
*/
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class AuditorTime {
/**
@@ -41,15 +44,8 @@ public class AuditorTime {
private static Supplier<CurrentTime> supplier = () -> currentTime;
/**
- * Constructor.
- */
- private AuditorTime() {
- super();
- }
-
- /**
* Get instance.
- *
+ *
* @return the CurrentTime singleton
*/
public static CurrentTime getInstance() {
diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAudit.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAudit.java
index 10900e3c..66ab307c 100644
--- a/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAudit.java
+++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAudit.java
@@ -21,6 +21,8 @@
package org.onap.policy.common.ia;
import java.util.Properties;
+import lombok.Getter;
+import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import org.onap.policy.common.ia.IntegrityAuditProperties.NodeTypeEnum;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
@@ -34,8 +36,12 @@ public class IntegrityAudit {
private static final Logger logger = FlexLogger.getLogger(IntegrityAudit.class);
- private static boolean isUnitTesting;
- private boolean isThreadInitialized = false;
+ @Getter
+ @Setter
+ private static boolean unitTesting;
+
+ @Getter
+ private boolean threadInitialized = false;
AuditThread auditThread = null;
@@ -54,6 +60,7 @@ public class IntegrityAudit {
* indicated period
*
*/
+ @Getter
private int integrityAuditPeriodSeconds;
/**
@@ -94,13 +101,6 @@ public class IntegrityAudit {
}
/**
- * Used during JUnit testing by AuditPeriodTest.java
- */
- public int getIntegrityAuditPeriodSeconds() {
- return integrityAuditPeriodSeconds;
- }
-
- /**
* Determine if the nodeType conforms to the required node types.
*/
public static boolean isNodeTypeEnum(String nt) {
@@ -237,21 +237,9 @@ public class IntegrityAudit {
logger.info("stopAuditThread: Exiting");
}
- public boolean isThreadInitialized() {
- return isThreadInitialized;
- }
-
public void setThreadInitialized(boolean isThreadInitialized) {
logger.info("setThreadInitialized: Setting isThreadInitialized=" + isThreadInitialized);
- this.isThreadInitialized = isThreadInitialized;
- }
-
- public static boolean isUnitTesting() {
- return isUnitTesting;
- }
-
- public static void setUnitTesting(boolean isUnitTesting) {
- IntegrityAudit.isUnitTesting = isUnitTesting;
+ this.threadInitialized = isThreadInitialized;
}
/**
diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAuditProperties.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAuditProperties.java
index 365afd25..9122b721 100644
--- a/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAuditProperties.java
+++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAuditProperties.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Audit
* ================================================================================
- * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-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,10 @@
package org.onap.policy.common.ia;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class IntegrityAuditProperties {
public static final int DEFAULT_AUDIT_PERIOD_SECONDS = -1; // Audit does not run
@@ -38,9 +42,4 @@ public class IntegrityAuditProperties {
PDP_XACML, PDP_DROOLS, PAP, PAP_ADMIN, LOGPARSER, BRMS_GATEWAY, ASTRA_GATEWAY, ELK_SERVER, PYPDP
}
-
- private IntegrityAuditProperties() {
-
- }
-
}
diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java
index 1c8277c0..37688859 100644
--- a/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java
+++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java
@@ -35,6 +35,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 for management of IntegrityAudits
*/
@@ -44,15 +48,20 @@ import org.onap.policy.common.ia.AuditorTime;
@Table(name = "IntegrityAuditEntity")
@NamedQuery(name = " IntegrityAuditEntity.findAll", query = "SELECT e FROM IntegrityAuditEntity e ")
@NamedQuery(name = "IntegrityAuditEntity.deleteAll", query = "DELETE FROM IntegrityAuditEntity WHERE 1=1")
-
+@NoArgsConstructor
+@Getter
+@Setter
public class IntegrityAuditEntity implements Serializable {
private static final long serialVersionUID = 1L;
- private static boolean isUnitTesting;
+ @Getter
+ @Setter
+ private static boolean unitTesting;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
+ @Setter(AccessLevel.PRIVATE)
private long id;
@Column(name = "persistenceUnit", nullable = false)
@@ -90,11 +99,6 @@ public class IntegrityAuditEntity implements Serializable {
@Column(name = "lastUpdated")
private Date lastUpdated;
-
- public IntegrityAuditEntity() {
- // Empty constructor
- }
-
/**
* Pre persist.
*/
@@ -110,106 +114,6 @@ public class IntegrityAuditEntity implements Serializable {
this.lastUpdated = AuditorTime.getInstance().getDate();
}
- public long getId() {
- return id;
- }
-
- public String getPersistenceUnit() {
- return persistenceUnit;
- }
-
- public void setPersistenceUnit(String persistenceUnit) {
- this.persistenceUnit = persistenceUnit;
- }
-
- public String getSite() {
- return site;
- }
-
- public void setSite(String site) {
- this.site = site;
- }
-
- public String getNodeType() {
- return nodeType;
- }
-
- public void setNodeType(String nodeType) {
- this.nodeType = nodeType;
- }
-
- public String getResourceName() {
- return resourceName;
- }
-
- public void setResourceName(String resourceName) {
- this.resourceName = resourceName;
- }
-
- public boolean isDesignated() {
- return designated;
- }
-
- public void setDesignated(boolean designated) {
- this.designated = designated;
- }
-
- public String getJdbcDriver() {
- return jdbcDriver;
- }
-
- public void setJdbcDriver(String jdbcDriver) {
- this.jdbcDriver = jdbcDriver;
- }
-
- public String getJdbcUrl() {
- return jdbcUrl;
- }
-
- public void setJdbcUrl(String jdbcUrl) {
- this.jdbcUrl = jdbcUrl;
- }
-
- public String getJdbcUser() {
- return jdbcUser;
- }
-
- public void setJdbcUser(String jdbcUser) {
- this.jdbcUser = jdbcUser;
- }
-
- public String getJdbcPassword() {
- return jdbcPassword;
- }
-
- public void setJdbcPassword(String jdbcPassword) {
- this.jdbcPassword = jdbcPassword;
- }
-
- public Date getLastUpdated() {
- return lastUpdated;
- }
-
- public void setLastUpdated(Date lastUpdated) {
- this.lastUpdated = lastUpdated;
- }
-
- public Date getCreatedDate() {
- return createdDate;
- }
-
- public void setCreatedDate(Date created) {
- this.createdDate = created;
- }
-
- public static boolean isUnitTesting() {
- return isUnitTesting;
- }
-
- public static void setUnitTesting(boolean isUnitTesting) {
- IntegrityAuditEntity.isUnitTesting = isUnitTesting;
- }
-
private void writeObject(ObjectOutputStream out) throws IOException {
if (isUnitTesting()) {
/*