diff options
author | Jim Hahn <jrh3@att.com> | 2019-06-19 17:31:24 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-06-21 11:36:18 -0400 |
commit | c9392e1a126de54ae8a0e1f3316729e878115300 (patch) | |
tree | 5a371d53f5e6cf8bedbb4daf94f558844037fd7d /integrity-audit/src/test/java | |
parent | 62463da9961f7e524559b34766baf2dd469fa910 (diff) |
Fix sonar issues in integrity audit
Mostly used Eclipse Refactor->Extract Method to reduce cyclomatic
complexity. Also combined a few "if" statements to reduce nesting
levels.
Also addressed some sonar issues in the tests (e.g., use "<>" where
appropriate).
Did not attempt to increase junit coverage.
Change-Id: I9d6c1305ce455f0d64249b548d123bb9bf37292a
Issue-ID: POLICY-1791
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'integrity-audit/src/test/java')
8 files changed, 176 insertions, 183 deletions
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 9aad6863..b5a4eeea 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 @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * Integrity Audit * ================================================================================ - * 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. @@ -25,9 +25,6 @@ import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicLong; - -//import org.apache.commons.logging.Log; -//import org.apache.commons.logging.LogFactory; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; @@ -100,7 +97,7 @@ public class AuditPeriodTest extends IntegrityAuditTestBase { /* * Sleep long enough to allow - * + * * 1) audit to immediately terminate. */ waitThread(integrityAudit); @@ -129,7 +126,7 @@ public class AuditPeriodTest extends IntegrityAuditTestBase { /* * Wait for - * + * * 1) audit to generate a bunch of sleep wake sequences. */ String[] awakings = new String[10]; @@ -170,12 +167,12 @@ public class AuditPeriodTest extends IntegrityAuditTestBase { /** * Verifies that audits actually take as long as expected, even with multiple auditors running * simultaneously. - * + * * @param periodSec audit period, in seconds * @throws Exception if an error occurs * @throws InterruptedException if the thread is interrupted */ - private void testAuditPeriod(long periodSec) throws Exception, InterruptedException { + private void testAuditPeriod(long periodSec) throws Exception { properties.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, String.valueOf(periodSec)); @@ -207,7 +204,7 @@ public class AuditPeriodTest extends IntegrityAuditTestBase { /** * Runs simultaneous audits on several auditors. - * + * * @param auditors the auditors * @return the minimum time, in milliseconds, elapsed for any given auditor * @throws InterruptedException if the thread is interrupted @@ -226,13 +223,13 @@ public class AuditPeriodTest extends IntegrityAuditTestBase { long tbegin = p.getTimeInMillis(); runAudit(p); long elapsed = p.getTimeInMillis() - tbegin; - + synchronized (tmin) { tmin.set(Math.min(tmin.get(), elapsed)); } } catch (InterruptedException e) { - ; + Thread.currentThread().interrupt(); } } }; diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditCompareEntriesTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditCompareEntriesTest.java index a5d0ef1b..965712a2 100644 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditCompareEntriesTest.java +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditCompareEntriesTest.java @@ -7,9 +7,9 @@ * 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. @@ -49,6 +49,7 @@ import org.onap.policy.common.logging.flexlogger.Logger; * tasks. */ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { + private static final String ZAPHOD = "Zaphod"; private static Logger logger = FlexLogger.getLogger(DbAuditCompareEntriesTest.class); @@ -113,7 +114,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { // anyway Set<String> classNameSet = dbDao.getPersistenceClassNames(); for (String c : classNameSet) { - if (c.equals("org.onap.policy.common.ia.jpa.IntegrityAuditEntity")) { + if ("org.onap.policy.common.ia.jpa.IntegrityAuditEntity".equals(c)) { className = c; } } @@ -129,7 +130,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { */ entry1.setDesignated(false); entry1.setJdbcDriver(dbDriver); - entry1.setJdbcPassword(dbPwd); + entry1.setJdbcPassword(dbPass); entry1.setJdbcUrl(dbUrl); entry1.setJdbcUser(dbUser); entry1.setLastUpdated(date); @@ -140,7 +141,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { entry2.setDesignated(false); entry2.setJdbcDriver(dbDriver); - entry2.setJdbcPassword(dbPwd); + entry2.setJdbcPassword(dbPass); entry2.setJdbcUrl(dbUrl); entry2.setJdbcUser(dbUser); entry2.setLastUpdated(date); @@ -151,8 +152,8 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { dbAudit.writeAuditDebugLog(className, resourceName1, resourceName2, entry1, entry2); - HashMap<Object, Object> myEntries = new HashMap<Object, Object>(); - HashMap<Object, Object> theirEntries = new HashMap<Object, Object>(); + HashMap<Object, Object> myEntries = new HashMap<>(); + HashMap<Object, Object> theirEntries = new HashMap<>(); myEntries.put("pdp1", entry1); theirEntries.put("pdp1", entry2); @@ -190,7 +191,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { */ entry1.setDesignated(false); entry1.setJdbcDriver(dbDriver); - entry1.setJdbcPassword(dbPwd); + entry1.setJdbcPassword(dbPass); entry1.setJdbcUrl(dbUrl); entry1.setJdbcUser(dbUser); entry1.setLastUpdated(date); @@ -201,7 +202,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { entry2.setDesignated(true); entry2.setJdbcDriver(dbDriver); - entry2.setJdbcPassword(dbPwd); + entry2.setJdbcPassword(dbPass); entry2.setJdbcUrl(dbUrl); entry2.setJdbcUser(dbUser); entry2.setLastUpdated(date); @@ -210,8 +211,8 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { entry2.setResourceName(resourceName2); entry2.setSite(siteName); - HashMap<Object, Object> myEntries = new HashMap<Object, Object>(); - HashMap<Object, Object> theirEntries = new HashMap<Object, Object>(); + HashMap<Object, Object> myEntries = new HashMap<>(); + HashMap<Object, Object> theirEntries = new HashMap<>(); myEntries.put("pdp1", entry1); theirEntries.put("pdp1", entry2); @@ -253,7 +254,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { */ entry1.setDesignated(false); entry1.setJdbcDriver(dbDriver); - entry1.setJdbcPassword(dbPwd); + entry1.setJdbcPassword(dbPass); entry1.setJdbcUrl(dbUrl); entry1.setJdbcUser(dbUser); entry1.setLastUpdated(date); @@ -264,7 +265,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { entry2.setDesignated(true); entry2.setJdbcDriver(dbDriver); - entry2.setJdbcPassword(dbPwd); + entry2.setJdbcPassword(dbPass); entry2.setJdbcUrl(dbUrl); entry2.setJdbcUser(dbUser); entry2.setLastUpdated(date); @@ -275,7 +276,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { entry3.setDesignated(false); entry3.setJdbcDriver(dbDriver); - entry3.setJdbcPassword(dbPwd); + entry3.setJdbcPassword(dbPass); entry3.setJdbcUrl(dbUrl); entry3.setJdbcUser(dbUser); entry3.setLastUpdated(date); @@ -286,7 +287,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { entry4.setDesignated(false); entry4.setJdbcDriver(dbDriver); - entry4.setJdbcPassword(dbPwd); + entry4.setJdbcPassword(dbPass); entry4.setJdbcUrl(dbUrl); entry4.setJdbcUser(dbUser); entry4.setLastUpdated(date); @@ -295,8 +296,8 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { entry4.setResourceName(resourceName2); entry4.setSite("SiteB"); - HashMap<Object, Object> myEntries = new HashMap<Object, Object>(); - HashMap<Object, Object> theirEntries = new HashMap<Object, Object>(); + HashMap<Object, Object> myEntries = new HashMap<>(); + HashMap<Object, Object> theirEntries = new HashMap<>(); myEntries.put("0", entry1); myEntries.put("1", entry3); @@ -325,9 +326,8 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { DbAudit dbAudit = new DbAudit(dbDao); Set<String> classNameSet = dbDao.getPersistenceClassNames(); - Set<Object> mismatchResult = new HashSet<Object>(); for (String className : classNameSet) { - if (className.equals("org.onap.policy.common.ia.jpa.IntegrityAuditEntity")) { + if ("org.onap.policy.common.ia.jpa.IntegrityAuditEntity".equals(className)) { final String resourceName1 = resourceName; final String resourceName2 = resourceName; @@ -340,7 +340,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { */ entry1.setDesignated(false); entry1.setJdbcDriver(dbDriver); - entry1.setJdbcPassword(dbPwd); + entry1.setJdbcPassword(dbPass); entry1.setJdbcUrl(dbUrl); entry1.setJdbcUser(dbUser); entry1.setLastUpdated(date); @@ -351,7 +351,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { entry2.setDesignated(false); entry2.setJdbcDriver(dbDriver); - entry2.setJdbcPassword(dbPwd); + entry2.setJdbcPassword(dbPass); entry2.setJdbcUrl(dbUrl); entry2.setJdbcUser(dbUser); entry2.setLastUpdated(date); @@ -360,19 +360,17 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { entry2.setResourceName(resourceName2); entry2.setSite(siteName); - HashMap<Object, Object> myEntries = new HashMap<Object, Object>(); - HashMap<Object, Object> theirEntries = new HashMap<Object, Object>(); + HashMap<Object, Object> myEntries = new HashMap<>(); + HashMap<Object, Object> theirEntries = new HashMap<>(); myEntries.put("pdp1", entry1); theirEntries.put("pdp1", entry2); - mismatchResult = dbAudit.compareEntries(myEntries, theirEntries); - /* * Assert there was no mismatches */ - assertTrue(mismatchResult.isEmpty()); - } else if (className.equals("org.onap.policy.common.ia.jpa.IaTestEntity")) { + assertTrue(dbAudit.compareEntries(myEntries, theirEntries).isEmpty()); + } else if ("org.onap.policy.common.ia.jpa.IaTestEntity".equals(className)) { final IaTestEntity iate = new IaTestEntity(); final IaTestEntity iate2 = new IaTestEntity(); final IaTestEntity iate3 = new IaTestEntity(); @@ -388,10 +386,10 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { iate.setModifiedDate(date); iate2.setCreatedBy("Ford"); - iate2.setModifiedBy("Zaphod"); + iate2.setModifiedBy(ZAPHOD); iate2.setModifiedDate(date); - iate3.setCreatedBy("Zaphod"); + iate3.setCreatedBy(ZAPHOD); iate3.setModifiedBy("Ford"); iate3.setModifiedDate(date); @@ -399,20 +397,19 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { iate4.setModifiedBy("Ford"); iate4.setModifiedDate(date); - HashMap<Object, Object> myEntries = new HashMap<Object, Object>(); - HashMap<Object, Object> theirEntries = new HashMap<Object, Object>(); + HashMap<Object, Object> myEntries = new HashMap<>(); + HashMap<Object, Object> theirEntries = new HashMap<>(); myEntries.put("0", iate); myEntries.put("1", iate2); theirEntries.put("0", iate3); theirEntries.put("1", iate4); - mismatchResult = dbAudit.compareEntries(myEntries, theirEntries); /* * Assert that there is 2 mismatches */ - assertEquals(2, mismatchResult.size()); + assertEquals(2, dbAudit.compareEntries(myEntries, theirEntries).size()); } } @@ -454,7 +451,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { Set<String> classNameSet = dbDao.getPersistenceClassNames(); Map<Object, Object> myEntries; Map<Object, Object> theirEntries; - Set<Object> mismatchResult = new HashSet<Object>(); + Set<Object> mismatchResult = new HashSet<>(); for (String className : classNameSet) { logger.info("classNameSet entry = " + className); myEntries = dbDao.getAllEntries(A_SEQ_PU, properties, className); @@ -475,7 +472,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { /** * Truncate the tables. - * + * * @param properties the properties */ private void truncateTables(Properties properties) { @@ -499,7 +496,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { // anyway Set<String> classNameSet = dbDao.getPersistenceClassNames(); for (String classNameInClassNameSet : classNameSet) { - if (classNameInClassNameSet.equals("org.onap.policy.common.ia.jpa.IaTestEntity")) { + if ("org.onap.policy.common.ia.jpa.IaTestEntity".equals(classNameInClassNameSet)) { className = classNameInClassNameSet; } } @@ -510,7 +507,7 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { final Date date = new Date(); PersonSample person = new PersonSample("Ford", "Prefect", 21); - PersonSample person2 = new PersonSample("Zaphod", "Beeblebrox", 25); + PersonSample person2 = new PersonSample(ZAPHOD, "Beeblebrox", 25); /* * Silly tests to bump coverage stats, not sure why they are counting PersonSample to begin @@ -527,19 +524,19 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase { * Two entries, 1 mismatch */ iate.setCreatedBy("Ford"); - iate.setModifiedBy("Zaphod"); + iate.setModifiedBy(ZAPHOD); iate.setModifiedDate(date); iate.setPersonTest(person); iate2.setCreatedBy("Ford"); - iate2.setModifiedBy("Zaphod"); + iate2.setModifiedBy(ZAPHOD); iate2.setModifiedDate(date); iate2.setPersonTest(person2); dbAudit.writeAuditDebugLog(className, "resource1", "resource2", iate, iate2); - HashMap<Object, Object> myEntries = new HashMap<Object, Object>(); - HashMap<Object, Object> theirEntries = new HashMap<Object, Object>(); + HashMap<Object, Object> myEntries = new HashMap<>(); + HashMap<Object, Object> theirEntries = new HashMap<>(); myEntries.put("0", iate); theirEntries.put("0", iate2); 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 836aa288..27cd168f 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 @@ -7,9 +7,9 @@ * 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,17 +20,15 @@ package org.onap.policy.common.ia; +import static org.assertj.core.api.Assertions.assertThatThrownBy; 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; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; -//import org.apache.commons.logging.Log; -//import org.apache.commons.logging.LogFactory; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; @@ -45,7 +43,7 @@ import org.onap.policy.common.utils.test.log.logback.ExtractAppender; * All JUnits are designed to run in the local development environment * where they have write privileges and can execute time-sensitive * tasks. - * + * * If any have been ignored (@Ignore) they will not run at the same time * as others. You should run them as JUnits by themselves. */ @@ -53,7 +51,7 @@ public class DbAuditTest extends IntegrityAuditTestBase { private static Logger logger = FlexLogger.getLogger(DbAuditTest.class); - private static final String resourceName = "pdp1"; + private static final String RESOURCE_NAME = "pdp1"; private EntityManagerFactory emf2; private EntityManager em2; @@ -135,16 +133,13 @@ public class DbAuditTest extends IntegrityAuditTestBase { logger.info("noEntitiesTest: Entering"); - dbDao = new DbDao(resourceName, A_SEQ_PU, properties); + dbDao = new DbDao(RESOURCE_NAME, A_SEQ_PU, properties); dbDao.deleteAllIntegrityAuditEntities(); - try { - DbAudit dbAudit = new DbAudit(dbDao); - dbAudit.dbAudit(resourceName, A_SEQ_PU, nodeType); - fail("found unexpected entities"); - } catch (DbAuditException e) { - // Ignore expected exception - } + assertThatThrownBy(() -> { + DbAudit dbAudit = new DbAudit(dbDao); + dbAudit.dbAudit(RESOURCE_NAME, A_SEQ_PU, nodeType); + }).isInstanceOf(DbAuditException.class); logger.info("noEntitiesTest: Exit"); } @@ -161,9 +156,9 @@ public class DbAuditTest extends IntegrityAuditTestBase { final ExtractAppender log = watch(debugLogger, "DbAudit: Found only (one) IntegrityAuditEntity entry:"); // Add one entry in the database - dbDao = new DbDao(resourceName, A_SEQ_PU, properties); + dbDao = new DbDao(RESOURCE_NAME, A_SEQ_PU, properties); DbAudit dbAudit = new DbAudit(dbDao); - dbAudit.dbAudit(resourceName, A_SEQ_PU, nodeType); + dbAudit.dbAudit(RESOURCE_NAME, A_SEQ_PU, nodeType); List<IntegrityAuditEntity> iaeList = dbDao.getIntegrityAuditEntities(A_SEQ_PU, nodeType); logger.info("List size: " + iaeList.size()); @@ -206,9 +201,9 @@ public class DbAuditTest extends IntegrityAuditTestBase { /* * Create entries in DB1 & DB2 for the resource of interest */ - dbDao = new DbDao(resourceName, A_SEQ_PU, properties); + dbDao = new DbDao(RESOURCE_NAME, A_SEQ_PU, properties); - new DbDao(resourceName, A_SEQ_PU, properties2).destroy(); + new DbDao(RESOURCE_NAME, A_SEQ_PU, properties2).destroy(); /* * Entries in DB1, pointing to DB2, except for pdp3 @@ -230,7 +225,7 @@ public class DbAuditTest extends IntegrityAuditTestBase { * as DB2 it can be confirmed that the mismatch is resolved */ DbAudit dbAudit = new DbAudit(dbDao); - dbAudit.dbAudit(resourceName, A_SEQ_PU, nodeType); + dbAudit.dbAudit(RESOURCE_NAME, A_SEQ_PU, nodeType); // update pdp3 entry in DB1 to point to DB2 new DbDao("pdp3", A_SEQ_PU, properties, dbUrl2).destroy(); @@ -239,7 +234,7 @@ public class DbAuditTest extends IntegrityAuditTestBase { * Run the audit again and correct the mismatch, the result should be one entry in the * mismatchKeySet because of the missing entry from the beginning of the test */ - dbAudit.dbAudit(resourceName, A_SEQ_PU, nodeType); + dbAudit.dbAudit(RESOURCE_NAME, A_SEQ_PU, nodeType); assertFalse(dbglog.getExtracted().isEmpty()); @@ -267,7 +262,7 @@ public class DbAuditTest extends IntegrityAuditTestBase { /** * Re-creates DB1, using the specified properties. - * + * * @param properties the properties */ private void recreateDb1(Properties properties) { diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbDaoTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbDaoTest.java index 357e638c..ef21e831 100644 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbDaoTest.java +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbDaoTest.java @@ -7,9 +7,9 @@ * 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. @@ -60,6 +60,11 @@ import org.onap.policy.common.utils.time.TestTime; * tasks. */ public class DbDaoTest extends IntegrityAuditTestBase { + private static final String SELECT_ENTITIES = + "Select i from IntegrityAuditEntity i where i.resourceName=:rn and i.persistenceUnit=:pu"; + private static final String SITE_B = "SiteB"; + private static final String ENTITY_CLASS_NAME = "org.onap.policy.common.ia.jpa.IntegrityAuditEntity"; + private static String resourceName = "pdp0"; private DbDao dbDao; @@ -103,8 +108,7 @@ public class DbDaoTest extends IntegrityAuditTestBase { dbDao = new DbDao(resourceName, A_SEQ_PU, properties); // Find the proper entry in the database - Query iaequery = em.createQuery( - "Select i from IntegrityAuditEntity i where i.resourceName=:rn and i.persistenceUnit=:pu"); + Query iaequery = em.createQuery(SELECT_ENTITIES); iaequery.setParameter("rn", DbDaoTest.resourceName); iaequery.setParameter("pu", DbDaoTest.A_SEQ_PU); @@ -131,13 +135,12 @@ public class DbDaoTest extends IntegrityAuditTestBase { // Change site_name in properties to test that an update was made to // an existing entry in the table - properties.put(IntegrityAuditProperties.SITE_NAME, "SiteB"); + properties.put(IntegrityAuditProperties.SITE_NAME, SITE_B); dbDao = new DbDao(resourceName, A_SEQ_PU, properties); try (EntityTransCloser et = new EntityTransCloser(em.getTransaction())) { // Find the proper entry in the database - Query iaequery = em.createQuery( - "Select i from IntegrityAuditEntity i where i.resourceName=:rn and i.persistenceUnit=:pu"); + Query iaequery = em.createQuery(SELECT_ENTITIES); iaequery.setParameter("rn", DbDaoTest.resourceName); iaequery.setParameter("pu", DbDaoTest.A_SEQ_PU); @@ -158,7 +161,7 @@ public class DbDaoTest extends IntegrityAuditTestBase { et.commit(); // Assert that the site_name for the existing entry was updated - assertEquals("SiteB", iae.getSite()); + assertEquals(SITE_B, iae.getSite()); } } } @@ -187,7 +190,6 @@ public class DbDaoTest extends IntegrityAuditTestBase { dbDao = new DbDao(resourceName, A_SEQ_PU, properties); IntegrityAuditEntity iae = dbDao.getMyIntegrityAuditEntity(); - // assertEquals("integrityAuditPU", iae.getPersistenceUnit()); assertEquals(A_SEQ_PU, iae.getPersistenceUnit()); } @@ -200,8 +202,7 @@ public class DbDaoTest extends IntegrityAuditTestBase { dbDao = new DbDao(resourceName, A_SEQ_PU, properties); // Find the proper database entry - Query iaequery = em - .createQuery("Select i from IntegrityAuditEntity i where i.resourceName=:rn and i.persistenceUnit=:pu"); + Query iaequery = em.createQuery(SELECT_ENTITIES); iaequery.setParameter("rn", DbDaoTest.resourceName); iaequery.setParameter("pu", DbDaoTest.A_SEQ_PU); @@ -239,8 +240,7 @@ public class DbDaoTest extends IntegrityAuditTestBase { dbDao.setDesignated(resourceName, A_SEQ_PU, true); // Find the proper entry in the database - Query iaequery = em.createQuery( - "Select i from IntegrityAuditEntity i where i.resourceName=:rn and i.persistenceUnit=:pu"); + Query iaequery = em.createQuery(SELECT_ENTITIES); iaequery.setParameter("rn", resourceName); iaequery.setParameter("pu", A_SEQ_PU); @@ -275,13 +275,12 @@ public class DbDaoTest extends IntegrityAuditTestBase { try (EntityTransCloser et = new EntityTransCloser(em.getTransaction())) { TestTime testTime = getTestTime(); - + // Create an entry dbDao = new DbDao(resourceName, A_SEQ_PU, properties); // Find the proper entry in the database - Query iaequery = em.createQuery( - "Select i from IntegrityAuditEntity i where i.resourceName=:rn and i.persistenceUnit=:pu"); + Query iaequery = em.createQuery(SELECT_ENTITIES); iaequery.setParameter("rn", resourceName); iaequery.setParameter("pu", A_SEQ_PU); @@ -301,7 +300,7 @@ public class DbDaoTest extends IntegrityAuditTestBase { // ensure dates are different by sleeping for a bit testTime.sleep(1); - iae.setSite("SiteB"); + iae.setSite(SITE_B); iae.setLastUpdated(testTime.getDate()); final Date newDate = iae.getLastUpdated(); @@ -328,7 +327,7 @@ public class DbDaoTest extends IntegrityAuditTestBase { new DbDao("pdp2", A_SEQ_PU, properties).destroy(); // Obtain a hash with the persisted objects - Map<Object, Object> entries = dbDao.getAllMyEntries("org.onap.policy.common.ia.jpa.IntegrityAuditEntity"); + Map<Object, Object> entries = dbDao.getAllMyEntries(ENTITY_CLASS_NAME); // Assert there were 3 entries for that class assertEquals(3, entries.size()); @@ -349,11 +348,11 @@ public class DbDaoTest extends IntegrityAuditTestBase { // Obtain all entity keys CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Object> cq = cb.createQuery(); - Root<?> rootEntry = cq.from(Class.forName("org.onap.policy.common.ia.jpa.IntegrityAuditEntity")); + Root<?> rootEntry = cq.from(Class.forName(ENTITY_CLASS_NAME)); CriteriaQuery<Object> all = cq.select(rootEntry); TypedQuery<Object> allQuery = em.createQuery(all); List<Object> objectList = allQuery.getResultList(); - HashSet<Object> resultSet = new HashSet<Object>(); + HashSet<Object> resultSet = new HashSet<>(); PersistenceUnitUtil util = emf.getPersistenceUnitUtil(); for (Object o : objectList) { Object key = util.getIdentifier(o); @@ -362,7 +361,7 @@ public class DbDaoTest extends IntegrityAuditTestBase { // Obtain a hash with the persisted objects Map<Object, Object> entries = - dbDao.getAllMyEntries("org.onap.policy.common.ia.jpa.IntegrityAuditEntity", resultSet); + dbDao.getAllMyEntries(ENTITY_CLASS_NAME, resultSet); // Assert there were 3 entries for that class assertEquals(3, entries.size()); @@ -383,7 +382,7 @@ public class DbDaoTest extends IntegrityAuditTestBase { // Obtain a hash with the persisted objects Map<Object, Object> entries = dbDao.getAllEntries("integrityAuditPU", properties, - "org.onap.policy.common.ia.jpa.IntegrityAuditEntity"); + ENTITY_CLASS_NAME); // Assert there were 3 entries for that class assertEquals(3, entries.size()); @@ -405,11 +404,11 @@ public class DbDaoTest extends IntegrityAuditTestBase { // Obtain all entity keys CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Object> cq = cb.createQuery(); - Root<?> rootEntry = cq.from(Class.forName("org.onap.policy.common.ia.jpa.IntegrityAuditEntity")); + Root<?> rootEntry = cq.from(Class.forName(ENTITY_CLASS_NAME)); CriteriaQuery<Object> all = cq.select(rootEntry); TypedQuery<Object> allQuery = em.createQuery(all); List<Object> objectList = allQuery.getResultList(); - HashSet<Object> resultSet = new HashSet<Object>(); + HashSet<Object> resultSet = new HashSet<>(); PersistenceUnitUtil util = emf.getPersistenceUnitUtil(); for (Object o : objectList) { Object key = util.getIdentifier(o); @@ -418,7 +417,7 @@ public class DbDaoTest extends IntegrityAuditTestBase { // Obtain a hash with the persisted objects Map<Object, Object> entries = dbDao.getAllEntries("integrityAuditPU", properties, - "org.onap.policy.common.ia.jpa.IntegrityAuditEntity", resultSet); + ENTITY_CLASS_NAME, resultSet); // Assert there were 3 entries for that class assertEquals(3, entries.size()); @@ -439,7 +438,7 @@ public class DbDaoTest extends IntegrityAuditTestBase { // Obtain a hash with the persisted objects Map<Object, Object> entries = - dbDao.getAllEntries(A_SEQ_PU, properties, "org.onap.policy.common.ia.jpa.IntegrityAuditEntity"); + dbDao.getAllEntries(A_SEQ_PU, properties, ENTITY_CLASS_NAME); // Assert there were 3 entries for that class assertEquals(3, entries.size()); diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/ExceptionsTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/ExceptionsTest.java index 3c8ce528..40f7a738 100644 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/ExceptionsTest.java +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/ExceptionsTest.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * Integrity Monitor * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 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. @@ -31,22 +31,22 @@ import org.onap.policy.common.utils.test.ExceptionsTester; public class ExceptionsTest extends ExceptionsTester { @Test - public void testDbAuditException() throws Exception { + public void testDbAuditException() { assertEquals(4, test(DbAuditException.class)); } @Test - public void testDbDaoTransactionException() throws Exception { + public void testDbDaoTransactionException() { assertEquals(4, test(DbDaoTransactionException.class)); } @Test - public void testIntegrityAuditException() throws Exception { + public void testIntegrityAuditException() { assertEquals(4, test(IntegrityAuditException.class)); } @Test - public void testIntegrityAuditPropertiesException() throws Exception { + public void testIntegrityAuditPropertiesException() { assertEquals(4, test(IntegrityAuditPropertiesException.class)); } } diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditTest.java index 5adbb561..34a9364f 100644 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditTest.java +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditTest.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * Integrity Audit * ================================================================================ - * 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. @@ -28,6 +28,9 @@ import java.util.Properties; import org.junit.Test; public class IntegrityAuditTest { + private static final String PROPERTIES = "properties"; + private static final String RESOURCE_NAME = "resourceName"; + private static final String SOMETHING = "something"; @Test /** @@ -36,33 +39,33 @@ public class IntegrityAuditTest { public void parmsAreBadTest() { // Try with 2 null params StringBuilder badParams = new StringBuilder(); - IntegrityAudit.parmsAreBad(null, "something", null, badParams); + IntegrityAudit.parmsAreBad(null, SOMETHING, null, badParams); assertFalse("".equals(badParams.toString())); - assertTrue(badParams.toString().contains("resourceName")); - assertTrue(badParams.toString().contains("properties")); + assertTrue(badParams.toString().contains(RESOURCE_NAME)); + assertTrue(badParams.toString().contains(PROPERTIES)); // Try with 1 null params badParams = new StringBuilder(); Properties props = new Properties(); props.put(IntegrityAuditProperties.DB_DRIVER, "test_db_driver"); - IntegrityAudit.parmsAreBad(null, "something", props, badParams); + IntegrityAudit.parmsAreBad(null, SOMETHING, props, badParams); assertFalse("".equals(badParams.toString())); - assertTrue(badParams.toString().contains("resourceName")); - assertFalse(badParams.toString().contains("properties")); + assertTrue(badParams.toString().contains(RESOURCE_NAME)); + assertFalse(badParams.toString().contains(PROPERTIES)); // Try with 0 null params badParams = new StringBuilder(); - IntegrityAudit.parmsAreBad("someting", "something", props, badParams); + IntegrityAudit.parmsAreBad("someting", SOMETHING, props, badParams); assertFalse("".equals(badParams.toString())); - assertFalse(badParams.toString().contains("resourceName")); - assertFalse(badParams.toString().contains("properties")); + assertFalse(badParams.toString().contains(RESOURCE_NAME)); + assertFalse(badParams.toString().contains(PROPERTIES)); // Try with invalid node type props.put(IntegrityAuditProperties.NODE_TYPE, "bogus"); badParams = new StringBuilder(); - IntegrityAudit.parmsAreBad("someting", "something", props, badParams); + IntegrityAudit.parmsAreBad("someting", SOMETHING, props, badParams); assertFalse("".equals(badParams.toString())); assertTrue(badParams.toString().contains("nodeType")); 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 9324dfb4..0edaaa78 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 @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * Integrity Audit * ================================================================================ - * 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. @@ -52,12 +52,12 @@ import org.slf4j.LoggerFactory; /** * All JUnits are designed to run in the local development environment where they have write * privileges and can execute time-sensitive tasks. - * + * * <p>Many of the test verification steps are performed by scanning for items written to the log * file. Rather than actually scan the log file, an {@link ExtractAppender} is used to monitor * events that are logged and extract relevant items. In order to attach the appender to the debug * log, it assumes that the debug log is a <i>logback</i> Logger configured per EELF. - * + * * <p>These tests use a temporary, in-memory DB, which is dropped once the tests complete. */ public class IntegrityAuditTestBase { @@ -77,7 +77,7 @@ public class IntegrityAuditTestBase { */ private static final String LOG_DIR = "testingLogs/common-modules/integrity-audit"; - + /** * Name of the field within the AuditorTime class that supplies the time. */ @@ -88,7 +88,7 @@ public class IntegrityAuditTestBase { * Max time, in milliseconds, to wait for a semaphore. */ protected static final long WAIT_MS = 5000L; - + /** * Number of seconds in an audit period. */ @@ -98,7 +98,7 @@ public class IntegrityAuditTestBase { protected static final String dbDriver = "org.h2.Driver"; protected static final String dbUser = "testu"; - protected static final String dbPwd = "testp"; + protected static final String dbPass = "testp"; protected static final String siteName = "SiteA"; protected static final String nodeType = "pdp_xacml"; @@ -173,7 +173,7 @@ public class IntegrityAuditTestBase { /** * Saves current configuration information and then sets new values. - * + * * @param dbDriver the name of the DB Driver class * @param dbUrl the URL to the DB * @throws IOException if an IO error occurs @@ -199,7 +199,7 @@ public class IntegrityAuditTestBase { properties.put(IntegrityAuditProperties.DB_DRIVER, dbDriver); properties.put(IntegrityAuditProperties.DB_URL, dbUrl); properties.put(IntegrityAuditProperties.DB_USER, dbUser); - properties.put(IntegrityAuditProperties.DB_PWD, dbPwd); + properties.put(IntegrityAuditProperties.DB_PWD, dbPass); properties.put(IntegrityAuditProperties.SITE_NAME, siteName); properties.put(IntegrityAuditProperties.NODE_TYPE, nodeType); @@ -218,7 +218,7 @@ public class IntegrityAuditTestBase { * Restores the configuration to what it was before the test. */ protected static void tearDownAfterClass() { - + IntegrityAudit.setUnitTesting(false); Whitebox.setInternalState(AuditorTime.class, TIME_SUPPLY_FIELD, savedTime); @@ -238,7 +238,7 @@ public class IntegrityAuditTestBase { appenders = new LinkedList<>(); properties.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, String.valueOf(AUDIT_PERIOD_SEC)); - + TestTime time = new TestTime(); testTime.set(time); @@ -269,7 +269,7 @@ public class IntegrityAuditTestBase { /** * Get the test time. - * + * * @return the {@link TestTime} in use by this thread */ public static TestTime getTestTime() { @@ -278,7 +278,7 @@ public class IntegrityAuditTestBase { /** * Truncate the table. - * + * * @param properties the properties * @param persistenceUnit the persistence unit * @param tableName the name of the table @@ -290,21 +290,21 @@ public class IntegrityAuditTestBase { EntityMgrCloser emc = new EntityMgrCloser(emfc.getFactory().createEntityManager()); EntityTransCloser etc = new EntityTransCloser(emc.getManager().getTransaction())) { - EntityManager em = emc.getManager(); - EntityTransaction et = etc.getTransation(); + EntityManager entmgr = emc.getManager(); + EntityTransaction entrans = etc.getTransation(); // Clean up the DB - em.createQuery("Delete from " + tableName).executeUpdate(); + entmgr.createQuery("Delete from " + tableName).executeUpdate(); // commit transaction - et.commit(); + entrans.commit(); } } /** * Verifies that items appear within the log, in order. A given item may appear more than once. * In addition, the log may contain extra items; those are ignored. - * + * * @param textre regular expression used to extract an item from a line in the log. The first * "capture" group of the regular expression is assumed to contain the extracted item * @param items items that should be matched by the items extracted from the log, in order @@ -343,7 +343,7 @@ public class IntegrityAuditTestBase { /** * Gets the remaining items from an iterator. - * + * * @param current the current item, to be included within the list * @param it iterator from which to get the remaining items * @return a list of the remaining items @@ -361,7 +361,7 @@ public class IntegrityAuditTestBase { /** * Waits for a thread to stop. If the thread doesn't complete in the allotted time, then it * interrupts it and waits again. - * + * * @param auditor the thread for which to wait * @return {@code true} if the thread stopped, {@code false} otherwise */ @@ -371,7 +371,7 @@ public class IntegrityAuditTestBase { auditor.interrupt(); if (!auditor.joinAuditThread(WAIT_MS)) { - System.out.println("failed to stop audit thread"); + errorLogger.error("failed to stop audit thread"); return false; } @@ -385,7 +385,7 @@ public class IntegrityAuditTestBase { /** * Makes a new auditor. - * + * * @param resourceName2 the name of the resource * @param persistenceUnit2 the persistence unit * @return a new auditor @@ -394,16 +394,16 @@ public class IntegrityAuditTestBase { protected MyIntegrityAudit makeAuditor(String resourceName2, String persistenceUnit2) throws Exception { // each auditor gets its own notion of time TestTime time = new TestTime(); - + // use the auditor-specific time while this thread constructs things testTime.set(time); - + return new MyIntegrityAudit(resourceName2, persistenceUnit2, makeProperties(), time); } /** * Watches for patterns in a logger by attaching a ExtractAppender to it. - * + * * @param logger the logger to watch * @param regex regular expression used to extract relevant text * @return a new appender @@ -417,7 +417,7 @@ public class IntegrityAuditTestBase { /** * Makes a new Property set that's a clone of {@link #properties}. - * + * * @return a new Property set containing all of a copy of all of the {@link #properties} */ protected static Properties makeProperties() { @@ -428,7 +428,7 @@ public class IntegrityAuditTestBase { /** * Waits for data to become stale and then runs an audit on several auditors in parallel. - * + * * @param auditors the auditors * @throws InterruptedException if a thread is interrupted */ @@ -439,7 +439,7 @@ public class IntegrityAuditTestBase { /** * Runs an audit on several auditors in parallel. - * + * * @param auditors the auditors * @throws InterruptedException if a thread is interrupted */ @@ -459,7 +459,7 @@ public class IntegrityAuditTestBase { /** * Waits for a semaphore to be released. - * + * * @param sem the semaphore for which to wait * @throws InterruptedException if the thread is interrupted * @throws AssertionError if the semaphore did not reach zero in the allotted time @@ -467,10 +467,10 @@ public class IntegrityAuditTestBase { protected void waitSem(Semaphore sem) throws InterruptedException { assertTrue(sem.tryAcquire(WAIT_MS, TimeUnit.MILLISECONDS)); } - + /** * Sleep a bit so that the currently designated pdp becomes stale. - * + * * @throws InterruptedException if the thread is interrupted */ protected void waitStale() throws InterruptedException { @@ -505,14 +505,14 @@ public class IntegrityAuditTestBase { * Manages audits by inserting semaphores into a queue for the AuditThread to count. */ protected class MyIntegrityAudit extends IntegrityAudit { - + private final TestTime myTime; - + /** * Semaphore on which the audit thread should wait. */ private Semaphore auditSem = null; - + /** * Semaphore on which the junit management thread should wait. */ @@ -520,17 +520,17 @@ public class IntegrityAuditTestBase { /** * Constructs an auditor and starts the AuditThread. - * + * * @param resourceName the resource name * @param persistenceUnit the persistence unit * @param properties the properties * @param time the time * @throws Exception if an error occurs */ - public MyIntegrityAudit(String resourceName, String persistenceUnit, + public MyIntegrityAudit(String resourceName, String persistenceUnit, Properties properties, TestTime time) throws Exception { super(resourceName, persistenceUnit, properties); - + myTime = time; testTime.set(myTime); @@ -538,10 +538,10 @@ public class IntegrityAuditTestBase { startAuditThread(); } - + /** * Get time in milliseconds. - * + * * @return the "current" time for the auditor */ public long getTimeInMillis() { @@ -550,7 +550,7 @@ public class IntegrityAuditTestBase { /** * Sleeps for a period of time. - * + * * @param sleepMs time to sleep * @throws InterruptedException can be interrupted */ @@ -567,7 +567,7 @@ public class IntegrityAuditTestBase { /** * Triggers an audit by releasing the audit thread's semaphore. - * + * * @return the semaphore on which to wait * @throws InterruptedException if the thread is interrupted */ @@ -586,10 +586,10 @@ public class IntegrityAuditTestBase { // release a bunch of semaphores, in case a thread is still running auditSem.release(1000); } - + auditSem = new Semaphore(0); junitSem = new Semaphore(0); - + super.startAuditThread(); if (haveAuditThread()) { @@ -609,7 +609,7 @@ public class IntegrityAuditTestBase { /** * Stops the AuditThread and waits for it to stop. - * + * * @throws AssertionError if the thread is still running */ @Override @@ -641,7 +641,7 @@ public class IntegrityAuditTestBase { @Override public void runStarted() throws InterruptedException { auditSem.acquire(); - + junitSem.release(); auditSem.acquire(); } @@ -651,7 +651,7 @@ public class IntegrityAuditTestBase { junitSem.release(); auditSem.acquire(); } - + }; } } diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/jpa/IaTestEntity.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/jpa/IaTestEntity.java index 36b9ef66..4a4824c5 100644 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/jpa/IaTestEntity.java +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/jpa/IaTestEntity.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * Integrity Audit * ================================================================================ - * 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. @@ -66,7 +66,9 @@ public class IaTestEntity implements Serializable { @Column(name = "modified_date", nullable = false) private Date modifiedDate; - public IaTestEntity() {} + public IaTestEntity() { + super(); + } /** * PrePersist call back method. @@ -85,7 +87,7 @@ public class IaTestEntity implements Serializable { /** * The the Im test Id. - * + * * @return the Id */ public long getImTestId() { @@ -94,7 +96,7 @@ public class IaTestEntity implements Serializable { /** * Get the createdBy. - * + * * @return the createdBy */ public String getCreatedBy() { @@ -103,7 +105,7 @@ public class IaTestEntity implements Serializable { /** * Set the createdBy. - * + * * @param createdBy the createdBy to set */ public void setCreatedBy(String createdBy) { @@ -112,7 +114,7 @@ public class IaTestEntity implements Serializable { /** * Get the modifiedBy. - * + * * @return the modifiedBy */ public String getModifiedBy() { @@ -121,7 +123,7 @@ public class IaTestEntity implements Serializable { /** * Set the ModifiedBy. - * + * * @param modifiedBy the modifiedBy to set */ public void setModifiedBy(String modifiedBy) { @@ -130,7 +132,7 @@ public class IaTestEntity implements Serializable { /** * Get the ModifiedDate. - * + * * @return the modifiedDate */ public Date getModifiedDate() { @@ -139,7 +141,7 @@ public class IaTestEntity implements Serializable { /** * Set the ModifiedDate. - * + * * @param modifiedDate the modifiedDate to set */ public void setModifiedDate(Date modifiedDate) { @@ -148,7 +150,7 @@ public class IaTestEntity implements Serializable { /** * Get the CreatedDate. - * + * * @return the createdDate */ public Date getCreatedDate() { @@ -157,7 +159,7 @@ public class IaTestEntity implements Serializable { /** * Set the person. - * + * * @param person the person to set */ public void setPersonTest(PersonSample person) { @@ -166,7 +168,7 @@ public class IaTestEntity implements Serializable { /** * Get the person. - * + * * @return the person */ public PersonSample getPersonTest() { |