diff options
author | jhh <jorge.hernandez-herrero@att.com> | 2020-08-21 13:29:21 -0500 |
---|---|---|
committer | jhh <jorge.hernandez-herrero@att.com> | 2020-08-21 13:32:52 -0500 |
commit | 0a5d9cf30c61956e62cc7db4faf84f999a7196cc (patch) | |
tree | cb5bf992abb5faa0c300b77e5d85e3e953e4f9be /controlloop/common/eventmanager/src/test/java | |
parent | 56efff004af2d1be64c67f7c8091cb4553a0e86b (diff) |
remove legacy operational policies support
Issue-ID: POLICY-2765
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: I454365943465863b108ba8668b2bc4b201986959
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()); |