aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SetNodeExecutor.java5
-rw-r--r--sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/SetNodeExecutorTest.java5
-rw-r--r--sli/provider/src/test/resources/clearArrayValues.xml5
3 files changed, 15 insertions, 0 deletions
diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SetNodeExecutor.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SetNodeExecutor.java
index 758f2039..5019b568 100644
--- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SetNodeExecutor.java
+++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SetNodeExecutor.java
@@ -131,6 +131,11 @@ public class SetNodeExecutor extends SvcLogicNodeExecutor {
// If RHS is empty, unset attributes in LHS
LinkedList<String> parmsToRemove = new LinkedList<String>();
String prefix = lhsVarName + ".";
+ //Clear length value in case an array exists with this prefix
+ String lengthParamName = lhsVarName + "_length";
+ parmsToRemove.add(lengthParamName);
+ LOG.debug("Unsetting " + lengthParamName + " because prefix " + prefix + " is being cleared.");
+
for (String curCtxVarname : ctx.getAttributeKeySet()) {
String curCtxVarnameMatchingValue = curCtxVarname;
//Special handling for reseting array values, strips out brackets and any numbers between the brackets
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
index c400bf5d..9ba2c05e 100644
--- 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
@@ -48,6 +48,11 @@ public class SetNodeExecutorTest {
assertNull(ctx.getAttribute("si[0].field1"));
assertNull(ctx.getAttribute("si[1].field2"));
assertNull(ctx.getAttribute("si[2].field3"));
+ assertNull(ctx.getAttribute("si_length"));
+ assertNull(ctx.getAttribute("si[0].subarray[0]"));
+ assertNull(ctx.getAttribute("si[0].subarray[1]"));
+ assertNull(ctx.getAttribute("si[0].subarray[2]"));
+ assertNull(ctx.getAttribute("si[0].subarray_length"));
assertEquals("6", ctx.getAttribute("search1"));
assertEquals("KeepMe!", ctx.getAttribute("simonSays"));
}
diff --git a/sli/provider/src/test/resources/clearArrayValues.xml b/sli/provider/src/test/resources/clearArrayValues.xml
index 629322d6..8f40058f 100644
--- a/sli/provider/src/test/resources/clearArrayValues.xml
+++ b/sli/provider/src/test/resources/clearArrayValues.xml
@@ -7,6 +7,11 @@
<parameter name='si[0].field1' value='1' />
<parameter name='si[1].field2' value='2' />
<parameter name='si[2].field3' value='3' />
+ <parameter name='si_length' value='3' />
+ <parameter name='si[0].subarray[0]' value='a' />
+ <parameter name='si[0].subarray[1]' value='b' />
+ <parameter name='si[0].subarray[2]' value='c' />
+ <parameter name='si[0].subarray_length' value='3' />
<parameter name='search1' value='6' />
<parameter name='simonSays' value='KeepMe!' />
</set>