diff options
author | liamfallon <liam.fallon@est.tech> | 2019-04-12 12:44:22 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-04-12 12:44:22 +0000 |
commit | 8a26f57269caf7a559deb46077050048da92dca8 (patch) | |
tree | 160dcaa0ffb7916aea2a657a2319ded94ac82a17 /models-provider/src/main/java/org/onap | |
parent | ad2f809ab6e723a79d633aacc2239b17e010e843 (diff) |
UNit test and minor fixes for DB pars
Add unit test for the new database provider driver parameter.
Address the comments raised in the last review.
Issue-ID: POLICY-1095
Change-Id: I9f629d9f4446d12bfb492e00e49e07b97ef5a490
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-provider/src/main/java/org/onap')
-rw-r--r-- | models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java index 475e5769d..cd7b7f38e 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java @@ -29,6 +29,7 @@ import javax.ws.rs.core.Response; import lombok.NonNull; +import org.eclipse.persistence.config.PersistenceUnitProperties; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.base.PfModelRuntimeException; import org.onap.policy.models.dao.DaoParameters; @@ -66,14 +67,6 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider { private static final Logger LOGGER = LoggerFactory.getLogger(DefaultPfDao.class); - // Constants for persistence properties - // @formatter:off - private static final String JAVAX_PERSISTENCE_JDBC_DRIVER = "javax.persistence.jdbc.driver"; - private static final String JAVAX_PERSISTENCE_JDBC_URL = "javax.persistence.jdbc.url"; - private static final String JAVAX_PERSISTENCE_JDBC_USER = "javax.persistence.jdbc.user"; - private static final String JAVAX_PERSISTENCE_JDBC_PWORD = "javax.persistence.jdbc.password"; - // @formatter:on - private final PolicyModelsProviderParameters parameters; // Database connection and the DAO for reading and writing Policy Framework concepts @@ -109,10 +102,10 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider { // @formatter:off Properties jdbcProperties = new Properties(); - jdbcProperties.setProperty(JAVAX_PERSISTENCE_JDBC_DRIVER, parameters.getDatabaseDriver()); - jdbcProperties.setProperty(JAVAX_PERSISTENCE_JDBC_URL, parameters.getDatabaseUrl()); - jdbcProperties.setProperty(JAVAX_PERSISTENCE_JDBC_USER, parameters.getDatabaseUser()); - jdbcProperties.setProperty(JAVAX_PERSISTENCE_JDBC_PWORD, decodedPassword); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_DRIVER, parameters.getDatabaseDriver()); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_URL, parameters.getDatabaseUrl()); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_USER, parameters.getDatabaseUser()); + jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_PASSWORD, decodedPassword); // @formatter:on daoParameters.setJdbcProperties(jdbcProperties); |