diff options
author | Kevin Smokowski <ks6305@att.com> | 2018-02-23 20:51:21 +0000 |
---|---|---|
committer | Timoney, Dan (dt5972) <dt5972@att.com> | 2018-03-02 16:59:31 -0500 |
commit | 168181418de462c53f7c0c326ea3ce5200467f09 (patch) | |
tree | ff36671351e7771543ca47b77649748055eac82e /sli/provider/src/test/java/org | |
parent | 4023a8102388ad00afaf569e4d85c59bca2a33b8 (diff) |
fix setnode null feature
short prefixes could cause bad behavior in the setnode null feature
Change-Id: I3876eaece8b8d695b0a98d8b5d69f955f2149402
Issue-ID: CCSDK-190
Signed-off-by: Kevin Smokowski <ks6305@att.com>
Diffstat (limited to 'sli/provider/src/test/java/org')
-rw-r--r-- | sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/SetNodeExecutorTest.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/SetNodeExecutorTest.java b/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/SetNodeExecutorTest.java new file mode 100644 index 00000000..1333d070 --- /dev/null +++ b/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/SetNodeExecutorTest.java @@ -0,0 +1,56 @@ +package org.onap.ccsdk.sli.core.sli.provider;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import java.util.LinkedList;
+import org.junit.Test;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
+import org.onap.ccsdk.sli.core.sli.SvcLogicNode;
+import org.onap.ccsdk.sli.core.sli.SvcLogicParser;
+
+public class SetNodeExecutorTest {
+ @Test
+ public void clearProperties() throws Exception {
+ SetNodeExecutor sne = new SetNodeExecutor();
+ SvcLogicContext ctx = new SvcLogicContext();
+
+ SvcLogicParser slp = new SvcLogicParser();
+ LinkedList<SvcLogicGraph> graph = slp.parse("src/test/resources/clearValues.xml");
+ SvcLogicNode root = graph.getFirst().getRootNode();
+ SvcLogicNode nodeOne = root.getOutcomeValue("1");
+ SvcLogicNode nodeTwo = root.getOutcomeValue("2");
+
+ sne.execute(nodeOne, ctx);
+ sne.execute(nodeTwo, ctx);
+
+ assertNull(ctx.getAttribute("si.field1"));
+ assertNull(ctx.getAttribute("si.field2"));
+ assertNull(ctx.getAttribute("si.field3"));
+ assertEquals("6", ctx.getAttribute("search1"));
+ assertEquals("KeepMe!", ctx.getAttribute("simonSays"));
+ }
+
+ @Test
+ public void subtreeCopy() throws Exception {
+ SetNodeExecutor sne = new SetNodeExecutor();
+ SvcLogicContext ctx = new SvcLogicContext();
+
+ SvcLogicParser slp = new SvcLogicParser();
+ LinkedList<SvcLogicGraph> graph = slp.parse("src/test/resources/copyValues.xml");
+ SvcLogicNode root = graph.getFirst().getRootNode();
+ SvcLogicNode nodeOne = root.getOutcomeValue("1");
+ SvcLogicNode nodeTwo = root.getOutcomeValue("2");
+
+ sne.execute(nodeOne, ctx);
+ sne.execute(nodeTwo, ctx);
+
+ assertEquals("1",ctx.getAttribute("si.field1"));
+ assertEquals("2",ctx.getAttribute("si.field2"));
+ assertEquals("3",ctx.getAttribute("si.field3"));
+ assertEquals("1",ctx.getAttribute("rootTwo.field1"));
+ assertEquals("2",ctx.getAttribute("rootTwo.field2"));
+ assertEquals("3",ctx.getAttribute("rootTwo.field3"));
+ }
+
+}
|