summaryrefslogtreecommitdiffstats
path: root/integrity-audit
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2018-08-14 19:36:43 +0000
committerGerrit Code Review <gerrit@onap.org>2018-08-14 19:36:43 +0000
commit6509e95ef278ee141c706cb66fe269e146ef888e (patch)
tree211756db7c24dab684bcbab8a981ac9361afcc8e /integrity-audit
parentd40823cd9dc76fee6d77963902fd786222ba15a6 (diff)
parent6505fa1c845c34d59c44a40f87b66ef79f3e911c (diff)
Merge "Fixes for checkstyle issues"
Diffstat (limited to 'integrity-audit')
-rw-r--r--integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java4
-rw-r--r--integrity-audit/src/main/java/org/onap/policy/common/ia/AuditorTime.java4
-rw-r--r--integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAudit.java15
-rw-r--r--integrity-audit/src/main/resources/META-INF/persistence.xml41
-rw-r--r--integrity-audit/src/test/java/org/onap/policy/common/ia/AuditPeriodTest.java2
-rw-r--r--integrity-audit/src/test/java/org/onap/policy/common/ia/AuditorTimeTest.java3
-rw-r--r--integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditTest.java1
-rw-r--r--integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditTestBase.java18
8 files changed, 52 insertions, 36 deletions
diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java
index dc396a07..177391c3 100644
--- a/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java
+++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java
@@ -709,7 +709,7 @@ public class AuditThread extends Thread {
* Indicates that the {@link #run()} method has started. This method simply returns,
* and may overridden by junit tests.
*
- * @throws InterruptedException
+ * @throws InterruptedException can be interrupted
*/
public void runStarted() throws InterruptedException {
// does nothing
@@ -719,7 +719,7 @@ public class AuditThread extends Thread {
* Indicates that an audit has completed. This method simply returns, and may
* overridden by junit tests.
*
- * @throws InterruptedException
+ * @throws InterruptedException can be interrupted
*/
public void auditCompleted() throws InterruptedException {
// does nothing
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 9cff742c..95eecbc3 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
@@ -41,13 +41,15 @@ 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 4d15205a..d50c7059 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
@@ -206,8 +206,10 @@ public class IntegrityAudit {
logger.info("startAuditThread: Entering");
if (integrityAuditPeriodSeconds >= 0) {
- this.auditThread = makeAuditThread(this.resourceName, this.persistenceUnit, this.properties, integrityAuditPeriodSeconds);
- logger.info("startAuditThread: Audit started and will run every " + integrityAuditPeriodSeconds + " seconds");
+ this.auditThread = makeAuditThread(this.resourceName, this.persistenceUnit,
+ this.properties, integrityAuditPeriodSeconds);
+ logger.info("startAuditThread: Audit started and will run every " + integrityAuditPeriodSeconds
+ + " seconds");
this.auditThread.start();
} else {
@@ -269,6 +271,7 @@ public class IntegrityAudit {
}
/**
+ * Return if audit thread.
*
* @return {@code true} if an audit thread exists, {@code false} otherwise
*/
@@ -279,13 +282,13 @@ public class IntegrityAudit {
/**
* Creates an audit thread. May be overridden by junit tests.
*
- * @param resourceName2
- * @param persistenceUnit2
- * @param properties2
+ * @param resourceName2 the resource name
+ * @param persistenceUnit2 the persistence unit
+ * @param properties2 properties
* @param integrityAuditPeriodSeconds2
*
* @return a new audit thread
- * @throws IntegrityAuditException
+ * @throws IntegrityAuditException audit exception
*/
protected AuditThread makeAuditThread(String resourceName2, String persistenceUnit2, Properties properties2,
int integrityAuditPeriodSeconds2) throws IntegrityAuditException {
diff --git a/integrity-audit/src/main/resources/META-INF/persistence.xml b/integrity-audit/src/main/resources/META-INF/persistence.xml
index 2f435618..33c701b1 100644
--- a/integrity-audit/src/main/resources/META-INF/persistence.xml
+++ b/integrity-audit/src/main/resources/META-INF/persistence.xml
@@ -20,24 +20,27 @@
-->
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
- <persistence-unit name="testPU" transaction-type="RESOURCE_LOCAL">
- <!-- Limited use for generating the DB and schema files for iatest DB - uses eclipselink -->
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.onap.policy.common.ia.jpa.IntegrityAuditEntity</class>
- <class>org.onap.policy.common.ia.jpa.IaTestEntity</class>
- <shared-cache-mode>NONE</shared-cache-mode>
- <properties>
- <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
- </properties>
- </persistence-unit>
+ <persistence-unit name="testPU" transaction-type="RESOURCE_LOCAL">
+ <!-- Limited use for generating the DB and schema files for iatest DB -
+ uses eclipselink -->
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <class>org.onap.policy.common.ia.jpa.IntegrityAuditEntity</class>
+ <class>org.onap.policy.common.ia.jpa.IaTestEntity</class>
+ <shared-cache-mode>NONE</shared-cache-mode>
+ <properties>
+ <property name="javax.persistence.schema-generation.database.action"
+ value="drop-and-create" />
+ </properties>
+ </persistence-unit>
- <persistence-unit name="integrityAuditPU" transaction-type="RESOURCE_LOCAL">
- <!-- For operational use -->
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.onap.policy.common.ia.jpa.IntegrityAuditEntity</class>
- <shared-cache-mode>NONE</shared-cache-mode>
- <properties>
- <!-- none -->
- </properties>
- </persistence-unit>
+ <persistence-unit name="integrityAuditPU"
+ transaction-type="RESOURCE_LOCAL">
+ <!-- For operational use -->
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <class>org.onap.policy.common.ia.jpa.IntegrityAuditEntity</class>
+ <shared-cache-mode>NONE</shared-cache-mode>
+ <properties>
+ <!-- none -->
+ </properties>
+ </persistence-unit>
</persistence>
diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/AuditPeriodTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/AuditPeriodTest.java
index 5baf21ad..9aad6863 100644
--- a/integrity-audit/src/test/java/org/onap/policy/common/ia/AuditPeriodTest.java
+++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/AuditPeriodTest.java
@@ -227,7 +227,7 @@ public class AuditPeriodTest extends IntegrityAuditTestBase {
runAudit(p);
long elapsed = p.getTimeInMillis() - tbegin;
- synchronized(tmin) {
+ synchronized (tmin) {
tmin.set(Math.min(tmin.get(), elapsed));
}
diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/AuditorTimeTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/AuditorTimeTest.java
index 6ee10102..7da157f2 100644
--- a/integrity-audit/src/test/java/org/onap/policy/common/ia/AuditorTimeTest.java
+++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/AuditorTimeTest.java
@@ -21,11 +21,12 @@
package org.onap.policy.common.ia;
import static org.junit.Assert.*;
+
import org.junit.Test;
import org.onap.policy.common.utils.time.CurrentTime;
/**
- *
+ * Tests the AuditorTime class.
*/
public class AuditorTimeTest {
diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditTest.java
index e7ea47e0..8e848787 100644
--- a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditTest.java
+++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditTest.java
@@ -23,6 +23,7 @@ package org.onap.policy.common.ia;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;
+
import java.util.List;
import java.util.Properties;
import javax.persistence.EntityManager;
diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditTestBase.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditTestBase.java
index 94ee0297..9324dfb4 100644
--- a/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditTestBase.java
+++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditTestBase.java
@@ -22,6 +22,9 @@ package org.onap.policy.common.ia;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@@ -45,8 +48,6 @@ import org.onap.policy.common.utils.time.CurrentTime;
import org.onap.policy.common.utils.time.TestTime;
import org.powermock.reflect.Whitebox;
import org.slf4j.LoggerFactory;
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
/**
* All JUnits are designed to run in the local development environment where they have write
@@ -267,6 +268,8 @@ public class IntegrityAuditTestBase {
}
/**
+ * Get the test time.
+ *
* @return the {@link TestTime} in use by this thread
*/
public static TestTime getTestTime() {
@@ -521,10 +524,11 @@ public class IntegrityAuditTestBase {
* @param resourceName the resource name
* @param persistenceUnit the persistence unit
* @param properties the properties
- * @param time
+ * @param time the time
* @throws Exception if an error occurs
*/
- public MyIntegrityAudit(String resourceName, String persistenceUnit, Properties properties, TestTime time) throws Exception {
+ public MyIntegrityAudit(String resourceName, String persistenceUnit,
+ Properties properties, TestTime time) throws Exception {
super(resourceName, persistenceUnit, properties);
myTime = time;
@@ -536,6 +540,8 @@ public class IntegrityAuditTestBase {
}
/**
+ * Get time in milliseconds.
+ *
* @return the "current" time for the auditor
*/
public long getTimeInMillis() {
@@ -545,8 +551,8 @@ public class IntegrityAuditTestBase {
/**
* Sleeps for a period of time.
*
- * @param sleepMs
- * @throws InterruptedException
+ * @param sleepMs time to sleep
+ * @throws InterruptedException can be interrupted
*/
public void sleep(long sleepMs) throws InterruptedException {
myTime.sleep(sleepMs);