diff options
Diffstat (limited to 'controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/utils/ControlLoopUtilsTest.java')
-rw-r--r-- | controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/utils/ControlLoopUtilsTest.java | 20 |
1 files changed, 5 insertions, 15 deletions
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 2c26517cd..2e4811475 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 @@ -19,12 +19,10 @@ package org.onap.policy.controlloop.utils; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.Map; import org.junit.Test; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.controlloop.drl.legacy.ControlLoopParams; @@ -35,22 +33,14 @@ public class ControlLoopUtilsTest { @Test public void testToControlLoopParams() throws Exception { String policy = - new String(Files.readAllBytes(Paths.get("src/test/resources/tosca-policy-operational-restart.json"))); - + new String(Files.readAllBytes(Paths.get("src/test/resources/tosca-policy-legacy-vcpe.json"))); ToscaPolicy toscaPolicy = new StandardCoder().decode(policy, ToscaPolicy.class); + ControlLoopParams params = ControlLoopUtils.toControlLoopParams(toscaPolicy); - assertNotNull(params); - assertNotNull(params.getClosedLoopControlName()); - assertEquals(toscaPolicy.getProperties().get("content"), params.getControlLoopYaml()); + assertEquals("ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", params.getClosedLoopControlName()); assertEquals(toscaPolicy.getName(), params.getPolicyName()); assertEquals(toscaPolicy.getVersion(), params.getPolicyVersion()); assertEquals(toscaPolicy.getType() + ":" + toscaPolicy.getVersion(), params.getPolicyScope()); - - assertNull(ControlLoopUtils.toControlLoopParams(null)); - - Map<String, Object> properties = toscaPolicy.getProperties(); - toscaPolicy.setProperties(null); - assertNull(ControlLoopUtils.toControlLoopParams(toscaPolicy)); - toscaPolicy.setProperties(properties); + assertSame(toscaPolicy, params.getToscaPolicy()); } }
\ No newline at end of file |