X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fcomponents%2FPolicyDBDaoTest.java;h=80b546d114345441fdce4d82c7000129becaaa6b;hp=64e46f59e0865716d73e6fe092ffb64e468588d8;hb=1e61676b77dd09659027b8984f050df7e8538526;hpb=f18fbfc026de9cf02126f57844c37abfee607394 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 64e46f59e..80b546d11 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 @@ -21,8 +21,10 @@ package org.onap.policy.pap.xacml.rest.components; import static org.junit.Assert.fail; + import com.att.research.xacml.api.pap.PAPException; import com.att.research.xacml.util.XACMLProperties; + import java.io.File; import java.io.IOException; import java.nio.file.Path; @@ -32,8 +34,10 @@ import java.util.List; import java.util.Properties; 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; + import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.tomcat.dbcp.dbcp2.BasicDataSource; @@ -154,10 +158,9 @@ public class PolicyDBDaoTest { return sessionFac; } - private static void setUpAuditDb() { Properties properties = new Properties(); - properties.put(XACMLRestProperties.PROP_PAP_DB_DRIVER,"org.h2.Driver"); + 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, ""); @@ -338,7 +341,6 @@ public class PolicyDBDaoTest { session2.getTransaction().commit(); session2.close(); - // add a pdp to a group group = dbd.getNewTransaction(); try { @@ -377,7 +379,6 @@ public class PolicyDBDaoTest { session3.getTransaction().commit(); session3.close(); - group = dbd.getNewTransaction(); try { group.removePdpFromGroup("http://localhost:4344/pdp/", "testuser"); @@ -455,7 +456,6 @@ public class PolicyDBDaoTest { session5.getTransaction().commit(); session5.close(); - group = dbd.getNewTransaction(); try { OnapPDPGroup groupToDelete = new StdPDPGroup(PolicyDBDao.createNewPDPGroupId("testgroup1"), Paths.get("/")); @@ -495,7 +495,6 @@ public class PolicyDBDaoTest { session7.getTransaction().commit(); session7.close(); - group = dbd.getNewTransaction(); try { OnapPDPGroup groupToDelete = new StdPDPGroup(PolicyDBDao.createNewPDPGroupId("testgroup2"), Paths.get("/")); @@ -587,7 +586,6 @@ public class PolicyDBDaoTest { } Assert.assertFalse(t.isTransactionOpen()); - if (logger.isDebugEnabled()) { Date date = new java.util.Date(); logger.debug("\n\nPolicyDBDaoTest.threadingStabilityTest() " + "\n a = dbd.getNewTransaction() " @@ -637,8 +635,6 @@ public class PolicyDBDaoTest { Assert.assertTrue(b.isTransactionOpen()); b.close(); - - // Now let's test the transaction wait time timeout. Shorten the wait time to 1000 ms System.setProperty(XACMLRestProperties.PROP_PAP_TRANS_WAIT, "1000"); // And let's lengthen the transaction timeout to 5000 ms