summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyGuardPersistenceTest.java2
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyOperationalPersistenceTest.java2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/mapping/LegacyOperationalPolicyMapper.java20
3 files changed, 6 insertions, 18 deletions
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyGuardPersistenceTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyGuardPersistenceTest.java
index 16956ce0a..c5052dad7 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyGuardPersistenceTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyGuardPersistenceTest.java
@@ -79,6 +79,8 @@ public class PolicyLegacyGuardPersistenceTest {
*/
@Before
public void setupParameters() throws PfModelException, CoderException {
+ // H2, use "org.mariadb.jdbc.Driver" and "jdbc:mariadb://localhost:3306/policy" for locally installed MariaDB
+
PolicyModelsProviderParameters parameters = new PolicyModelsProviderParameters();
parameters.setDatabaseDriver("org.h2.Driver");
parameters.setDatabaseUrl("jdbc:h2:mem:testdb");
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyOperationalPersistenceTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyOperationalPersistenceTest.java
index 1cb64a835..c1cda4d05 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyOperationalPersistenceTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyOperationalPersistenceTest.java
@@ -79,6 +79,8 @@ public class PolicyLegacyOperationalPersistenceTest {
*/
@Before
public void setupParameters() throws PfModelException, CoderException {
+ // H2, use "org.mariadb.jdbc.Driver" and "jdbc:mariadb://localhost:3306/policy" for locally installed MariaDB
+
PolicyModelsProviderParameters parameters = new PolicyModelsProviderParameters();
parameters.setDatabaseDriver("org.h2.Driver");
parameters.setDatabaseUrl("jdbc:h2:mem:testdb");
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/mapping/LegacyOperationalPolicyMapper.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/mapping/LegacyOperationalPolicyMapper.java
index 2dddda26b..e7dabf1b8 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/mapping/LegacyOperationalPolicyMapper.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/mapping/LegacyOperationalPolicyMapper.java
@@ -25,8 +25,6 @@ import java.util.Map;
import javax.ws.rs.core.Response;
-import org.onap.policy.common.utils.coder.CoderException;
-import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
@@ -70,14 +68,7 @@ public class LegacyOperationalPolicyMapper
final Map<String, String> propertyMap = new HashMap<>();
toscaPolicy.setProperties(propertyMap);
- try {
- toscaPolicy.getProperties().put(CONTENT_PROPERTY,
- new StandardCoder().encode(legacyOperationalPolicy.getContent()));
- } catch (CoderException ce) {
- String errorMessage = "encoding of property \"content\" to JSON failed";
- LOGGER.warn(errorMessage, ce);
- throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, errorMessage, ce);
- }
+ toscaPolicy.getProperties().put(CONTENT_PROPERTY, legacyOperationalPolicy.getContent());
final JpaToscaServiceTemplate serviceTemplate = new JpaToscaServiceTemplate();
serviceTemplate.setToscaDefinitionsVersion("tosca_simple_yaml_1_0");
@@ -114,14 +105,7 @@ public class LegacyOperationalPolicyMapper
throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, errorMessage);
}
- String content = null;
- try {
- content = new StandardCoder().decode(toscaPolicy.getProperties().get(CONTENT_PROPERTY), String.class);
- } catch (CoderException ce) {
- String errorMessage = "decoding of property \"content\" from JSON failed";
- LOGGER.warn(errorMessage, ce);
- throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, errorMessage, ce);
- }
+ String content = toscaPolicy.getProperties().get(CONTENT_PROPERTY);
if (content == null) {
String errorMessage = "property \"content\" not defined on TOSCA policy";