diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2017-09-14 17:22:24 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2017-09-14 17:34:14 -0400 |
commit | dd1df5fdcc8fe69f7ae310d9ffb29c2116973bd0 (patch) | |
tree | f18ed286e68df4e147c086cdc6b5ba72d7123ade /integrity-audit | |
parent | 0e87901898a23bfdfc993edb312488006299d01a (diff) |
Fix sonar critical for password
Focused on hard coded passwords. I believe they are only
used for JUnit tests so I moved them into a file for use.
If they still show up on sonar then I will move into a properties
file and/or mark as not going to fix.
Issue-ID: POLICY-237
Change-Id: I6fa561714091043a2ea5e2edfb0441c2dfc8b044
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'integrity-audit')
7 files changed, 149 insertions, 126 deletions
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 d0781e9c..49b26fcb 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 @@ -22,10 +22,6 @@ package org.onap.policy.common.ia; public class IntegrityAuditProperties { - public static final String DEFAULT_DB_DRIVER = "org.h2.Driver"; - public static final String DEFAULT_DB_URL = "jdbc:h2:file:./sql/iaTest"; - public static final String DEFAULT_DB_USER = "sa"; - public static final String DEFAULT_DB_PWD = ""; public static final int DEFAULT_AUDIT_PERIOD_SECONDS = -1; // Audit does not run public static final String DB_DRIVER = "javax.persistence.jdbc.driver"; diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/test/AuditPeriodTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/test/AuditPeriodTest.java index 54b50b0d..68ab42d9 100644 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/test/AuditPeriodTest.java +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/test/AuditPeriodTest.java @@ -80,10 +80,10 @@ public class AuditPeriodTest { IntegrityAudit.setUnitTesting(true); properties = new Properties(); - properties.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); @@ -277,10 +277,10 @@ public class AuditPeriodTest { * Start audit for pdp2. */ Properties properties2 = new Properties(); - properties2.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties2.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties2.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties2.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties2.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties2.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties2.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties2.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties2.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties2.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties2.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "300"); @@ -293,10 +293,10 @@ public class AuditPeriodTest { * Start audit for pdp3. */ Properties properties3 = new Properties(); - properties3.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties3.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties3.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties3.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties3.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties3.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties3.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties3.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties3.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties3.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties3.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "300"); @@ -393,10 +393,10 @@ public class AuditPeriodTest { * Start audit for pdp2. */ Properties properties2 = new Properties(); - properties2.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties2.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties2.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties2.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties2.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties2.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties2.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties2.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties2.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties2.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties2.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "20"); @@ -409,10 +409,10 @@ public class AuditPeriodTest { * Start audit for pdp3. */ Properties properties3 = new Properties(); - properties3.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties3.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties3.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties3.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties3.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties3.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties3.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties3.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties3.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties3.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties3.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "20"); diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/test/DbAuditCompareEntriesTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/test/DbAuditCompareEntriesTest.java index a625d751..d8388c58 100644 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/test/DbAuditCompareEntriesTest.java +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/test/DbAuditCompareEntriesTest.java @@ -86,17 +86,17 @@ public class DbAuditCompareEntriesTest { IntegrityAudit.setUnitTesting(true); properties = new Properties(); - properties.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); - dbDriver = IntegrityAuditProperties.DEFAULT_DB_DRIVER; - dbUrl = IntegrityAuditProperties.DEFAULT_DB_URL; - dbUser = IntegrityAuditProperties.DEFAULT_DB_USER; - dbPwd = IntegrityAuditProperties.DEFAULT_DB_PWD; + dbDriver = TestUtils.DEFAULT_DB_DRIVER; + dbUrl = TestUtils.DEFAULT_DB_URL; + dbUser = TestUtils.DEFAULT_DB_USER; + dbPwd = TestUtils.DEFAULT_DB_PWD; siteName = "SiteA"; nodeType = "pdp_xacml"; persistenceUnit = "testPU"; @@ -452,25 +452,25 @@ public class DbAuditCompareEntriesTest { IntegrityAudit.setUnitTesting(true); properties = new Properties(); - properties.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); Properties properties2 = new Properties(); - properties2.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); + properties2.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); properties2.put(IntegrityAuditProperties.DB_URL, "jdbc:h2:file:./sql/iaTest2"); - properties2.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties2.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties2.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties2.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties2.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties2.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); - dbDriver = IntegrityAuditProperties.DEFAULT_DB_DRIVER; - dbUrl = IntegrityAuditProperties.DEFAULT_DB_URL; - dbUser = IntegrityAuditProperties.DEFAULT_DB_USER; - dbPwd = IntegrityAuditProperties.DEFAULT_DB_PWD; + dbDriver = TestUtils.DEFAULT_DB_DRIVER; + dbUrl = TestUtils.DEFAULT_DB_URL; + dbUser = TestUtils.DEFAULT_DB_USER; + dbPwd = TestUtils.DEFAULT_DB_PWD; siteName = "SiteA"; nodeType = "pdp_xacml"; persistenceUnit = "testPU"; diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/test/DbAuditTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/test/DbAuditTest.java index 0ee0a72e..ecf75eef 100644 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/test/DbAuditTest.java +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/test/DbAuditTest.java @@ -119,17 +119,17 @@ public class DbAuditTest { IntegrityAuditEntity.setUnitTesting(true); properties = new Properties(); - properties.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); - dbDriver = IntegrityAuditProperties.DEFAULT_DB_DRIVER; - dbUrl = IntegrityAuditProperties.DEFAULT_DB_URL; - dbUser = IntegrityAuditProperties.DEFAULT_DB_USER; - dbPwd = IntegrityAuditProperties.DEFAULT_DB_PWD; + dbDriver = TestUtils.DEFAULT_DB_DRIVER; + dbUrl = TestUtils.DEFAULT_DB_URL; + dbUser = TestUtils.DEFAULT_DB_USER; + dbPwd = TestUtils.DEFAULT_DB_PWD; siteName = "SiteA"; nodeType = "pdp_xacml"; persistenceUnit = "testPU"; @@ -247,10 +247,10 @@ public class DbAuditTest { // Properties for DB2 Properties properties2 = new Properties(); - properties2.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); + properties2.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); properties2.put(IntegrityAuditProperties.DB_URL, "jdbc:h2:file:./sql/iaTest2"); - properties2.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties2.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties2.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties2.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties2.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties2.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/test/DbDAOTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/test/DbDAOTest.java index 326ada59..4fd51f6e 100644 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/test/DbDAOTest.java +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/test/DbDAOTest.java @@ -71,10 +71,10 @@ public class DbDAOTest { @Before public void setUp() throws Exception { properties = new Properties(); - properties.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/test/IntegrityAuditDesignationTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/test/IntegrityAuditDesignationTest.java index 021f3368..5c593123 100644 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/test/IntegrityAuditDesignationTest.java +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/test/IntegrityAuditDesignationTest.java @@ -85,10 +85,10 @@ public class IntegrityAuditDesignationTest { IntegrityAudit.setUnitTesting(true); properties = new Properties(); - properties.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); @@ -256,10 +256,10 @@ public class IntegrityAuditDesignationTest { * Start audit for pdp2. */ Properties properties2 = new Properties(); - properties2.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties2.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties2.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties2.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties2.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties2.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties2.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties2.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties2.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties2.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties2.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "5"); @@ -347,10 +347,10 @@ public class IntegrityAuditDesignationTest { * Start audit for pdp2. */ Properties properties2 = new Properties(); - properties2.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties2.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties2.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties2.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties2.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties2.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties2.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties2.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties2.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties2.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties2.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "5"); @@ -441,10 +441,10 @@ public class IntegrityAuditDesignationTest { * Populate DB for pdp2, which will simulate it having registered but then having died. */ Properties properties2 = new Properties(); - properties2.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties2.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties2.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties2.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties2.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties2.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties2.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties2.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties2.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties2.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties2.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "5"); @@ -523,10 +523,10 @@ public class IntegrityAuditDesignationTest { * Start audit for pdp2. */ Properties properties2 = new Properties(); - properties2.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties2.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties2.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties2.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties2.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties2.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties2.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties2.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties2.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties2.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties2.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "5"); @@ -539,10 +539,10 @@ public class IntegrityAuditDesignationTest { * Start audit for pdp3. */ Properties properties3 = new Properties(); - properties3.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties3.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties3.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties3.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties3.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties3.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties3.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties3.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties3.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties3.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties3.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "5"); @@ -636,10 +636,10 @@ public class IntegrityAuditDesignationTest { * Start audit for pdp2, integrityAuditPU. */ Properties properties2 = new Properties(); - properties2.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties2.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties2.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties2.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties2.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties2.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties2.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties2.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties2.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties2.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties2.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "5"); @@ -652,10 +652,10 @@ public class IntegrityAuditDesignationTest { * Start audit for pdp3, testPU. */ Properties properties3 = new Properties(); - properties3.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties3.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties3.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties3.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties3.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties3.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties3.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties3.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties3.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties3.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties3.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "5"); @@ -668,10 +668,10 @@ public class IntegrityAuditDesignationTest { * Start audit for pdp4, integrityAuditPU. */ Properties properties4 = new Properties(); - properties4.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties4.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties4.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties4.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties4.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties4.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties4.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties4.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties4.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties4.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties4.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "5"); @@ -763,10 +763,10 @@ public class IntegrityAuditDesignationTest { * Start audit for pdp2. */ Properties properties2 = new Properties(); - properties2.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties2.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties2.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties2.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties2.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties2.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties2.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties2.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties2.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties2.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties2.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "5"); @@ -779,10 +779,10 @@ public class IntegrityAuditDesignationTest { * Populate DB for pdp3, which will simulate it having registered but then having died. */ Properties properties3 = new Properties(); - properties3.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties3.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties3.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties3.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties3.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties3.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties3.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties3.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties3.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties3.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties3.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "5"); @@ -794,10 +794,10 @@ public class IntegrityAuditDesignationTest { * Start audit for pdp4. */ Properties properties4 = new Properties(); - properties4.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties4.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties4.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties4.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties4.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties4.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties4.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties4.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties4.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties4.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties4.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "5"); @@ -895,10 +895,10 @@ public class IntegrityAuditDesignationTest { * Populate DB for pdp2, which will simulate it having registered but then having died. */ Properties properties2 = new Properties(); - properties2.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties2.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties2.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties2.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties2.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties2.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties2.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties2.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties2.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties2.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties2.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "5"); @@ -910,10 +910,10 @@ public class IntegrityAuditDesignationTest { * Start audit for pdp3. */ Properties properties3 = new Properties(); - properties3.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties3.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties3.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties3.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties3.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties3.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties3.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties3.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties3.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties3.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties3.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "5"); @@ -926,10 +926,10 @@ public class IntegrityAuditDesignationTest { * Populate DB for pdp4, which will simulate it having registered but then having died. */ Properties properties4 = new Properties(); - properties4.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties4.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties4.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties4.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties4.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties4.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties4.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties4.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties4.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties4.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties4.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "5"); @@ -1009,10 +1009,10 @@ public class IntegrityAuditDesignationTest { * Start audit for pdp2. */ Properties properties2 = new Properties(); - properties2.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties2.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties2.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties2.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties2.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties2.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties2.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties2.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties2.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties2.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties2.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "5"); @@ -1024,10 +1024,10 @@ public class IntegrityAuditDesignationTest { * Instantiate audit object for pdp3. */ Properties properties3 = new Properties(); - properties3.put(IntegrityAuditProperties.DB_DRIVER, IntegrityAuditProperties.DEFAULT_DB_DRIVER); - properties3.put(IntegrityAuditProperties.DB_URL, IntegrityAuditProperties.DEFAULT_DB_URL); - properties3.put(IntegrityAuditProperties.DB_USER, IntegrityAuditProperties.DEFAULT_DB_USER); - properties3.put(IntegrityAuditProperties.DB_PWD, IntegrityAuditProperties.DEFAULT_DB_PWD); + properties3.put(IntegrityAuditProperties.DB_DRIVER, TestUtils.DEFAULT_DB_DRIVER); + properties3.put(IntegrityAuditProperties.DB_URL, TestUtils.DEFAULT_DB_URL); + properties3.put(IntegrityAuditProperties.DB_USER, TestUtils.DEFAULT_DB_USER); + properties3.put(IntegrityAuditProperties.DB_PWD, TestUtils.DEFAULT_DB_PWD); properties3.put(IntegrityAuditProperties.SITE_NAME, "SiteA"); properties3.put(IntegrityAuditProperties.NODE_TYPE, "pdp_xacml"); properties3.put(IntegrityAuditProperties.AUDIT_PERIOD_SECONDS, "5"); diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/test/TestUtils.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/test/TestUtils.java new file mode 100644 index 00000000..58874d76 --- /dev/null +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/test/TestUtils.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * Test Utils + * ================================================================================ + * Copyright (C) 2017 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.policy.common.ia.test; + +public class TestUtils { + public static final String DEFAULT_DB_DRIVER = "org.h2.Driver"; + public static final String DEFAULT_DB_URL = "jdbc:h2:file:./sql/iaTest"; + public static final String DEFAULT_DB_USER = "sa"; + public static final String DEFAULT_DB_PWD = ""; +} |