summaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-07-01 10:11:35 -0400
committerJim Hahn <jrh3@att.com>2019-07-01 14:20:46 +0000
commit86554962a34c4e7c16821f91a12242a4ffb36368 (patch)
treead1f9441757a416d853537029d46937cb288a5cc /ONAP-PAP-REST
parentc5f234ca60840a1de8c9486c51226e6a294c57f3 (diff)
Fix centos build issue
Seeing this when trying to build in centos: 10:04:12 [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.459 s - in org.onap.policy.pap.ia.DbAuditCompareEntriesTest 10:04:12 [INFO] 10:04:12 [INFO] Results: 10:04:12 [INFO] 10:04:12 [ERROR] Failures: 10:04:12 [ERROR] XACMLPAPTest.testDummy:907 10:04:12 [ERROR] Errors: 10:04:12 [ERROR] XACMLPAPTest.getDictionary:886 ยป NullPointer ... Modified the junit test(s) to create the JPA entities needed by integrity audit, which is what was causing the above issues. Change-Id: I405798a1946d377770529a99210a1cc57390667f Issue-ID: POLICY-1737 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'ONAP-PAP-REST')
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java
index aa1e56988..e4da430a5 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java
@@ -30,6 +30,9 @@ import java.nio.file.Paths;
import java.util.Date;
import java.util.List;
import java.util.Properties;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
import javax.persistence.PersistenceException;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
@@ -101,6 +104,8 @@ public class PolicyDBDaoTest {
}
public static SessionFactory setupH2DbDaoImpl(String dbName) {
+ setUpAuditDb();
+
System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "src/test/resources/xacml.pap.properties");
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName("org.h2.Driver");
@@ -152,6 +157,17 @@ public class PolicyDBDaoTest {
}
+ private static void setUpAuditDb() {
+ Properties properties = new Properties();
+ properties.put(XACMLRestProperties.PROP_PAP_DB_DRIVER,"org.h2.Driver");
+ properties.put(XACMLRestProperties.PROP_PAP_DB_URL, "jdbc:h2:file:./sql/xacmlTest");
+ properties.put(XACMLRestProperties.PROP_PAP_DB_USER, "sa");
+ properties.put(XACMLRestProperties.PROP_PAP_DB_PASSWORD, "");
+
+ // create the DB and then close it
+ Persistence.createEntityManagerFactory("testPapPU", properties).close();
+ }
+
@Test
public void testGetConfigFile() {
PolicyRestAdapter pra = new PolicyRestAdapter();