diff options
Diffstat (limited to 'models-tosca')
5 files changed, 31 insertions, 47 deletions
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTest.java index 175ea2093..5ad314ae6 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTest.java @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Properties; +import org.eclipse.persistence.config.PersistenceUnitProperties; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -67,16 +68,12 @@ public class AuthorativeToscaProviderPolicyTest { daoParameters.setPersistenceUnit("ToscaConceptTest"); Properties jdbcProperties = new Properties(); - jdbcProperties.setProperty("javax.persistence.jdbc.user", "policy"); - jdbcProperties.setProperty("javax.persistence.jdbc.password", "P01icY"); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_USER, "policy"); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_PASSWORD, "P01icY"); - // H2 - jdbcProperties.setProperty("javax.persistence.jdbc.driver", "org.h2.Driver"); - jdbcProperties.setProperty("javax.persistence.jdbc.url", "jdbc:h2:mem:testdb"); - - // MariaDB - //jdbcProperties.setProperty("javax.persistence.jdbc.driver", "org.mariadb.jdbc.Driver"); - //jdbcProperties.setProperty("javax.persistence.jdbc.url", "jdbc:mariadb://localhost:3306/policy"); + // H2, use "org.mariadb.jdbc.Driver" and "jdbc:mariadb://localhost:3306/policy" for locally installed MariaDB + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_DRIVER, "org.h2.Driver"); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_URL, "jdbc:h2:mem:testdb"); daoParameters.setJdbcProperties(jdbcProperties ); @@ -95,7 +92,6 @@ public class AuthorativeToscaProviderPolicyTest { @After public void teardown() throws Exception { pfDao.close(); - //connection.close(); } @Test diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java index ec1b34778..6a925bcf3 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java @@ -31,6 +31,7 @@ import java.util.List; import java.util.Properties; import org.apache.commons.lang3.ObjectUtils; +import org.eclipse.persistence.config.PersistenceUnitProperties; import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; @@ -87,16 +88,12 @@ public class AuthorativeToscaProviderPolicyTypeTest { daoParameters.setPersistenceUnit("ToscaConceptTest"); Properties jdbcProperties = new Properties(); - jdbcProperties.setProperty("javax.persistence.jdbc.user", "policy"); - jdbcProperties.setProperty("javax.persistence.jdbc.password", "P01icY"); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_USER, "policy"); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_PASSWORD, "P01icY"); - // H2 - jdbcProperties.setProperty("javax.persistence.jdbc.driver", "org.h2.Driver"); - jdbcProperties.setProperty("javax.persistence.jdbc.url", "jdbc:h2:mem:testdb"); - - // MariaDB - //jdbcProperties.setProperty("javax.persistence.jdbc.driver", "org.mariadb.jdbc.Driver"); - //jdbcProperties.setProperty("javax.persistence.jdbc.url", "jdbc:mariadb://localhost:3306/policy"); + // H2, use "org.mariadb.jdbc.Driver" and "jdbc:mariadb://localhost:3306/policy" for locally installed MariaDB + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_DRIVER, "org.h2.Driver"); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_URL, "jdbc:h2:mem:testdb"); daoParameters.setJdbcProperties(jdbcProperties ); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider4LegacyGuardTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider4LegacyGuardTest.java index 076064c91..71254ec6f 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider4LegacyGuardTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider4LegacyGuardTest.java @@ -27,6 +27,7 @@ import static org.junit.Assert.assertNotNull; import java.util.Map; import java.util.Properties; +import org.eclipse.persistence.config.PersistenceUnitProperties; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -63,16 +64,12 @@ public class LegacyProvider4LegacyGuardTest { daoParameters.setPersistenceUnit("ToscaConceptTest"); Properties jdbcProperties = new Properties(); - jdbcProperties.setProperty("javax.persistence.jdbc.user", "policy"); - jdbcProperties.setProperty("javax.persistence.jdbc.password", "P01icY"); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_USER, "policy"); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_PASSWORD, "P01icY"); - // H2 - jdbcProperties.setProperty("javax.persistence.jdbc.driver", "org.h2.Driver"); - jdbcProperties.setProperty("javax.persistence.jdbc.url", "jdbc:h2:mem:testdb"); - - // MariaDB - //jdbcProperties.setProperty("javax.persistence.jdbc.driver", "org.mariadb.jdbc.Driver"); - //jdbcProperties.setProperty("javax.persistence.jdbc.url", "jdbc:mariadb://localhost:3306/policy"); + // H2, use "org.mariadb.jdbc.Driver" and "jdbc:mariadb://localhost:3306/policy" for locally installed MariaDB + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_DRIVER, "org.h2.Driver"); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_URL, "jdbc:h2:mem:testdb"); daoParameters.setJdbcProperties(jdbcProperties); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider4LegacyOperationalTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider4LegacyOperationalTest.java index cc1f51566..c018aae7b 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider4LegacyOperationalTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider4LegacyOperationalTest.java @@ -26,6 +26,7 @@ import static org.junit.Assert.assertNotNull; import java.util.Properties; +import org.eclipse.persistence.config.PersistenceUnitProperties; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -59,16 +60,12 @@ public class LegacyProvider4LegacyOperationalTest { daoParameters.setPersistenceUnit("ToscaConceptTest"); Properties jdbcProperties = new Properties(); - jdbcProperties.setProperty("javax.persistence.jdbc.user", "policy"); - jdbcProperties.setProperty("javax.persistence.jdbc.password", "P01icY"); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_USER, "policy"); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_PASSWORD, "P01icY"); - // H2 - jdbcProperties.setProperty("javax.persistence.jdbc.driver", "org.h2.Driver"); - jdbcProperties.setProperty("javax.persistence.jdbc.url", "jdbc:h2:mem:testdb"); - - // MariaDB - //jdbcProperties.setProperty("javax.persistence.jdbc.driver", "org.mariadb.jdbc.Driver"); - //jdbcProperties.setProperty("javax.persistence.jdbc.url", "jdbc:mariadb://localhost:3306/policy"); + // H2, use "org.mariadb.jdbc.Driver" and "jdbc:mariadb://localhost:3306/policy" for locally installed MariaDB + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_DRIVER, "org.h2.Driver"); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_URL, "jdbc:h2:mem:testdb"); daoParameters.setJdbcProperties(jdbcProperties ); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java index 4ed4c5cf7..1f582cf84 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java @@ -28,6 +28,7 @@ import static org.junit.Assert.fail; import java.util.Properties; +import org.eclipse.persistence.config.PersistenceUnitProperties; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -66,18 +67,14 @@ public class SimpleToscaProviderTest { daoParameters.setPersistenceUnit("ToscaConceptTest"); Properties jdbcProperties = new Properties(); - jdbcProperties.setProperty("javax.persistence.jdbc.user", "policy"); - jdbcProperties.setProperty("javax.persistence.jdbc.password", "P01icY"); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_USER, "policy"); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_PASSWORD, "P01icY"); - // H2 - jdbcProperties.setProperty("javax.persistence.jdbc.driver", "org.h2.Driver"); - jdbcProperties.setProperty("javax.persistence.jdbc.url", "jdbc:h2:mem:testdb"); + // H2, use "org.mariadb.jdbc.Driver" and "jdbc:mariadb://localhost:3306/policy" for locally installed MariaDB + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_DRIVER, "org.h2.Driver"); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_URL, "jdbc:h2:mem:testdb"); - // MariaDB - //jdbcProperties.setProperty("javax.persistence.jdbc.driver", "org.mariadb.jdbc.Driver"); - //jdbcProperties.setProperty("javax.persistence.jdbc.url", "jdbc:mariadb://localhost:3306/policy"); - - daoParameters.setJdbcProperties(jdbcProperties ); + daoParameters.setJdbcProperties(jdbcProperties); pfDao = new PfDaoFactory().createPfDao(daoParameters); pfDao.init(daoParameters); |