From 0a5d9cf30c61956e62cc7db4faf84f999a7196cc Mon Sep 17 00:00:00 2001 From: jhh Date: Fri, 21 Aug 2020 13:29:21 -0500 Subject: remove legacy operational policies support Issue-ID: POLICY-2765 Signed-off-by: jhh Change-Id: I454365943465863b108ba8668b2bc4b201986959 --- .../controlloop/processor/ControlLoopProcessorTest.java | 15 +-------------- .../policy/controlloop/utils/ControlLoopUtilsTest.java | 9 +++++++-- 2 files changed, 8 insertions(+), 16 deletions(-) (limited to 'controlloop/common/eventmanager/src/test/java') 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 @@ -79,19 +79,6 @@ public class ControlLoopProcessorTest { return serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).get(policyName); } - @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 { @@ -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()); -- cgit 1.2.3-korg