diff options
Diffstat (limited to 'controlloop/common/eventmanager/src/test/java')
2 files changed, 8 insertions, 16 deletions
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/processor/ControlLoopProcessorTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/processor/ControlLoopProcessorTest.java index 47e7d5344..1031c86c7 100644 --- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/processor/ControlLoopProcessorTest.java +++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/processor/ControlLoopProcessorTest.java @@ -80,19 +80,6 @@ public class ControlLoopProcessorTest { } @Test - public void testControlLoopFromToscaLegacy() throws IOException, CoderException, ControlLoopException { - String policy = - new String(Files.readAllBytes(Paths.get("src/test/resources/tosca-policy-legacy-vcpe.json"))); - assertNotNull( - new ControlLoopProcessor(coder.decode(policy, ToscaPolicy.class)).getCurrentPolicy()); - - policy = - new String(Files.readAllBytes(Paths.get("src/test/resources/tosca-policy-legacy-vdns.json"))); - assertNotNull( - new ControlLoopProcessor(coder.decode(policy, ToscaPolicy.class)).getCurrentPolicy()); - } - - @Test public void testControlLoopFromToscaCompliant() throws CoderException, ControlLoopException { assertNotNull( @@ -119,7 +106,7 @@ public class ControlLoopProcessorTest { public void testControlLoopFromToscaCompliantBad() throws CoderException { ToscaPolicy toscaPolicy = getPolicyFromResource( "policies/vCPE.policy.operational.input.tosca.json", "operational.restart"); - toscaPolicy.setType("onap.policies.controlloop.Operational"); + toscaPolicy.setVersion(null); assertThatThrownBy(() -> new ControlLoopProcessor(toscaPolicy)).hasCauseInstanceOf(CoderException.class); } diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/utils/ControlLoopUtilsTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/utils/ControlLoopUtilsTest.java index 7238ba05b..c590741f2 100644 --- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/utils/ControlLoopUtilsTest.java +++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/utils/ControlLoopUtilsTest.java @@ -28,15 +28,20 @@ import java.nio.file.Files; import java.nio.file.Paths; import org.junit.Test; import org.onap.policy.common.utils.coder.StandardCoder; +import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.controlloop.drl.legacy.ControlLoopParams; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; +import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; public class ControlLoopUtilsTest { @Test public void testToControlLoopParams() throws Exception { - String policy = Files.readString(Paths.get("src/test/resources/tosca-policy-legacy-vcpe.json")); - ToscaPolicy toscaPolicy = new StandardCoder().decode(policy, ToscaPolicy.class); + String policyJson = + ResourceUtils.getResourceAsString("policies/vCPE.policy.operational.input.tosca.json"); + ToscaServiceTemplate serviceTemplate = new StandardCoder().decode(policyJson, ToscaServiceTemplate.class); + ToscaPolicy toscaPolicy = + serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get("operational.restart"); ControlLoopParams params = ControlLoopUtils.toControlLoopParams(toscaPolicy); assertEquals("ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", params.getClosedLoopControlName()); |