From f3f4dc3d82aed8424f820747c19ab546d8ca02b6 Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Wed, 1 Nov 2017 12:32:22 +0200 Subject: [PATCH] revert changes and update version Change-Id: I4fa696c7a20adfcce6733ac004c2457528d626a4 Issue-Id: SDC-569 Signed-off-by: Michael Lando --- pom.xml | 424 ++++++++++----------- .../sdc/toscaparser/api/TopologyTemplate.java | 22 +- .../sdc/toscaparser/api/ToscaTemplate.java | 28 +- .../sdc/toscaparser/api/extensions/ExtTools.java | 4 + .../sdc/toscaparser/api/functions/Function.java | 40 +- .../sdc/toscaparser/api/functions/GetProperty.java | 4 +- version.properties | 2 +- 7 files changed, 248 insertions(+), 276 deletions(-) diff --git a/pom.xml b/pom.xml index 2fae095..6af670b 100644 --- a/pom.xml +++ b/pom.xml @@ -1,212 +1,212 @@ - - 4.0.0 - - org.openecomp.sdc.jtosca - jtosca - 1.1.3-SNAPSHOT - sdc-jtosca - - - - - - UTF-8 - - - - - - - - true - ${project.basedir} - ${project.basedir}/target/jacoco.exec - https://nexus.onap.org - /content/sites/site/org/openecomp/sdc/jtosca/${project.version} - snapshots - releases - 176c31dfe190a - - - - - - - org.yaml - snakeyaml - 1.14 - compile - - - - org.slf4j - slf4j-api - 1.7.25 - - - - - - junit - junit - 4.12 - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.4 - - false - org.umlgraph.doclet.UmlGraphDoc - - org.umlgraph - umlgraph - 5.6 - - -views - true - - - - - - - - - org.apache.maven.plugins - maven-site-plugin - 3.4 - - - org.apache.maven.wagon - wagon-webdav-jackrabbit - 2.10 - - - - - - org.jacoco - jacoco-maven-plugin - 0.7.8 - - - - prepare-agent - - prepare-agent - - - ${sonar.jacoco.reportPath} - - - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - true - - ${nexus.proxy} - ${staging.profile.id} - ecomp-staging - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - true - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.3 - - - - org.codehaus.mojo - license-maven-plugin - 1.10 - - false - ============LICENSE_START======================================================= - ============LICENSE_END========================================================= - ================================================================================ - apache_v2 - 2017 - AT&T Intellectual Property. All rights - reserved. - jtosca - true - true - true - true - false - - **/*.java - - - - - first - - update-file-header - - - - - - - - - - - central - Official Maven repository - http://repo2.maven.org/maven2/ - - - ecomp-releases - Release Repository - ${nexus.proxy}/content/repositories/releases/ - - - ecomp-staging - Staging Repository - ${nexus.proxy}/content/repositories/staging/ - - - - - - ecomp-releases - Release Repository - ${nexus.proxy}/content/repositories/${releases.path}/ - - - ecomp-snapshots - Snapshot Repository - ${nexus.proxy}/content/repositories/${snapshots.path}/ - - - ecomp-site - dav:${nexus.proxy}${sitePath} - - - - + + 4.0.0 + + org.openecomp.sdc.jtosca + jtosca + 1.1.1-SNAPSHOT + sdc-jtosca + + + + + + UTF-8 + + + + + + + + true + ${project.basedir} + ${project.basedir}/target/jacoco.exec + https://nexus.onap.org + /content/sites/site/org/openecomp/sdc/jtosca/${project.version} + snapshots + releases + 176c31dfe190a + + + + + + + org.yaml + snakeyaml + 1.14 + compile + + + + org.slf4j + slf4j-api + 1.7.25 + + + + + + junit + junit + 4.12 + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + false + org.umlgraph.doclet.UmlGraphDoc + + org.umlgraph + umlgraph + 5.6 + + -views + true + + + + + + + + + org.apache.maven.plugins + maven-site-plugin + 3.4 + + + org.apache.maven.wagon + wagon-webdav-jackrabbit + 2.10 + + + + + + org.jacoco + jacoco-maven-plugin + 0.7.8 + + + + prepare-agent + + prepare-agent + + + ${sonar.jacoco.reportPath} + + + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + ${nexus.proxy} + ${staging.profile.id} + ecomp-staging + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.5.1 + true + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.3 + + + + org.codehaus.mojo + license-maven-plugin + 1.10 + + false + ============LICENSE_START======================================================= + ============LICENSE_END========================================================= + ================================================================================ + apache_v2 + 2017 + AT&T Intellectual Property. All rights + reserved. + jtosca + true + true + true + true + false + + **/*.java + + + + + first + + update-file-header + + + + + + + + + + + central + Official Maven repository + http://repo2.maven.org/maven2/ + + + ecomp-releases + Release Repository + ${nexus.proxy}/content/repositories/releases/ + + + ecomp-staging + Staging Repository + ${nexus.proxy}/content/repositories/staging/ + + + + + + ecomp-releases + Release Repository + ${nexus.proxy}/content/repositories/${releases.path}/ + + + ecomp-snapshots + Snapshot Repository + ${nexus.proxy}/content/repositories/${snapshots.path}/ + + + ecomp-site + dav:${nexus.proxy}${sitePath} + + + + diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java b/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java index 709dc81..25f118b 100644 --- a/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java +++ b/src/main/java/org/openecomp/sdc/toscaparser/api/TopologyTemplate.java @@ -48,15 +48,13 @@ public class TopologyTemplate { private String description; private ToscaGraph graph; private SubstitutionMappings substitutionMappings; - private boolean resolveGetInput; public TopologyTemplate( LinkedHashMap _template, LinkedHashMap _customDefs, LinkedHashMap _relTypes,//TYPE LinkedHashMap _parsedParams, - NodeTemplate _subMappedNodeTemplate, - boolean _resolveGetInput) { + NodeTemplate _subMappedNodeTemplate) { tpl = _template; if(tpl != null) { @@ -65,7 +63,6 @@ public class TopologyTemplate { customDefs = _customDefs; relTypes = _relTypes; parsedParams = _parsedParams; - resolveGetInput = _resolveGetInput; _validateField(); description = _tplDescription(); inputs = _inputs(); @@ -403,14 +400,14 @@ public class TopologyTemplate { if(nodeTemplates != null) { for(NodeTemplate nt: nodeTemplates) { for(Property prop: nt.getPropertiesObjects()) { - prop.setValue(Function.getFunction(this,nt,prop.getValue(), resolveGetInput)); + prop.setValue(Function.getFunction(this,nt,prop.getValue())); } for(InterfacesDef ifd: nt.getInterfaces()) { LinkedHashMap ifin = ifd.getInputs(); if(ifin != null) { for(Map.Entry me: ifin.entrySet()) { String name = me.getKey(); - Object value = Function.getFunction(this,nt,me.getValue(), resolveGetInput); + Object value = Function.getFunction(this,nt,me.getValue()); ifd.setInput(name,value); } } @@ -441,7 +438,7 @@ public class TopologyTemplate { (LinkedHashMap)rel.get("properties"); for(String key: relprops.keySet()) { Object value = relprops.get(key); - Object func = Function.getFunction(this,req,value, resolveGetInput); + Object func = Function.getFunction(this,req,value); relprops.put(key,func); } } @@ -451,7 +448,7 @@ public class TopologyTemplate { for(Capability cap: nt.getCapabilitiesObjects()) { if(cap.getPropertiesObjects() != null) { for(Property prop: cap.getPropertiesObjects()) { - Object propvalue = Function.getFunction(this,nt,prop.getValue(), resolveGetInput); + Object propvalue = Function.getFunction(this,nt,prop.getValue()); if(propvalue instanceof GetInput) { propvalue = ((GetInput)propvalue).result(); for(String p: cap.getProperties().keySet()) { @@ -478,8 +475,7 @@ public class TopologyTemplate { Object func = Function.getFunction( this, relTpl, - value, - resolveGetInput); + value); iface.setInput(name,func); } } @@ -490,7 +486,7 @@ public class TopologyTemplate { } } for(Output output: outputs) { - Object func = Function.getFunction(this,outputs,output.getValue(), resolveGetInput); + Object func = Function.getFunction(this,outputs,output.getValue()); if(func instanceof GetAttribute) { output.setAttr(Output.VALUE,func); } @@ -546,10 +542,6 @@ public class TopologyTemplate { public LinkedHashMap getParsedParams() { return parsedParams; } - - public boolean getResolveGetInput() { - return resolveGetInput; - } } /*python diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java b/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java index 5d5cb87..76b86f5 100644 --- a/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java +++ b/src/main/java/org/openecomp/sdc/toscaparser/api/ToscaTemplate.java @@ -69,7 +69,6 @@ public class ToscaTemplate extends Object { private String path; private String inputPath; private LinkedHashMap parsedParams; - private boolean resolveGetInput; private LinkedHashMap tpl; private String version; private ArrayList imports; @@ -90,25 +89,11 @@ public class ToscaTemplate extends Object { private int nestingLoopCounter; private LinkedHashMap> metaProperties; + @SuppressWarnings("unchecked") public ToscaTemplate(String _path, - LinkedHashMap _parsedParams, - boolean aFile, - LinkedHashMap yamlDictTpl) throws JToscaException { - init(_path, _parsedParams, aFile, yamlDictTpl, true); - } - - public ToscaTemplate(String _path, - LinkedHashMap _parsedParams, + LinkedHashMap _parsedParams, boolean aFile, - LinkedHashMap yamlDictTpl, boolean resolveGetInput) throws JToscaException { - init(_path, _parsedParams, aFile, yamlDictTpl, resolveGetInput); - } - - @SuppressWarnings("unchecked") - private void init(String _path, - LinkedHashMap _parsedParams, - boolean aFile, - LinkedHashMap yamlDictTpl, boolean _resolveGetInput) throws JToscaException { + LinkedHashMap yamlDictTpl) throws JToscaException { ThreadLocalsHolder.setCollector(new ExceptionCollector(_path)); @@ -131,7 +116,6 @@ public class ToscaTemplate extends Object { csarTempDir = null; nestedToscaTplsWithTopology = new ConcurrentHashMap<>(); nestedToscaTemplatesWithTopology = new ArrayList(); - resolveGetInput = _resolveGetInput; if(_path != null && !_path.isEmpty()) { // save the original input path @@ -222,8 +206,7 @@ public class ToscaTemplate extends Object { _getAllCustomDefs(imports), relationshipTypes, parsedParams, - null, - resolveGetInput); + null); } private ArrayList _inputs() { @@ -401,8 +384,7 @@ public class ToscaTemplate extends Object { _getAllCustomDefs(alim), relationshipTypes, parsedParams, - nt, - resolveGetInput); + nt); if(topologyWithSubMapping.getSubstitutionMappings() != null) { // Record nested topology templates in top level template //nestedToscaTemplatesWithTopology.add(topologyWithSubMapping); diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/extensions/ExtTools.java b/src/main/java/org/openecomp/sdc/toscaparser/api/extensions/ExtTools.java index 90aa35c..6403d6e 100644 --- a/src/main/java/org/openecomp/sdc/toscaparser/api/extensions/ExtTools.java +++ b/src/main/java/org/openecomp/sdc/toscaparser/api/extensions/ExtTools.java @@ -37,6 +37,10 @@ public class ExtTools { // for all folders in extdir File extDir = new File(extdir); File extDirList[] = extDir.listFiles(); + if (extDirList == null) { + String a = "aaaa"; + + } if (extDirList != null) { for(File f: extDirList) { if(f.isDirectory()) { diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/functions/Function.java b/src/main/java/org/openecomp/sdc/toscaparser/api/functions/Function.java index 7615a00..85fa62e 100644 --- a/src/main/java/org/openecomp/sdc/toscaparser/api/functions/Function.java +++ b/src/main/java/org/openecomp/sdc/toscaparser/api/functions/Function.java @@ -3,7 +3,6 @@ package org.openecomp.sdc.toscaparser.api.functions; import java.util.*; import org.openecomp.sdc.toscaparser.api.TopologyTemplate; -import org.openecomp.sdc.toscaparser.api.ToscaTemplate; public abstract class Function { @@ -78,7 +77,7 @@ public abstract class Function { } @SuppressWarnings("unchecked") - public static Object getFunction(TopologyTemplate ttpl,Object context,Object rawFunctionObj, boolean resolveGetInput) { + public static Object getFunction(TopologyTemplate ttpl,Object context,Object rawFunctionObj) { // Gets a Function instance representing the provided template function. // If the format provided raw_function format is not relevant for template @@ -99,13 +98,13 @@ public abstract class Function { if (rawFunctionObj instanceof LinkedHashMap) { // In map type case LinkedHashMap rawFunction = ((LinkedHashMap) rawFunctionObj); if(rawFunction.size() == 1) { // End point - return getFunctionForObjectItem(ttpl, context, rawFunction, resolveGetInput); + return getFunctionForObjectItem(ttpl, context, rawFunction); } else { // iterate over map nested properties in recursion, convert leaves to function, // and collect them in the same hierarchy as the original map. LinkedHashMap rawFunctionObjMap = new LinkedHashMap(); for (Object rawFunctionObjItem: rawFunction.entrySet()) { - Object itemValue = getFunction(ttpl, context, ((Map.Entry)rawFunctionObjItem).getValue(), resolveGetInput); + Object itemValue = getFunction(ttpl, context, ((Map.Entry)rawFunctionObjItem).getValue()); rawFunctionObjMap.put(((Map.Entry)rawFunctionObjItem).getKey(), itemValue); } return rawFunctionObjMap; @@ -115,7 +114,7 @@ public abstract class Function { // and collect them in the same hierarchy as the original list. ArrayList rawFunctionObjList = new ArrayList<>(); for (Object rawFunctionObjItem: (ArrayList) rawFunctionObj) { - rawFunctionObjList.add(getFunction(ttpl, context, rawFunctionObjItem, resolveGetInput)); + rawFunctionObjList.add(getFunction(ttpl, context, rawFunctionObjItem)); } return rawFunctionObjList; } @@ -123,7 +122,7 @@ public abstract class Function { return rawFunctionObj; } - private static Object getFunctionForObjectItem(TopologyTemplate ttpl, Object context, Object rawFunctionObjItem, boolean resolveGetInput) { + private static Object getFunctionForObjectItem(TopologyTemplate ttpl, Object context, Object rawFunctionObjItem) { if(isFunction(rawFunctionObjItem)) { LinkedHashMap rawFunction = (LinkedHashMap) rawFunctionObjItem; String funcName = (new ArrayList(rawFunction.keySet())).get(0); @@ -138,23 +137,18 @@ public abstract class Function { funcArgs.add(oargs); } - switch (funcType) { - case "GetInput": - if (resolveGetInput) { - GetInput input = new GetInput(ttpl, context, funcName, funcArgs); - return input.result(); - } - return new GetInput(ttpl, context, funcName, funcArgs); - case "GetAttribute": - return new GetAttribute(ttpl, context, funcName, funcArgs); - case "GetProperty": - return new GetProperty(ttpl, context, funcName, funcArgs); - case "GetOperationOutput": - return new GetOperationOutput(ttpl, context, funcName, funcArgs); - case "Concat": - return new Concat(ttpl, context, funcName, funcArgs); - case "Token": - return new Token(ttpl, context, funcName, funcArgs); + if (funcType.equals("GetInput")) { + return new GetInput(ttpl, context, funcName, funcArgs); + } else if (funcType.equals("GetAttribute")) { + return new GetAttribute(ttpl, context, funcName, funcArgs); + } else if (funcType.equals("GetProperty")) { + return new GetProperty(ttpl, context, funcName, funcArgs); + } else if (funcType.equals("GetOperationOutput")) { + return new GetOperationOutput(ttpl, context, funcName, funcArgs); + } else if (funcType.equals("Concat")) { + return new Concat(ttpl, context, funcName, funcArgs); + } else if (funcType.equals("Token")) { + return new Token(ttpl, context, funcName, funcArgs); } } } diff --git a/src/main/java/org/openecomp/sdc/toscaparser/api/functions/GetProperty.java b/src/main/java/org/openecomp/sdc/toscaparser/api/functions/GetProperty.java index 71420e8..3550542 100644 --- a/src/main/java/org/openecomp/sdc/toscaparser/api/functions/GetProperty.java +++ b/src/main/java/org/openecomp/sdc/toscaparser/api/functions/GetProperty.java @@ -58,7 +58,7 @@ public class GetProperty extends Function { } Object prop = foundProp.getValue(); if(prop instanceof Function) { - Function.getFunction(toscaTpl,context, prop, toscaTpl.getResolveGetInput()); + Function.getFunction(toscaTpl,context, prop); } } else if(args.size() >= 3) { @@ -336,7 +336,7 @@ public class GetProperty extends Function { if(propertyValue instanceof Function) { return ((Function)propertyValue).result(); } - return Function.getFunction(toscaTpl,context,propertyValue, toscaTpl.getResolveGetInput()); + return Function.getFunction(toscaTpl,context,propertyValue); } public String getNodeTemplateName() { diff --git a/version.properties b/version.properties index 7921ad4..6608eae 100644 --- a/version.properties +++ b/version.properties @@ -5,7 +5,7 @@ major=1 minor=1 -patch=3 +patch=1 base_version=${major}.${minor}.${patch} -- 2.16.6