diff options
author | liamfallon <liam.fallon@est.tech> | 2019-03-19 16:29:56 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-03-19 16:29:56 +0000 |
commit | 9727c320342dfaffeb13c4b5894fb4a9047943d7 (patch) | |
tree | f329ab3d2de63de83945239370bfab55accbb3a6 /models-tosca/src/test/java/org/onap | |
parent | 998fb98e470205171ba9dc37674ea9d1c31e54ed (diff) |
Move examples into separate module
Issue-ID: POLICY-1195
Change-Id: Id2dc5b5b490134648ca267e27b795f3f4c03bc7b
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-tosca/src/test/java/org/onap')
2 files changed, 10 insertions, 11 deletions
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/serialization/LegacyOperationalPolicySerializationTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/serialization/LegacyOperationalPolicySerializationTest.java index 76721046e..3c9deb7df 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/serialization/LegacyOperationalPolicySerializationTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/serialization/LegacyOperationalPolicySerializationTest.java @@ -31,7 +31,7 @@ import java.io.IOException; import org.junit.Before; import org.junit.Test; -import org.onap.policy.common.utils.resources.TextFileUtils; +import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.models.base.PfValidationResult; import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy; import org.onap.policy.models.tosca.legacy.mapping.LegacyOperationalPolicyMapper; @@ -57,9 +57,9 @@ public class LegacyOperationalPolicySerializationTest { @Test public void testJsonDeserialization() throws JsonSyntaxException, IOException { - LegacyOperationalPolicy legacyOperationalPolicy = gson.fromJson( - TextFileUtils.getTextFileAsString("src/test/resources/policies/vCPE.policy.operational.input.json"), - LegacyOperationalPolicy.class); + String vcpePolicyJson = ResourceUtils.getResourceAsString("policies/vCPE.policy.operational.input.json"); + + LegacyOperationalPolicy legacyOperationalPolicy = gson.fromJson(vcpePolicyJson, LegacyOperationalPolicy.class); ToscaServiceTemplate serviceTemplate = new LegacyOperationalPolicyMapper().toToscaServiceTemplate(legacyOperationalPolicy); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java index 4c3cbc85a..565fd6cb4 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java @@ -31,7 +31,7 @@ import java.io.IOException; import org.junit.Before; import org.junit.Test; -import org.onap.policy.common.utils.resources.TextFileUtils; +import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.models.base.PfValidationResult; import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate; import org.onap.policy.models.tosca.simple.serialization.ToscaServiceTemplateMessageBodyHandler; @@ -57,11 +57,9 @@ public class MonitoringPolicySerializationTest { @Test public void testJsonDeserialization() throws JsonSyntaxException, IOException { - ToscaServiceTemplate serviceTemplate = gson.fromJson( - TextFileUtils - .getTextFileAsString("src/test/resources/policies/vCPE.policy.monitoring.input.tosca.json"), - ToscaServiceTemplate.class); + String vcpePolicyJson = ResourceUtils.getResourceAsString("policies/vCPE.policy.monitoring.input.tosca.json"); + ToscaServiceTemplate serviceTemplate = gson.fromJson(vcpePolicyJson, ToscaServiceTemplate.class); assertNotNull(serviceTemplate); LOGGER.info(serviceTemplate.validate(new PfValidationResult()).toString()); assertTrue(serviceTemplate.validate(new PfValidationResult()).isValid()); @@ -73,8 +71,9 @@ public class MonitoringPolicySerializationTest { @Test public void testYamlDeserialization() throws JsonSyntaxException, IOException { Yaml yaml = new Yaml(); - Object yamlObject = yaml.load(TextFileUtils - .getTextFileAsString("src/test/resources/policies/vCPE.policy.monitoring.input.tosca.yaml")); + + String vcpePolicyYaml = ResourceUtils.getResourceAsString("policies/vCPE.policy.monitoring.input.tosca.yaml"); + Object yamlObject = yaml.load(vcpePolicyYaml); String yamlAsJsonString = new Gson().toJson(yamlObject); |