summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPavel Aharoni <pa0916@att.com>2017-09-26 18:51:38 +0300
committerPavel Aharoni <pa0916@att.com>2017-09-26 18:51:38 +0300
commiteec33fb03652c0421e83052de60ec95e18e3382b (patch)
tree8c98fbd06bef8f0201282e29453790a5d20da939 /src
parentb0686a9ab5db28b0ee1fc3fea270667023626e5f (diff)
[SDC-402] TDP 335705
Change-Id: Idfba2f7ebc3a7e3319cdfc52014081f7d845b85d Signed-off-by: Pavel Aharoni <pa0916@att.com>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/openecomp/sdc/toscaparser/api/elements/InterfacesDef.java5
-rw-r--r--src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java3
-rw-r--r--src/main/java/org/openecomp/sdc/toscaparser/api/functions/GetInput.java20
3 files changed, 16 insertions, 12 deletions
diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/elements/InterfacesDef.java b/src/main/java/org/openecomp/sdc/toscaparser/api/elements/InterfacesDef.java
index c13fd96..357ee23 100644
--- a/src/main/java/org/openecomp/sdc/toscaparser/api/elements/InterfacesDef.java
+++ b/src/main/java/org/openecomp/sdc/toscaparser/api/elements/InterfacesDef.java
@@ -1,14 +1,13 @@
package org.openecomp.sdc.toscaparser.api.elements;
+import org.openecomp.sdc.toscaparser.api.EntityTemplate;
import org.openecomp.sdc.toscaparser.api.common.JToscaValidationIssue;
+import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
-import org.openecomp.sdc.toscaparser.api.EntityTemplate;
-import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder;
-
public class InterfacesDef extends StatefulEntityType {
public static final String LIFECYCLE = "tosca.interfaces.node.lifecycle.Standard";
diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java b/src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java
index 157e016..cb4aa74 100644
--- a/src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java
+++ b/src/main/java/org/openecomp/sdc/toscaparser/api/elements/NodeType.java
@@ -1,13 +1,12 @@
package org.openecomp.sdc.toscaparser.api.elements;
import org.openecomp.sdc.toscaparser.api.common.JToscaValidationIssue;
+import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
-import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder;
-
public class NodeType extends StatefulEntityType {
// TOSCA built-in node type
diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/functions/GetInput.java b/src/main/java/org/openecomp/sdc/toscaparser/api/functions/GetInput.java
index 67cecd7..14b0d4e 100644
--- a/src/main/java/org/openecomp/sdc/toscaparser/api/functions/GetInput.java
+++ b/src/main/java/org/openecomp/sdc/toscaparser/api/functions/GetInput.java
@@ -1,14 +1,14 @@
package org.openecomp.sdc.toscaparser.api.functions;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-
import org.openecomp.sdc.toscaparser.api.DataEntity;
import org.openecomp.sdc.toscaparser.api.TopologyTemplate;
import org.openecomp.sdc.toscaparser.api.common.JToscaValidationIssue;
import org.openecomp.sdc.toscaparser.api.parameters.Input;
import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+
public class GetInput extends Function {
public GetInput(TopologyTemplate toscaTpl,Object context,String name,ArrayList<Object> _args) {
@@ -51,11 +51,17 @@ public class GetInput extends Function {
Object value = DataEntity.validateDatatype(
type, toscaTpl.getParsedParams().get(getInputName()),null,null,null);
-
- if (value instanceof ArrayList && args.size() == 2 && args.get(1) instanceof Integer) {
- return ((ArrayList) value).get((Integer)args.get(1));
+ //SDC resolving Get Input
+ if (value instanceof ArrayList){
+ if(args.size() == 2 && args.get(1) instanceof Integer && ((ArrayList) value).size()> (Integer)args.get(1)){
+ return ((ArrayList) value).get((Integer) args.get(1));
+ }
+ else{
+ ThreadLocalsHolder.getCollector().appendValidationIssue(new JToscaValidationIssue("JE273",String.format(
+ "GetInputError: cannot resolve input name \"%s\", the expected structure is an argument with a name of input type list and a second argument with an index in the list", args.get(0))));
+ return null;
+ }
}
-
return value;
}