diff options
author | Pavel Aharoni <pa0916@att.com> | 2017-04-03 10:06:16 +0300 |
---|---|---|
committer | Pavel Aharoni <pa0916@att.com> | 2017-04-03 10:06:32 +0300 |
commit | 1df0b72a316dcc7f913061706db165d78d2c3a03 (patch) | |
tree | ba549dc1e15b963ee39cc55d577317c08367e53e /jython-tosca-parser | |
parent | b51f888ee16f8bf92c7d9a0331eaa05e3bb938d2 (diff) |
[SDC-8] trying to merge changes of tests and csars
Change-Id: Iac4d5bd1ea312b76cba52a172d5ac80757173409
Signed-off-by: Pavel Aharoni <pa0916@att.com>
Diffstat (limited to 'jython-tosca-parser')
7 files changed, 58 insertions, 39 deletions
diff --git a/jython-tosca-parser/pom.xml b/jython-tosca-parser/pom.xml index 29a8cd2..7e29249 100644 --- a/jython-tosca-parser/pom.xml +++ b/jython-tosca-parser/pom.xml @@ -9,7 +9,7 @@ </parent> <artifactId>jython-tosca-parser</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.4.1-SNAPSHOT</version> <dependencies> <dependency> diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java index 97563fb..abf1b53 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java @@ -1,5 +1,7 @@ package org.openecomp.sdc.toscaparser.api; +import static com.google.common.collect.ImmutableList.toImmutableList; + import java.util.List; import java.util.Objects; @@ -10,40 +12,47 @@ import com.google.common.base.MoreObjects; public class ToscaTemplate { - private final JyToscaTemplate jyToscaTemplate; - private final TopologyTemplate topologyTemplate; - - public ToscaTemplate(JyToscaTemplate jyToscaTemplate, TopologyTemplate topologyTemplate) { - this.jyToscaTemplate = Objects.requireNonNull(jyToscaTemplate); - this.topologyTemplate = Objects.requireNonNull(topologyTemplate); - } - - public String getVersion() { - return jyToscaTemplate.getJyVersion(); - } - - public String getDescription() { - return jyToscaTemplate.getJyDescription(); - } - - public TopologyTemplate getTopologyTemplate() { - return topologyTemplate; - } - - public List<NodeTemplate> getNodeTemplates() { - return topologyTemplate.getNodeTemplates(); - } - - public List<Input> getInputs() { - return topologyTemplate.getInputs(); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("version", getVersion()) - .add("description", getDescription()) - .add("topologyTemplate", topologyTemplate) - .toString(); - } + private final JyToscaTemplate jyToscaTemplate; + private final TopologyTemplate topologyTemplate; + + public ToscaTemplate(JyToscaTemplate jyToscaTemplate, TopologyTemplate topologyTemplate) { + this.jyToscaTemplate = Objects.requireNonNull(jyToscaTemplate); + this.topologyTemplate = Objects.requireNonNull(topologyTemplate); + } + + public String getVersion() { + return jyToscaTemplate.getJyVersion(); + } + + public String getDescription() { + return jyToscaTemplate.getJyDescription(); + } + + public TopologyTemplate getTopologyTemplate() { + return topologyTemplate; + } + + public List<NodeTemplate> getNodeTemplates() { + return topologyTemplate.getNodeTemplates(); + } + + public List<TopologyTemplate> getNestedTopologyTemplates() { + return jyToscaTemplate.getNestedTopologyTemplates() + .stream() + .map(TopologyTemplate::new) + .collect(toImmutableList()); + } + + public List<Input> getInputs() { + return topologyTemplate.getInputs(); + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("version", getVersion()) + .add("description", getDescription()) + .add("topologyTemplate", topologyTemplate) + .toString(); + } }
\ No newline at end of file diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java index b700c47..0b9ad7d 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/api/parameters/Input.java @@ -22,6 +22,8 @@ public class Input { return jyInput.getJyType(); } + + public boolean isRequired() { return jyInput.isJyRequired(); } diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java index c58a042..7cba568 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/JyToscaTemplate.java @@ -7,5 +7,6 @@ public interface JyToscaTemplate { String getJyVersion(); String getJyDescription(); List<JyNodeTemplate> getJyNodeTemplates(); + List<JyTopologyTemplate> getNestedTopologyTemplates(); JyTopologyTemplate getJyTopologyTemplate(); } diff --git a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java index 320e91b..253805b 100644 --- a/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java +++ b/jython-tosca-parser/src/main/java/org/openecomp/sdc/toscaparser/jython/parameters/JyInput.java @@ -4,6 +4,7 @@ public interface JyInput { String getJyName(); String getJyType(); + String getJyDefault(); boolean isJyRequired(); String getJyDescription(); } diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py index 7a4acd9..1bb58be 100644 --- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py +++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/parameters.py @@ -50,7 +50,10 @@ class Input(JyInput): return self.required def getJyDescription(self): - return self.description + return self.description + + def getJyDefault(self): + return self.default @property def type(self): diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py index 55485f0..6b3ea87 100644 --- a/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py +++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/tosca_parser-0.7.0-py2.7.egg/toscaparser/tosca_template.py @@ -119,8 +119,11 @@ class ToscaTemplate(JyToscaTemplate): return self.description def getJyTopologyTemplate(self): - return self.topology_template + return self.topology_template + def getJyNestedTopologyTemplates(self): + return self.nested_tosca_templates_with_topology + def _topology_template(self): return TopologyTemplate(self._tpl_topology_template(), self._get_all_custom_defs(), |