From b485c37b36ddb3ab5e8085c009b26e97c8e62d74 Mon Sep 17 00:00:00 2001 From: JulienBe Date: Wed, 28 Oct 2020 11:50:25 -0400 Subject: Upgrade Vulnerable Direct Dependencies [snakeyaml] Change-Id: I84417ab3d4f18634be519b837a34d1f1e774ceff Signed-off-by: amohamad Issue-ID: SDC-3051 Updated MVN dependencies in the respective pom.xml files Updated the signature of some methods to match new version 1.26 Modified test cases to match the new wording of exceptions Still working on troublshooting other failing test cases Change-Id: Ifc796574e6d8d4e4fc707db04944d83427b5dbe6 Signed-off-by: amohamad Signed-off-by: JulienBe --- .../nfv/nsd/tosca/yaml/UnsortedPropertyUtils.java | 5 +- .../openecomp/sdc/be/tosca/ToscaExportHandler.java | 5 +- .../onap-generic-artifact-browser-service/pom.xml | 1 - .../onap/sdc/tosca/services/MyPropertyUtils.java | 47 +++ .../services/StrictMapAppenderConstructor.java | 70 ++++ .../sdc/tosca/services/ToscaExtensionYamlUtil.java | 2 +- .../java/org/onap/sdc/tosca/services/YamlUtil.java | 352 ++++++++------------- onboarding/pom.xml | 1 - .../action-library-rest-types/pom.xml | 1 - .../action-library-rest/pom.xml | 1 - .../notifications-fe/pom.xml | 3 +- openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml | 16 +- .../validation-rest/validation-rest-types/pom.xml | 1 - .../vendor-license-rest/pom.xml | 1 - .../vendor-license-rest-services/pom.xml | 1 - .../vendor-license-rest-types/pom.xml | 1 - .../vendor-software-products-rest-types/pom.xml | 1 - .../SOL004MetaDirectoryValidatorTest.java | 66 ++-- .../openecomp-facade-api/pom.xml | 7 +- .../openecomp-facade-core/pom.xml | 6 +- .../openecomp-facade-lib/pom.xml | 16 +- .../openecomp-nosqldb-lib/pom.xml | 1 - openecomp-be/lib/openecomp-core-lib/pom.xml | 12 +- .../openecomp-sdc-enrichment-api/pom.xml | 3 +- .../openecomp-sdc-enrichment-core/pom.xml | 3 +- .../openecomp-sdc-enrichment-impl/pom.xml | 3 +- .../impl/tosca/BaseToscaEnrichmentTest.java | 8 +- .../lib/openecomp-sdc-enrichment-lib/pom.xml | 23 -- .../openecomp-sdc-externaltesting-api/pom.xml | 3 +- .../openecomp-sdc-externaltesting-impl/pom.xml | 3 +- .../openecomp-sdc-model-api/pom.xml | 11 +- .../openecomp-sdc-model-impl/pom.xml | 3 +- openecomp-be/lib/openecomp-sdc-model-lib/pom.xml | 13 - .../openecomp-sdc-notification-api/pom.xml | 3 +- .../openecomp-sdc-notification-core/pom.xml | 3 +- .../openecomp-sdc-notification-websocket/pom.xml | 3 +- .../openecomp-sdc-notification-worker/pom.xml | 3 +- .../openecomp-sdc-tosca-generator-api/pom.xml | 3 +- .../openecomp-sdc-tosca-generator-core/pom.xml | 3 +- .../openecomp-sdc-translator-api/pom.xml | 3 +- .../openecomp-sdc-translator-core/pom.xml | 3 +- .../org/openecomp/sdc/translator/TestUtils.java | 10 +- .../one_exCP_naming_diff/MainServiceTemplate.yaml | 1 - .../one_fixed_ips_diff/MainServiceTemplate.yaml | 1 - .../one_flavor_name_diff/MainServiceTemplate.yaml | 1 - .../one_image_missing/MainServiceTemplate.yaml | 1 - .../one_image_name_diff/MainServiceTemplate.yaml | 1 - .../MainServiceTemplate.yaml | 1 - .../MainServiceTemplate.yaml | 1 - .../MainServiceTemplate.yaml | 1 - .../MainServiceTemplate.yaml | 1 - .../three_compute_valid/MainServiceTemplate.yaml | 1 - .../MainServiceTemplate.yaml | 1 - .../MainServiceTemplate.yaml | 1 - .../different_port_types/MainServiceTemplate.yaml | 1 - .../MainServiceTemplate.yaml | 1 - .../more_than_one_port/MainServiceTemplate.yaml | 1 - .../one_compute_node/MainServiceTemplate.yaml | 1 - .../MainServiceTemplate.yaml | 1 - .../MainServiceTemplate.yaml | 1 - .../three_compute_valid/MainServiceTemplate.yaml | 1 - .../valid_pre_condition/MainServiceTemplate.yaml | 1 - .../openecomp-sdc-validation-api/pom.xml | 3 +- .../openecomp-sdc-validation-core/pom.xml | 3 +- .../sdc/validation/impl/ValidationManagerImpl.java | 4 - .../openecomp-sdc-validation-impl/pom.xml | 3 +- .../validation/impl/validators/YamlValidator.java | 77 +++-- .../NeutronPortNamingConventionValidator.java | 210 ++++++------ .../impl/validators/ContrailValidatorTest.java | 16 +- .../ForbiddenResourceGuideLineValidatorTest.java | 10 +- .../impl/validators/GlobalContextUtilTest.java | 2 +- .../impl/validators/HeatResourceValidatorTest.java | 2 +- .../impl/validators/HeatValidatorTest.java | 34 +- .../impl/validators/ManifestValidatorTest.java | 38 +-- .../impl/validators/PmDictionaryValidatorTest.java | 2 +- .../SharedResourceGuideLineValidatorTest.java | 36 +-- .../impl/validators/YamlValidatorTest.java | 143 ++++----- ...ContrailNetworkPolicyResourceValidatorTest.java | 4 +- .../heatresource/NestedResourceValidatorTest.java | 8 +- .../NeutronPortResourceValidatorTest.java | 6 +- .../NeutronSecurityGroupResourceValidatorTest.java | 4 +- .../NovaServerGroupResourceValidatorTest.java | 6 +- .../NovaServerResourceValidatorTest.java | 4 +- .../ResourceGroupResourceValidatorTest.java | 6 +- .../VirtualMachineInterfaceValidatorTest.java | 242 +++++++------- ...rviceInstanceNamingConventionValidatorTest.java | 6 +- ...rviceTemplateNamingConventionValidatorTest.java | 8 +- .../NeutronPortNamingConventionValidatorTest.java | 25 +- ...rverNamingConventionGuideLineValidatorTest.java | 36 +-- ...tualMachineInterfaceGuidelineValidatorTest.java | 18 +- .../sdc/validation/util/ValidationTestUtil.java | 22 +- .../missingparam/first.yaml | 11 +- .../positive/first.yaml | 11 - .../negative_test/input/main.yml | 11 - .../negative_test_non_string/input/main.yml | 11 - .../negative_test/input/main.yml | 11 - .../positive_test/input/main.yml | 11 - .../openecomp-sdc-validation-sdk/pom.xml | 3 +- .../sdc/validation/base/ResourceBaseValidator.java | 2 +- .../validation/base/ResourceBaseValidatorTest.java | 303 +++++++++++++----- .../openecomp-sdc-vendor-license-api/pom.xml | 3 +- .../openecomp-sdc-vendor-license-core/pom.xml | 3 +- .../pom.xml | 2 - .../openecomp-sdc-versioning-api/pom.xml | 3 +- .../openecomp-sdc-versioning-core/pom.xml | 3 +- .../openecomp-tosca-converter-api/pom.xml | 10 - .../openecomp-tosca-converter-core/pom.xml | 10 - .../PnfTransformationEngineParameterizedTest.java | 101 +++--- .../lib/openecomp-tosca-converter-lib/pom.xml | 13 +- pom.xml | 2 +- utils/DmaapPublisher/pom.xml | 2 +- 111 files changed, 1079 insertions(+), 1169 deletions(-) create mode 100644 common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/MyPropertyUtils.java create mode 100644 common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/StrictMapAppenderConstructor.java diff --git a/catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/main/java/org/openecomp/sdc/be/plugins/etsi/nfv/nsd/tosca/yaml/UnsortedPropertyUtils.java b/catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/main/java/org/openecomp/sdc/be/plugins/etsi/nfv/nsd/tosca/yaml/UnsortedPropertyUtils.java index 6c70e93f07..d2a8033105 100644 --- a/catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/main/java/org/openecomp/sdc/be/plugins/etsi/nfv/nsd/tosca/yaml/UnsortedPropertyUtils.java +++ b/catalog-be-plugins/etsi-nfv-nsd-csar-plugin/src/main/java/org/openecomp/sdc/be/plugins/etsi/nfv/nsd/tosca/yaml/UnsortedPropertyUtils.java @@ -1,4 +1,3 @@ - /* * ============LICENSE_START======================================================= * Copyright (C) 2020 Nordix Foundation @@ -30,8 +29,8 @@ import org.yaml.snakeyaml.introspector.PropertyUtils; public class UnsortedPropertyUtils extends PropertyUtils { @Override - protected Set createPropertySet(final Class clazz, final BeanAccess beanAccess) throws IntrospectionException { + protected Set createPropertySet(final Class clazz, final BeanAccess beanAccess) { final Collection fields = getPropertiesMap(clazz, BeanAccess.FIELD).values(); return new LinkedHashSet<>(fields); } -} +} \ No newline at end of file diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java index ddea498c6f..97b113e93e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java @@ -179,7 +179,7 @@ public class ToscaExportHandler { private static final String FAILED_TO_GET_DEFAULT_IMPORTS_CONFIGURATION = "convertToToscaTemplate - failed to get Default Imports section from configuration"; private static final String NOT_SUPPORTED_COMPONENT_TYPE = "Not supported component type {}"; private static final String NATIVE_ROOT = "tosca.nodes.Root"; - private static YamlUtil yamlUtil = new YamlUtil(); + private static final YamlUtil yamlUtil = new YamlUtil(); public ToscaExportHandler() { } @@ -1855,8 +1855,7 @@ public class ToscaExportHandler { private static class UnsortedPropertyUtils extends PropertyUtils { @Override - protected Set createPropertySet(Class type, BeanAccess bAccess) - throws IntrospectionException { + protected Set createPropertySet(Class type, BeanAccess bAccess) { Collection fields = getPropertiesMap(type, BeanAccess.FIELD).values(); return new LinkedHashSet<>(fields); } diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/pom.xml b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/pom.xml index 570d48bbaa..a79c13d54c 100644 --- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/pom.xml +++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/pom.xml @@ -13,7 +13,6 @@ onap-generic-artifact-browser-service - 1.21 1.4.3 false diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/MyPropertyUtils.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/MyPropertyUtils.java new file mode 100644 index 0000000000..466d669ad9 --- /dev/null +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/MyPropertyUtils.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.sdc.tosca.services; + +import org.yaml.snakeyaml.introspector.BeanAccess; +import org.yaml.snakeyaml.introspector.Property; +import org.yaml.snakeyaml.introspector.PropertyUtils; + +import java.util.LinkedHashSet; +import java.util.Set; + +public class MyPropertyUtils extends PropertyUtils { + //Unsorted properties + @Override + protected Set createPropertySet(Class type, BeanAccess bnAccess) { + return new LinkedHashSet<>(getPropertiesMap(type, + BeanAccess.FIELD).values()); + } + + @Override + public Property getProperty(Class type, String name) { + String updatedName = name; + if (YamlUtil.DEFAULT.equals(updatedName)) { + updatedName = YamlUtil.DEFAULT_STR; + } + return super.getProperty(type, updatedName); + } + +} diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/StrictMapAppenderConstructor.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/StrictMapAppenderConstructor.java new file mode 100644 index 0000000000..7babd428c8 --- /dev/null +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/StrictMapAppenderConstructor.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.sdc.tosca.services; + +import org.yaml.snakeyaml.constructor.Constructor; +import org.yaml.snakeyaml.nodes.MappingNode; +import org.yaml.snakeyaml.parser.ParserException; + +import java.util.AbstractMap; +import java.util.Map; +import java.util.Set; + +public class StrictMapAppenderConstructor extends Constructor { + /** + * Instantiates a new Strict map appender constructor. + * + * @param theRoot the the root + */ + public StrictMapAppenderConstructor(Class theRoot) { + super(theRoot); + } + + @Override + protected Map createDefaultMap(int initSize) { + final Map delegate = super.createDefaultMap(initSize); + return new AbstractMap<>() { + @Override + public Object put(Object key, Object value) { + if (delegate.containsKey(key)) { + throw new IllegalStateException("duplicate key: " + key); + } + return delegate.put(key, value); + } + + @Override + public Set> entrySet() { + return delegate.entrySet(); + } + }; + } + + @Override + protected Map constructMapping(MappingNode node) { + try { + return super.constructMapping(node); + } catch (IllegalStateException exception) { + throw new ParserException("while parsing MappingNode", + node.getStartMark(), exception.getMessage(), + node.getEndMark()); + } + } +} diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/ToscaExtensionYamlUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/ToscaExtensionYamlUtil.java index 45499d15f4..37d8411d9b 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/ToscaExtensionYamlUtil.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/ToscaExtensionYamlUtil.java @@ -51,7 +51,7 @@ public class ToscaExtensionYamlUtil extends YamlUtil { public class ToscaPropertyUtilsWithHeatExtension extends MyPropertyUtils { @Override - public Property getProperty(Class type, String name) throws IntrospectionException { + public Property getProperty(Class type, String name) { Class classType = type; try { if (type.equals(Class.forName(TOSCA_MODEL_PARAMETER_DEFINITION))) { diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java index 4ac60d40e4..8530846fae 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java @@ -16,32 +16,23 @@ package org.onap.sdc.tosca.services; -import java.util.List; -import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.yaml.snakeyaml.DumperOptions; +import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.TypeDescription; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.Constructor; -import org.yaml.snakeyaml.introspector.BeanAccess; import org.yaml.snakeyaml.introspector.Property; import org.yaml.snakeyaml.introspector.PropertyUtils; import org.yaml.snakeyaml.nodes.MappingNode; import org.yaml.snakeyaml.nodes.NodeTuple; import org.yaml.snakeyaml.nodes.Tag; -import org.yaml.snakeyaml.parser.ParserException; import org.yaml.snakeyaml.representer.Representer; - -import java.beans.IntrospectionException; import java.io.IOException; import java.io.InputStream; -import java.util.AbstractMap; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Set; +import java.util.*; /** * The type Yaml util. @@ -50,101 +41,107 @@ import java.util.Set; public class YamlUtil { private static final Logger LOGGER = LoggerFactory.getLogger(YamlUtil.class.getName()); - private static final String DEFAULT = "default"; - private static final String DEFAULT_STR = "_default"; - - /** - * Yaml to object t. - * - * @param the type parameter - * @param yamlContent the yaml content - * @param typClass the t class - * @return the t - */ - public T yamlToObject(String yamlContent, Class typClass) { - Constructor constructor = getConstructor(typClass); - constructor.setPropertyUtils(getPropertyUtils()); - TypeDescription yamlFileDescription = new TypeDescription(typClass); - constructor.addTypeDescription(yamlFileDescription); - Yaml yaml = new Yaml(constructor); - T yamlObj = (T) yaml.load(yamlContent); - //noinspection ResultOfMethodCallIgnored - yamlObj.toString(); - return yamlObj; - } + static final String DEFAULT = "default"; + static final String DEFAULT_STR = "_default"; - public InputStream loadYamlFileIs(String yamlFullFileName) { - return YamlUtil.class.getResourceAsStream(yamlFullFileName); - } - - /** - * Yaml to object t. - * - * @param the type parameter - * @param yamlContent the yaml content - * @param typClass the t class - * @return the t - */ - public T yamlToObject(InputStream yamlContent, Class typClass) { - try { - Constructor constructor = getConstructor(typClass); - constructor.setPropertyUtils(getPropertyUtils()); - TypeDescription yamlFileDescription = new TypeDescription(typClass); - constructor.addTypeDescription(yamlFileDescription); - Yaml yaml = new Yaml(constructor); - T yamlObj = (T) yaml.load(yamlContent); - if (yamlObj != null) { + /** + * Yaml to object t. + * + * @param the type parameter + * @param yamlContent the yaml content + * @param typClass the t class + * @return the t + */ + public T yamlToObject(String yamlContent, Class typClass) { + Constructor constructor = getConstructor(typClass); + constructor.setPropertyUtils(getPropertyUtils()); + TypeDescription yamlFileDescription = new TypeDescription(typClass); + constructor.addTypeDescription(yamlFileDescription); + T yamlObj = new Yaml(constructor, new Representer(), new DumperOptions(), getLoaderOptions()).load(yamlContent);; //noinspection ResultOfMethodCallIgnored yamlObj.toString(); return yamlObj; - } else { - throw new RuntimeException(); - } - } catch (Exception exception) { - throw new RuntimeException(exception); - } finally { - try { - if (yamlContent != null) { - yamlContent.close(); + } + + public InputStream loadYamlFileIs(String yamlFullFileName) { + return YamlUtil.class.getResourceAsStream(yamlFullFileName); + } + + /** + * Yaml to object t. + * + * @param the type parameter + * @param yamlContent the yaml content + * @param typClass the t class + * @return the t + */ + public T yamlToObject(InputStream yamlContent, Class typClass) { + try { + Constructor constructor = getConstructor(typClass); + constructor.setAllowDuplicateKeys(false); + constructor.setPropertyUtils(getPropertyUtils()); + TypeDescription yamlFileDescription = new TypeDescription(typClass); + constructor.addTypeDescription(yamlFileDescription); + //No Yaml Constructor takes only Constructor and LoaderOptions, that is why I had to pass anonymous Representer and DumperOptions objects + T yamlObj = new Yaml(constructor, new Representer(), new DumperOptions(), getLoaderOptions()).load(yamlContent); + if (yamlObj != null) { + //noinspection ResultOfMethodCallIgnored + yamlObj.toString(); + return yamlObj; + } else { + throw new RuntimeException(); + } + } catch (Exception exception) { + throw new RuntimeException(exception); + } finally { + try { + if (yamlContent != null) { + yamlContent.close(); + } + } catch (IOException ignore) { + //do nothing + } } - } catch (IOException ignore) { - //do nothing - } } - } + private LoaderOptions getLoaderOptions() { + LoaderOptions options = new LoaderOptions(); + options.setAllowDuplicateKeys(false); + options.setMaxAliasesForCollections(9999); + return options; + } - /** - * Gets constructor. - * - * @param the type parameter - * @param typClass the t class - * @return the constructor - */ - public Constructor getConstructor(Class typClass) { - return new StrictMapAppenderConstructor(typClass); - } - /** - * Gets property utils. - * - * @return the property utils - */ - protected PropertyUtils getPropertyUtils() { - return new MyPropertyUtils(); - } + /** + * Gets constructor. + * + * @param the type parameter + * @param typClass the t class + * @return the constructor + */ + public Constructor getConstructor(Class typClass) { + return new StrictMapAppenderConstructor(typClass); + } + /** + * Gets property utils. + * + * @return the property utils + */ + protected PropertyUtils getPropertyUtils() { + return new MyPropertyUtils(); + } - /** - * Yaml to map map. - * - * @param yamlContent the yaml content - * @return the map - */ - public Map> yamlToMap(InputStream yamlContent) { - Yaml yaml = new Yaml(); - return (Map>) yaml.load(yamlContent); - } + + /** + * Yaml to map map. + * + * @param yamlContent the yaml content + * @return the map + */ + public Map> yamlToMap(InputStream yamlContent) { + return new Yaml().load(yamlContent); + } /** @@ -172,137 +169,66 @@ public class YamlUtil { * @return The YAML Object */ public static Object read(final InputStream yamlFileInputStream) { - final Yaml yaml = new Yaml(); - return yaml.load(yamlFileInputStream); - } - - /** - * Object to yaml string. - * @param obj the obj - * @return the string - */ - public String objectToYaml(Object obj) { - DumperOptions options = new DumperOptions(); - options.setPrettyFlow(true); - options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); - Representer representer = new CustomRepresenter(); - representer.addClassTag(obj.getClass(), Tag.MAP); - representer.setPropertyUtils(new MyPropertyUtils()); - - Yaml yaml = new Yaml(representer, options); - return yaml.dump(obj); - } - - /** - * Is yaml file content valid boolean. - * - * @param yamlFullFileName the yaml full file name - * @return the boolean - */ - public boolean isYamlFileContentValid(String yamlFullFileName) { - Yaml yaml = new Yaml(); - try { - Object loadResult = yaml.load(yamlFullFileName); - return loadResult != null; - } catch (Exception exception) { - return false; - } - } - - - private class CustomRepresenter extends Representer { - @Override - protected MappingNode representJavaBean(Set properties, Object javaBean) { - //remove the bean type from the output yaml (!! ...) - if (!classTags.containsKey(javaBean.getClass())) { - addClassTag(javaBean.getClass(), Tag.MAP); - } - - return super.representJavaBean(properties, javaBean); - } - - @Override - protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, - Object propertyValue, Tag customTag) { - if (propertyValue == null) { - return null; - } else { - NodeTuple defaultNode = - super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); - - return DEFAULT_STR.equals(property.getName()) - ? new NodeTuple(representData(DEFAULT), defaultNode.getValueNode()) - : defaultNode; - } - } - } - - - /** - * The type My property utils. - */ - public class MyPropertyUtils extends PropertyUtils { - //Unsorted properties - @Override - protected Set createPropertySet(Class type, BeanAccess bnAccess) - throws IntrospectionException { - return new LinkedHashSet<>(getPropertiesMap(type, - BeanAccess.FIELD).values()); + return new Yaml().load(yamlFileInputStream); } - @Override - public Property getProperty(Class type, String name) throws IntrospectionException { - String updatedName = name; - if (DEFAULT.equals(updatedName)) { - updatedName = DEFAULT_STR; - } - return super.getProperty(type, updatedName); + /** + * Object to yaml string. + * + * @param obj the obj + * @return the string + */ + public String objectToYaml(Object obj) { + DumperOptions options = new DumperOptions(); + options.setPrettyFlow(true); + options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); + Representer representer = new CustomRepresenter(); + representer.addClassTag(obj.getClass(), Tag.MAP); + representer.setPropertyUtils(new MyPropertyUtils()); + + Yaml yaml = new Yaml(representer, options); + return yaml.dump(obj); } - } - - /** - * The type Strict map appender constructor. - */ - protected class StrictMapAppenderConstructor extends Constructor { - /** - * Instantiates a new Strict map appender constructor. + * Is yaml file content valid boolean. * - * @param theRoot the the root + * @param yamlFullFileName the yaml full file name + * @return the boolean */ - public StrictMapAppenderConstructor(Class theRoot) { - super(theRoot); + public boolean isYamlFileContentValid(String yamlFullFileName) { + try { + return new Yaml().load(yamlFullFileName) != null; + } catch (Exception exception) { + return false; + } } - @Override - protected Map createDefaultMap() { - final Map delegate = super.createDefaultMap(); - return new AbstractMap() { + + private class CustomRepresenter extends Representer { @Override - public Object put(Object key, Object value) { - if (delegate.containsKey(key)) { - throw new IllegalStateException("duplicate key: " + key); - } - return delegate.put(key, value); + protected MappingNode representJavaBean(Set properties, Object javaBean) { + //remove the bean type from the output yaml (!! ...) + if (!classTags.containsKey(javaBean.getClass())) { + addClassTag(javaBean.getClass(), Tag.MAP); + } + + return super.representJavaBean(properties, javaBean); } @Override - public Set> entrySet() { - return delegate.entrySet(); + protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, + Object propertyValue, Tag customTag) { + if (propertyValue == null) { + return null; + } else { + NodeTuple defaultNode = + super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); + + return DEFAULT_STR.equals(property.getName()) + ? new NodeTuple(representData(DEFAULT), defaultNode.getValueNode()) + : defaultNode; + } } - }; - } - - @Override - protected Map constructMapping(MappingNode node) { - try { - return super.constructMapping(node); - } catch (IllegalStateException exception) { - throw new ParserException("while parsing MappingNode", - node.getStartMark(), exception.getMessage(), - node.getEndMark()); - } } - } } diff --git a/onboarding/pom.xml b/onboarding/pom.xml index b5fb0e21b4..3bb2105af0 100644 --- a/onboarding/pom.xml +++ b/onboarding/pom.xml @@ -97,7 +97,6 @@ 0.9.10 2.5 1.7.21 - 1.17 4.3.18.RELEASE 2.0.8 4.4.1 diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-types/pom.xml index e41cc0b24f..0b8fa751bc 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-types/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-types/pom.xml @@ -11,7 +11,6 @@ org.openecomp.sdc.onboarding action-library-rest 1.8.1-SNAPSHOT - ../ diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/pom.xml index a37680796f..a8973c8798 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/pom.xml @@ -12,7 +12,6 @@ org.openecomp.sdc openecomp-sdc-rest-webapp 1.8.1-SNAPSHOT - ../ /action-library-rest-services diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/pom.xml index 9f3c3e7d12..3cc19ab554 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/notifications-fe/pom.xml @@ -10,8 +10,7 @@ org.openecomp.sdc - openecomp-sdc - ../../.. + openecomp-sdc-rest-webapp 1.8.1-SNAPSHOT diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml index 487378bf13..48ef4287b8 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml @@ -13,14 +13,14 @@ - /openecomp-sdc-common-rest - /vendor-license-rest - /onboarding-rest-war - /vendor-software-products-rest - /validation-rest - /action-library-rest - /application-config-rest - /healthcheck-rest + openecomp-sdc-common-rest + vendor-license-rest + onboarding-rest-war + vendor-software-products-rest + validation-rest + action-library-rest + application-config-rest + healthcheck-rest conflict-rest item-permissions-rest item-rest diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml index be8480f48e..5af20dab24 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-types/pom.xml @@ -11,7 +11,6 @@ org.openecomp.sdc.onboarding validation-rest 1.8.1-SNAPSHOT - ../ diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/pom.xml index f00b8daa79..a3e7435837 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/pom.xml @@ -11,7 +11,6 @@ org.openecomp.sdc openecomp-sdc-rest-webapp 1.8.1-SNAPSHOT - ../ diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml index 25e403119a..1700e9553a 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/pom.xml @@ -26,7 +26,6 @@ org.openecomp.sdc.onboarding vendor-license-rest 1.8.1-SNAPSHOT - ../ diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml index f9b76c7664..1df2e81616 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/pom.xml @@ -10,7 +10,6 @@ org.openecomp.sdc.onboarding vendor-license-rest 1.8.1-SNAPSHOT - ../ diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml index 721a83986b..fd030a920d 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/pom.xml @@ -27,7 +27,6 @@ org.openecomp.sdc.onboarding vendor-software-products-rest 1.8.1-SNAPSHOT - ../ diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java index 2053373dce..33a558ea75 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java @@ -24,10 +24,10 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validati import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.anEmptyMap; -import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -63,10 +63,8 @@ import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.va import java.io.IOException; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.commons.collections.CollectionUtils; @@ -963,27 +961,12 @@ public class SOL004MetaDirectoryValidatorTest { final List expectedErrorList = new ArrayList<>(); expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR - , Messages.INVALID_YAML_FORMAT_1.formatMessage(nonManoPmEventsSource, "while scanning a simple key\n" - + " in 'reader', line 2, column 1:\n" - + " key {}\n" - + " ^\n" - + "could not find expected ':'\n" - + " in 'reader', line 2, column 7:\n" - + " {}\n" - + " ^\n")) + , Messages.INVALID_YAML_FORMAT_1.formatMessage(nonManoPmEventsSource, "while scanning a simple key in 'reader', line 2, column 1: key {} ^could not find expected ':' in 'reader', line 2, column 7: key {} ^")) ); - expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR, "while scanning a simple key\n" + - " in 'reader', line 2, column 1:\n" + - " key {}\n" + - " ^\n" + - "could not find expected ':'\n" + - " in 'reader', line 2, column 7:\n" + - " {}\n" + - " ^\n") + expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR, "while scanning a simple key in 'reader', line 2, column 1: key {} ^could not find expected ':' in 'reader', line 2, column 7: key {} ^") ); - final Map> actualErrorMap = sol004MetaDirectoryValidator - .validateContent(handler); + final Map> actualErrorMap = sol004MetaDirectoryValidator.validateContent(handler); assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList); } @@ -1253,22 +1236,6 @@ public class SOL004MetaDirectoryValidatorTest { assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList); } - protected void assertExpectedErrors(List actualErrorList, final List expectedErrorList) { - if (actualErrorList == null) { - actualErrorList = new ArrayList<>(); - } - - printErrorMessages(actualErrorList); - - assertThat("The actual error list should have the same size as the expected error list " + actualErrorList.toString() - , actualErrorList, hasSize(expectedErrorList.size()) - ); - - assertThat("The actual error and expected error lists should be the same" - , actualErrorList, containsInAnyOrder(expectedErrorList.toArray(new ErrorMessage[0])) - ); - } - protected void assertExpectedErrors(final String testCase, final Map> errors, final int expectedErrors){ final List errorMessages = errors.get(SdcCommon.UPLOAD_FILE); printErrorMessages(errorMessages); @@ -1287,4 +1254,25 @@ public class SOL004MetaDirectoryValidatorTest { } } + private void assertExpectedErrors(List actualErrorList, final List expectedErrorList) { + if (actualErrorList == null) { + actualErrorList = new ArrayList<>(); + } + + printErrorMessages(actualErrorList); + + assertThat("The actual error list should have the same size as the expected error list" + , actualErrorList, hasSize(expectedErrorList.size()) + ); + + actualErrorList.forEach(error -> { + Predicate matching = e -> e.getLevel() == error.getLevel() && sanitize(e.getMessage()).equalsIgnoreCase(sanitize(error.getMessage())); + assertTrue("The actual error and expected error lists should be the same", expectedErrorList.stream().anyMatch(matching)); + }); + } + + private static String sanitize(String s) { + return s.trim().replaceAll("\n", "").replaceAll("\r", "").replaceAll("\\s{2,}", " ").trim(); + } + } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml index ae6ea775ed..9fa74e637d 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-api/pom.xml @@ -4,17 +4,14 @@ openecomp-facade-api openecomp-facade-api - org.openecomp.sdc.core - org.openecomp.sdc - openecomp-sdc-lib + org.openecomp.sdc.core + openecomp-facade-lib 1.8.1-SNAPSHOT - ../../../ - org.openecomp.sdc.core openecomp-utilities-lib diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml index b45af106cc..25b682a16b 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/pom.xml @@ -4,13 +4,11 @@ openecomp-facade-core openecomp-facade-core - org.openecomp.sdc.core - openecomp-sdc-lib - org.openecomp.sdc + openecomp-facade-lib + org.openecomp.sdc.core 1.8.1-SNAPSHOT - ../../.. diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml index f892ddb15c..3d3e35aca1 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/pom.xml @@ -4,8 +4,8 @@ openecomp-facade-lib openecomp-facade-lib - pom + openecomp-core-lib org.openecomp.sdc.core @@ -17,18 +17,4 @@ openecomp-facade-core - - - org.openecomp.sdc.core - openecomp-facade-api - ${project.version} - compile - - - org.openecomp.sdc.core - openecomp-facade-core - ${project.version} - runtime - - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml index 3a48db6c92..bd3f421798 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/pom.xml @@ -16,5 +16,4 @@ openecomp-nosqldb-api openecomp-nosqldb-core - \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-core-lib/pom.xml b/openecomp-be/lib/openecomp-core-lib/pom.xml index 6329060226..48a4ef1ba3 100644 --- a/openecomp-be/lib/openecomp-core-lib/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/pom.xml @@ -14,11 +14,11 @@ - /openecomp-facade-lib - /openecomp-nosqldb-lib - /openecomp-utilities-lib - /openecomp-config-lib - /openecomp-zusammen-lib - /openecomp-session-lib + openecomp-facade-lib + openecomp-nosqldb-lib + openecomp-utilities-lib + openecomp-config-lib + openecomp-zusammen-lib + openecomp-session-lib diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml index a96fe631df..0dc9aa1202 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-api/pom.xml @@ -24,9 +24,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-enrichment-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml index 639f8f5bb1..a0d7937049 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/pom.xml @@ -24,9 +24,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-enrichment-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml index 351e163336..c35bbc1f0f 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/pom.xml @@ -24,9 +24,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-enrichment-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java index a34f6913c3..cf9ec3c49d 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java @@ -174,8 +174,8 @@ public class BaseToscaEnrichmentTest { name = entry.getName() .substring(entry.getName().lastIndexOf(File.separator) + 1, entry.getName().length()); if (expectedResultFileNameSet.contains(name)) { - expected = new String(expectedResultMap.get(name)).trim().replace("\r", ""); - actual = new String(FileUtils.toByteArray(zis)).trim().replace("\r", ""); + expected = sanitize(new String(expectedResultMap.get(name))); + actual = sanitize(new String(FileUtils.toByteArray(zis))); assertEquals("difference in file: " + name, expected, actual); expectedResultFileNameSet.remove(name); @@ -187,4 +187,8 @@ public class BaseToscaEnrichmentTest { } assertEquals(0, expectedResultFileNameSet.size()); } + + private static String sanitize(String s) { + return s.trim().replaceAll("\n", "").replaceAll("\r", "").replaceAll("\\s{2,}", " ").trim(); + } } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml index b1158dced1..a8ca19937b 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/pom.xml @@ -18,27 +18,4 @@ openecomp-sdc-enrichment-core openecomp-sdc-enrichment-impl - - - - org.openecomp.sdc - openecomp-sdc-enrichment-api - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-enrichment-core - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-vendor-software-product-core - ${project.version} - - - diff --git a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/pom.xml b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/pom.xml index 30dc51c4a7..8215b1c672 100644 --- a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-api/pom.xml @@ -9,9 +9,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-externaltesting-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-impl/pom.xml index a4b0b3790e..c5df0fc9c5 100644 --- a/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-impl/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-externaltesting-lib/openecomp-sdc-externaltesting-impl/pom.xml @@ -25,9 +25,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-externaltesting-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml index 2facd82726..9860f0b01d 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml @@ -6,12 +6,10 @@ openecomp-sdc-model-api openecomp-sdc-model-api - - + org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-model-lib 1.8.1-SNAPSHOT - ../.. @@ -20,11 +18,6 @@ openecomp-facade-core ${project.version} - - org.openecomp.sdc - openecomp-sdc-validation-api - ${project.version} - org.openecomp.sdc openecomp-sdc-versioning-core diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml index 2b9394dee4..b4e50cbf4f 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml @@ -25,9 +25,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-model-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml b/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml index 05a0ea2622..b25336f26d 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml @@ -17,17 +17,4 @@ openecomp-sdc-model-api openecomp-sdc-model-impl - - - - org.openecomp.sdc - openecomp-sdc-model-api - ${project.version} - - - org.openecomp.sdc - openecomp-sdc-model-impl - ${project.version} - - diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/pom.xml b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/pom.xml index b49317c015..dd48be3f4f 100644 --- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/pom.xml @@ -22,9 +22,8 @@ openecomp-sdc-notification-api org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-notification-lib 1.8.1-SNAPSHOT - ../../pom.xml diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/pom.xml b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/pom.xml index c9eede942a..05654aaaa1 100644 --- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/pom.xml @@ -25,9 +25,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-notification-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-websocket/pom.xml b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-websocket/pom.xml index b0c4a49101..ab0f6b0cf7 100644 --- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-websocket/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-websocket/pom.xml @@ -8,9 +8,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-notification-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/pom.xml b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/pom.xml index f569d9eef3..a4f7566d47 100644 --- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-worker/pom.xml @@ -8,9 +8,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-notification-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/pom.xml b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/pom.xml index dde93524ce..2468b2b8d6 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-api/pom.xml @@ -9,9 +9,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-tosca-generator-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/pom.xml b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/pom.xml index 8840c4659e..ff17a1a184 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/pom.xml @@ -25,9 +25,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-tosca-generator-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml index 8229262e81..b8d348b818 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-api/pom.xml @@ -25,9 +25,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-translator-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml index f523b7eeb1..94abe98c63 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/pom.xml @@ -25,9 +25,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-translator-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java index 703fa0d924..f65b0bb113 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java @@ -695,10 +695,10 @@ public class TestUtils { while ((entry = zis.getNextEntry()) != null) { name = entry.getName() - .substring(entry.getName().lastIndexOf(File.separator) + 1, entry.getName().length()); + .substring(entry.getName().lastIndexOf(File.separator) + 1); if (expectedResultFileNameSet.contains(name)) { - expected = new String(expectedResultMap.get(name)).trim().replace("\r", ""); - actual = new String(FileUtils.toByteArray(zis)).trim().replace("\r", ""); + expected = sanitize(new String(expectedResultMap.get(name))); + actual = sanitize(new String(FileUtils.toByteArray(zis))); assertEquals("difference in file: " + name, expected, actual); expectedResultFileNameSet.remove(name); @@ -709,6 +709,10 @@ public class TestUtils { } } + private static String sanitize(String s) { + return s.trim().replaceAll("\n", "").replaceAll("\r", "").replaceAll("\\s{2,}", " ").trim(); + } + public static String getErrorAsString(Map> errorMessages) { StringBuilder sb = new StringBuilder(); errorMessages.forEach((file, errorList) -> sb.append("File:").append(file).append(System.lineSeparator()) diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_exCP_naming_diff/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_exCP_naming_diff/MainServiceTemplate.yaml index d73bbef97b..2ebfeaff01 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_exCP_naming_diff/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_exCP_naming_diff/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_fixed_ips_diff/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_fixed_ips_diff/MainServiceTemplate.yaml index 8a3eb21523..ea29e3d150 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_fixed_ips_diff/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_fixed_ips_diff/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_flavor_name_diff/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_flavor_name_diff/MainServiceTemplate.yaml index d006cc9771..16aa48645f 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_flavor_name_diff/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_flavor_name_diff/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_image_missing/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_image_missing/MainServiceTemplate.yaml index 9e3d82dd27..314f49de98 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_image_missing/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_image_missing/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_image_name_diff/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_image_name_diff/MainServiceTemplate.yaml index 0e58aeb0c1..b2273d1244 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_image_name_diff/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_image_name_diff/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_port_without_allowed_address_pairs/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_port_without_allowed_address_pairs/MainServiceTemplate.yaml index dd5a477d16..bdb212a8d9 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_port_without_allowed_address_pairs/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_port_without_allowed_address_pairs/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_port_without_fixed_ips/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_port_without_fixed_ips/MainServiceTemplate.yaml index a4e58144de..f28ddc5c4b 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_port_without_fixed_ips/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_port_without_fixed_ips/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_port_without_mac_address/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_port_without_mac_address/MainServiceTemplate.yaml index 1ddd292cf3..6caa016e1f 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_port_without_mac_address/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/one_port_without_mac_address/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/ports_with_none_of_the_properties/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/ports_with_none_of_the_properties/MainServiceTemplate.yaml index 2a5fcb139c..c46e8e1f12 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/ports_with_none_of_the_properties/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/ports_with_none_of_the_properties/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/three_compute_valid/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/three_compute_valid/MainServiceTemplate.yaml index 8095b88d19..54be7c315c 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/three_compute_valid/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/three_compute_valid/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/three_compute_with_same_relations/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/three_compute_with_same_relations/MainServiceTemplate.yaml index 3561f35391..1213eb8467 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/three_compute_with_same_relations/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/three_compute_with_same_relations/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/three_ports_similar_relations/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/three_ports_similar_relations/MainServiceTemplate.yaml index cf09f4b3ef..4ec4072cd7 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/three_ports_similar_relations/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/computeportconsolidation/three_ports_similar_relations/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_port_types/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_port_types/MainServiceTemplate.yaml index ea845e8260..39490da79f 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_port_types/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_port_types/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types/MainServiceTemplate.yaml index d575e26ff9..2efbf7467e 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/different_subinterface_types/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/more_than_one_port/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/more_than_one_port/MainServiceTemplate.yaml index 1086507058..afe89ba695 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/more_than_one_port/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/more_than_one_port/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/one_compute_node/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/one_compute_node/MainServiceTemplate.yaml index 22a9564cc1..39e53605cc 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/one_compute_node/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/one_compute_node/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/one_instance_for_two_types/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/one_instance_for_two_types/MainServiceTemplate.yaml index d9fb652110..8e317f88d3 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/one_instance_for_two_types/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/one_instance_for_two_types/MainServiceTemplate.yaml @@ -80,7 +80,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/three_compute_two_similar_one_diff/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/three_compute_two_similar_one_diff/MainServiceTemplate.yaml index 43335d6812..409d682444 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/three_compute_two_similar_one_diff/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/three_compute_two_similar_one_diff/MainServiceTemplate.yaml @@ -80,7 +80,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/three_compute_valid/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/three_compute_valid/MainServiceTemplate.yaml index d85021332a..e1e59f5129 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/three_compute_valid/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/three_compute_valid/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/valid_pre_condition/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/valid_pre_condition/MainServiceTemplate.yaml index b2c73f9c92..240a6845d2 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/valid_pre_condition/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/consolidation/translatedfiles/pre_condition/valid_pre_condition/MainServiceTemplate.yaml @@ -78,7 +78,6 @@ topology_template: - 107.250.172.217 entry_schema: type: string - default: 169.254.1.4 ps_server_names: label: PS server names hidden: false diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-api/pom.xml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-api/pom.xml index 79665dfe0b..ab5c35aba7 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-api/pom.xml @@ -9,9 +9,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-validation-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/pom.xml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/pom.xml index 0d69912efd..b25581fa7c 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/pom.xml @@ -25,9 +25,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-validation-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/java/org/openecomp/sdc/validation/impl/ValidationManagerImpl.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/java/org/openecomp/sdc/validation/impl/ValidationManagerImpl.java index 2f5a8ce399..a25b8ae88f 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/java/org/openecomp/sdc/validation/impl/ValidationManagerImpl.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/java/org/openecomp/sdc/validation/impl/ValidationManagerImpl.java @@ -25,8 +25,6 @@ import org.openecomp.core.validation.api.ValidationManager; import org.openecomp.core.validation.types.GlobalValidationContext; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.datatypes.error.ErrorMessage; -import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.validation.Validator; import org.openecomp.sdc.validation.services.ValidationFactory; @@ -37,8 +35,6 @@ import java.util.Objects; public class ValidationManagerImpl implements ValidationManager { - private static Logger logger = (Logger) LoggerFactory.getLogger(ValidationManagerImpl.class); - private GlobalValidationContext globalContext; private List validators; diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml index 8dfea9e422..abf4fb3e67 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml @@ -26,9 +26,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-validation-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java index b11ff5e341..c433c3e7d4 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java @@ -17,7 +17,8 @@ package org.openecomp.sdc.validation.impl.validators; -import org.onap.sdc.tosca.services.YamlUtil; +import org.onap.sdc.tosca.services.MyPropertyUtils; +import org.onap.sdc.tosca.services.StrictMapAppenderConstructor; import org.openecomp.core.validation.ErrorMessageCode; import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder; import org.openecomp.core.validation.types.GlobalValidationContext; @@ -25,6 +26,12 @@ import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.validation.Validator; import org.openecomp.sdc.validation.impl.util.YamlValidatorUtil; +import org.yaml.snakeyaml.DumperOptions; +import org.yaml.snakeyaml.LoaderOptions; +import org.yaml.snakeyaml.TypeDescription; +import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.constructor.Constructor; +import org.yaml.snakeyaml.representer.Representer; import java.io.InputStream; import java.util.Collection; @@ -33,42 +40,50 @@ import java.util.Optional; import java.util.Set; public class YamlValidator implements Validator { - private static final ErrorMessageCode ERROR_CODE_YML_1 = new ErrorMessageCode("YML1"); - private static final ErrorMessageCode ERROR_CODE_YML_2 = new ErrorMessageCode("YML2"); + private static final ErrorMessageCode ERROR_CODE_YML_1 = new ErrorMessageCode("YML1"); + private static final ErrorMessageCode ERROR_CODE_YML_2 = new ErrorMessageCode("YML2"); - @Override - public void validate(GlobalValidationContext globalContext) { - Set pmDictionaryFiles = GlobalContextUtil.findPmDictionaryFiles(globalContext); + @Override + public void validate(GlobalValidationContext globalContext) { + Set pmDictionaryFiles = GlobalContextUtil.findPmDictionaryFiles(globalContext); - Collection files = globalContext.files( - (fileName, globalValidationContext) -> FileExtensionUtils.isYaml(fileName) - && !pmDictionaryFiles.contains(fileName)); + Collection files = globalContext.files( + (fileName, globalValidationContext) -> FileExtensionUtils.isYaml(fileName) + && !pmDictionaryFiles.contains(fileName)); - files.forEach(fileName -> validate(fileName, globalContext)); - } - - private void validate(String fileName, GlobalValidationContext globalContext) { - Optional rowContent = globalContext.getFileContent(fileName); - if (rowContent.isEmpty()) { - globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder - .getErrorWithParameters(ERROR_CODE_YML_1, Messages - .INVALID_YAML_FORMAT_REASON.getErrorMessage(), - Messages.EMPTY_YAML_FILE.getErrorMessage())); - return; /* no need to continue validation */ + files.forEach(fileName -> validate(fileName, globalContext)); } - try { - convert(rowContent.get(), Map.class); - } catch (Exception exception) { + private void validate(String fileName, GlobalValidationContext globalContext) { + Optional rowContent = globalContext.getFileContent(fileName); + if (rowContent.isEmpty()) { + globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder + .getErrorWithParameters(ERROR_CODE_YML_1, Messages + .INVALID_YAML_FORMAT_REASON.getErrorMessage(), + Messages.EMPTY_YAML_FILE.getErrorMessage())); + return; /* no need to continue validation */ + } + + try (var yamlContent = rowContent.get()) { + Constructor constructor = new StrictMapAppenderConstructor(Map.class); + constructor.setAllowDuplicateKeys(false); + constructor.setPropertyUtils(new MyPropertyUtils()); + TypeDescription yamlFileDescription = new TypeDescription(Map.class); + constructor.addTypeDescription(yamlFileDescription); + LoaderOptions options = new LoaderOptions(); + options.setAllowDuplicateKeys(false); + //No Yaml Constructor takes only Constructor and LoaderOptions, that is why I had to pass anonymous Representer and DumperOptions objects + Object yamlObj = new Yaml(constructor, new Representer(), new DumperOptions(), options).load(yamlContent); - globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder - .getErrorWithParameters(ERROR_CODE_YML_2, Messages - .INVALID_YAML_FORMAT_REASON.getErrorMessage(), - YamlValidatorUtil.getParserExceptionReason(exception))); + if (yamlObj == null) { + throw new Exception(); + } + } catch (Exception exception) { + globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder + .getErrorWithParameters(ERROR_CODE_YML_2, Messages + .INVALID_YAML_FORMAT_REASON.getErrorMessage(), + YamlValidatorUtil.getParserExceptionReason(exception))); + } } - } - private T convert(InputStream content, Class type) { - return new YamlUtil().yamlToObject(content, type); - } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidator.java index b3d346177b..760c73a52b 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidator.java @@ -30,146 +30,114 @@ import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.type.NamingConventionValidationContext; import org.openecomp.sdc.validation.util.ValidationUtil; +import java.util.Arrays; import java.util.List; import java.util.Map; import static java.util.Objects.nonNull; public class NeutronPortNamingConventionValidator implements ResourceValidator { - private static final ErrorMessageCode ERROR_CODE_NNP1 = new ErrorMessageCode("NNP1"); - private static final ErrorMessageCode ERROR_CODE_NNP2 = new ErrorMessageCode("NNP2"); - private static final ErrorMessageCode ERROR_CODE_NNP3 = new ErrorMessageCode("NNP3"); - - @Override - public void validate(String fileName, Map.Entry resourceEntry, - GlobalValidationContext globalContext, ValidationContext validationContext) { - - NamingConventionValidationContext namingConventionValidationContext = - (NamingConventionValidationContext)validationContext; - validatePortNetworkNamingConvention(fileName, namingConventionValidationContext.getHeatOrchestrationTemplate(), - globalContext); - validateFixedIpsNamingConvention(fileName, namingConventionValidationContext.getHeatOrchestrationTemplate(), - globalContext); - } - - private void validatePortNetworkNamingConvention(String fileName, - HeatOrchestrationTemplate heatOrchestrationTemplate, - GlobalValidationContext globalContext) { - if (MapUtils.isEmpty(heatOrchestrationTemplate.getResources())) { - return; + private static final ErrorMessageCode ERROR_CODE_NNP1 = new ErrorMessageCode("NNP1"); + private static final ErrorMessageCode ERROR_CODE_NNP2 = new ErrorMessageCode("NNP2"); + private static final ErrorMessageCode ERROR_CODE_NNP3 = new ErrorMessageCode("NNP3"); + + @Override + public void validate(String fileName, Map.Entry resourceEntry, + GlobalValidationContext globalContext, ValidationContext validationContext) { + NamingConventionValidationContext namingConventionValidationContext = (NamingConventionValidationContext) validationContext; + validatePortNetworkNamingConvention(fileName, namingConventionValidationContext.getHeatOrchestrationTemplate(), globalContext); + validateFixedIpsNamingConvention(fileName, namingConventionValidationContext.getHeatOrchestrationTemplate(), globalContext); } - String[] regexList = {".*_net_id", ".*_net_name", ".*_net_fqdn"}; - - heatOrchestrationTemplate - .getResources() - .entrySet() - .stream() - .filter(entry -> entry.getValue().getType() - .equals(HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource())) - .forEach(entry -> entry.getValue() - .getProperties() - .entrySet() - .stream() - .filter(propertyEntry -> - ("network").equalsIgnoreCase(propertyEntry.getKey()) - || ("network_id").equals(propertyEntry.getKey())) - .forEach(propertyEntry -> validateParamNamingConvention(fileName, entry.getKey(), - propertyEntry.getValue(), regexList, - Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES, globalContext))); - } - private void validateFixedIpsNamingConvention(String fileName, - HeatOrchestrationTemplate heatOrchestrationTemplate, - GlobalValidationContext globalContext) { - if (MapUtils.isEmpty(heatOrchestrationTemplate.getResources())) { - return; + private void validatePortNetworkNamingConvention(String fileName, + HeatOrchestrationTemplate heatOrchestrationTemplate, + GlobalValidationContext globalContext) { + if (MapUtils.isEmpty(heatOrchestrationTemplate.getResources())) { + return; + } + String[] regexList = {".*_net_id", ".*_net_name", ".*_net_fqdn"}; + + heatOrchestrationTemplate + .getResources() + .entrySet() + .stream() + .filter(entry -> entry.getValue().getType().equals(HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource())) + .forEach(entry -> entry.getValue() + .getProperties() + .entrySet() + .stream() + .filter(propertyEntry -> ("network").equalsIgnoreCase(propertyEntry.getKey()) || ("network_id").equals(propertyEntry.getKey())) + .forEach(propertyEntry -> validateParamNamingConvention(fileName, entry.getKey(), + propertyEntry.getValue(), regexList, + Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES, globalContext))); } - heatOrchestrationTemplate.getResources() - .entrySet() - .stream() - .filter(entry -> HeatResourcesTypes.findByHeatResource(entry.getValue().getType()) != null) - .filter(entry -> HeatResourcesTypes.findByHeatResource(entry.getValue().getType()) - .equals(HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE)) - .forEach(entry -> checkNeutronPortFixedIpsName(fileName, entry, globalContext)); - } - - private void checkNeutronPortFixedIpsName(String fileName, - Map.Entry resourceEntry, - GlobalValidationContext globalContext) { - String[] regexList = {"[^_]+_[^_]+_ips", "[^_]+_[^_]+_v6_ips", "[^_]+_[^_]+_ip_(\\d+)", - "[^_]+_[^_]+_v6_ip_(\\d+)", "[^_]+_[^_]+_[^_]+_ips", "[^_]+_[^_]+_[^_]+_v6_ips", - "[^_]+_[^_]+_[^_]+_ip_(\\d+)", "[^_]+_[^_]+_[^_]+_v6_ip_(\\d+)"}; + private void validateFixedIpsNamingConvention(String fileName, + HeatOrchestrationTemplate heatOrchestrationTemplate, + GlobalValidationContext globalContext) { + if (MapUtils.isEmpty(heatOrchestrationTemplate.getResources())) { + return; + } - if (MapUtils.isEmpty(resourceEntry.getValue().getProperties())) { - return; + heatOrchestrationTemplate.getResources() + .entrySet() + .stream() + .filter(entry -> HeatResourcesTypes.findByHeatResource(entry.getValue().getType()) != null) + .filter(entry -> HeatResourcesTypes.findByHeatResource(entry.getValue().getType()) + .equals(HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE)) + .forEach(entry -> checkNeutronPortFixedIpsName(fileName, entry, globalContext)); } - Map propertiesMap = resourceEntry.getValue().getProperties(); - Object fixedIps = propertiesMap.get("fixed_ips"); - if (nonNull(fixedIps) && fixedIps instanceof List) { - List fixedIpsList = (List) fixedIps; - for (Object fixedIpsObject : fixedIpsList) { - Map.Entry fixedIpsEntry = - ((Map) fixedIpsObject).entrySet().iterator().next(); - - validateFixedIpsName(fileName, resourceEntry, globalContext, regexList, fixedIpsEntry); + private void checkNeutronPortFixedIpsName(String fileName, + Map.Entry resourceEntry, + GlobalValidationContext globalContext) { + String[] regexList = {"[^_]+_[^_]+_ips", "[^_]+_[^_]+_v6_ips", "[^_]+_[^_]+_ip_(\\d+)", + "[^_]+_[^_]+_v6_ip_(\\d+)", "[^_]+_[^_]+_[^_]+_ips", "[^_]+_[^_]+_[^_]+_v6_ips", + "[^_]+_[^_]+_[^_]+_ip_(\\d+)", "[^_]+_[^_]+_[^_]+_v6_ip_(\\d+)"}; + if (MapUtils.isEmpty(resourceEntry.getValue().getProperties())) { + return; + } - } + Map propertiesMap = resourceEntry.getValue().getProperties(); + Object fixedIps = propertiesMap.get("fixed_ips"); + if (nonNull(fixedIps) && fixedIps instanceof List) { + List fixedIpsList = (List) fixedIps; + for (Object fixedIpsObject : fixedIpsList) { + Map.Entry fixedIpsEntry = ((Map) fixedIpsObject).entrySet().iterator().next(); + validateFixedIpsName(fileName, resourceEntry, globalContext, regexList, fixedIpsEntry); + } + } } - } - - private void validateFixedIpsName(String fileName, Map.Entry resourceEntry, - GlobalValidationContext globalContext, - String[] regexList, Map.Entry fixedIpsEntry) { - if (nonNull(fixedIpsEntry)) { - if (fixedIpsEntry.getValue() instanceof Map) { - - String fixedIpsName = ValidationUtil - .getWantedNameFromPropertyValueGetParam(fixedIpsEntry.getValue()); - if (nonNull(fixedIpsName) && !ValidationUtil.evalPattern(fixedIpsName, regexList)) { - globalContext.addMessage(fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder.getErrorWithParameters(ERROR_CODE_NNP1, Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES.getErrorMessage(), - "Port", "Fixed_IPS", fixedIpsName, resourceEntry.getKey())); - } - - - } else { - globalContext.addMessage( - fileName, - ErrorLevel.WARNING, ErrorMessagesFormatBuilder - .getErrorWithParameters( - ERROR_CODE_NNP2, Messages.MISSING_GET_PARAM.getErrorMessage(), - "fixed_ips", resourceEntry.getKey())); - } + private void validateFixedIpsName(String fileName, Map.Entry resourceEntry, GlobalValidationContext globalContext, + String[] regexList, Map.Entry fixedIpsEntry) { + if (nonNull(fixedIpsEntry)) { + if (fixedIpsEntry.getValue() instanceof Map) { + String fixedIpsName = ValidationUtil.getWantedNameFromPropertyValueGetParam(fixedIpsEntry.getValue()); + if (nonNull(fixedIpsName) && !ValidationUtil.evalPattern(fixedIpsName, regexList)) { + globalContext.addMessage(fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder + .getErrorWithParameters(ERROR_CODE_NNP1, Messages.PARAMETER_NAME_NOT_ALIGNED_WITH_GUIDELINES.getErrorMessage(), + "Port", "Fixed_IPS", fixedIpsName, resourceEntry.getKey())); + } + } else { + globalContext.addMessage(fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder. + getErrorWithParameters(ERROR_CODE_NNP2, Messages.MISSING_GET_PARAM.getErrorMessage(), "fixed_ips", resourceEntry.getKey())); + } + } } - } - private void validateParamNamingConvention(String fileName, String resourceId, - Object propertyValue, - String[] regexList, - Messages message, - GlobalValidationContext globalContext) { - Object paramName; - if (propertyValue instanceof Map) { - paramName = ((Map) propertyValue).get("get_param"); - if (paramName instanceof String && !ValidationUtil.evalPattern(paramName, regexList)) { - globalContext.addMessage( - fileName, - ErrorLevel.WARNING, ErrorMessagesFormatBuilder - .getErrorWithParameters(ERROR_CODE_NNP3, message.getErrorMessage(), "Port", - "Network", (String) paramName, resourceId)); + private void validateParamNamingConvention(String fileName, String resourceId, Object propertyValue, String[] regexList, + Messages message, GlobalValidationContext globalContext) { + if (propertyValue instanceof Map) { + Object paramName = ((Map) propertyValue).get("get_param"); + if (paramName instanceof String && !ValidationUtil.evalPattern(paramName, regexList)) { + globalContext.addMessage(fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder + .getErrorWithParameters(ERROR_CODE_NNP3, message.getErrorMessage(), "Port", "Network", (String) paramName, resourceId)); + } + } else { + globalContext.addMessage(fileName, ErrorLevel.WARNING, ErrorMessagesFormatBuilder + .getErrorWithParameters(ERROR_CODE_NNP2, Messages.MISSING_GET_PARAM.getErrorMessage(), "network or network_id", resourceId)); } - - } else { - globalContext.addMessage( - fileName, - ErrorLevel.WARNING, - ErrorMessagesFormatBuilder - .getErrorWithParameters( - ERROR_CODE_NNP2, Messages.MISSING_GET_PARAM.getErrorMessage(), - "network or network_id", resourceId)); } - } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ContrailValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ContrailValidatorTest.java index c0a84b5f9d..da861dc3e1 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ContrailValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ContrailValidatorTest.java @@ -40,7 +40,7 @@ public class ContrailValidatorTest { @Test public void testWarningMessageExistWhenConrailV1AndV2ResourcesCollidesInSameHeatFile() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/collidesinsameheatfile/"); validateMessage(messages, "WARNING: [CTL2]: HEAT Package includes both Contrail 2 and Contrail 3 " + @@ -52,7 +52,7 @@ public class ContrailValidatorTest { @Test public void testParseException(){ - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/parseException/"); validateMessage(messages, "ERROR: [CTL4]: Invalid HEAT format problem - [while scanning for the next " + @@ -68,7 +68,7 @@ public class ContrailValidatorTest { @Test public void testWarningMessageExistWhenConrailV1AndV2ResourcesCollidesInDifferentHeatFiles() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/collidesindifferentheatfiles/"); validateMessage(messages, "WARNING: [CTL2]: HEAT Package includes both Contrail 2 and Contrail 3 " + @@ -80,7 +80,7 @@ public class ContrailValidatorTest { @Test public void testWarningMessageNotExistWhenConrailV1AndV2ResourcesCollidesInNonHeatFile() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/collidesinnontheatfiles/"); validateMessage(messages, "WARNING: [CTL2]: HEAT Package includes both Contrail 2 and Contrail 3 " + @@ -93,7 +93,7 @@ public class ContrailValidatorTest { @Test public void testWarningMessageNotExistWhenOnlyConrailV1Resources() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/notcollides/"); validateMessage(messages, "WARNING: [CTL3]: Contrail 2.x deprecated resource is in use, " + @@ -104,7 +104,7 @@ public class ContrailValidatorTest { @Test public void testWarningMessageOnResourceWithContrailType() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/validatenocontrailresource/"); validateMessage(messages, "WARNING: [CTL3]: Contrail 2.x deprecated resource is in use, " + @@ -114,7 +114,7 @@ public class ContrailValidatorTest { @Test public void testInvalidHeatStructure(){ - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/invalidHeatStructure/"); validateMessage(messages, "ERROR: [CTL1]: Invalid HEAT format problem - [The file 'first.yaml' " + @@ -124,7 +124,7 @@ public class ContrailValidatorTest { @Test public void testInvalidHeatStructuredueToParsingError(){ - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/invalidHeatStructure/"); validateMessage(messages, "ERROR: [CTL1]: Invalid HEAT format problem - [The file 'first.yaml' " + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidatorTest.java index a6e3d11cf3..64ddd61696 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidatorTest.java @@ -39,7 +39,7 @@ public class ForbiddenResourceGuideLineValidatorTest { @BeforeClass public static void init() throws IOException { - Map resourcesMap = ValidationTestUtil.getResourceMap(mockConfigFileName); + Map resourcesMap = new ValidationTestUtil().getResourceMap(mockConfigFileName); Map resourceBaseValidatorMap = (Map) resourcesMap.get("forbiddenResourceGuideLineValidator"); @@ -51,13 +51,13 @@ public class ForbiddenResourceGuideLineValidatorTest { @Test public void testFloatingIpResourceType() { - Map messages = ValidationTestUtil.testValidator( + Map messages = new ValidationTestUtil().testValidator( forbiddenResourceGuideLineValidator, RESOURCE_PATH + "/positive"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); - messages = ValidationTestUtil.testValidator(forbiddenResourceGuideLineValidator, + messages = new ValidationTestUtil().testValidator(forbiddenResourceGuideLineValidator, RESOURCE_PATH + "/negative"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); @@ -67,7 +67,7 @@ public class ForbiddenResourceGuideLineValidatorTest { } @Test public void testParseException(){ - Map messages = ValidationTestUtil.testValidator( + Map messages = new ValidationTestUtil().testValidator( forbiddenResourceGuideLineValidator, RESOURCE_PATH + "/parseException"); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1); @@ -82,7 +82,7 @@ public class ForbiddenResourceGuideLineValidatorTest { @Test public void testInvalidResourceType(){ - Map messages = ValidationTestUtil.testValidator( + Map messages = new ValidationTestUtil().testValidator( forbiddenResourceGuideLineValidator, RESOURCE_PATH + "/TestInvalidResourceType"); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), "WARNING: [FRG1]: A resource has an invalid or unsupported type - null, " + diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/GlobalContextUtilTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/GlobalContextUtilTest.java index 5856b3f322..df6fa0676f 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/GlobalContextUtilTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/GlobalContextUtilTest.java @@ -34,7 +34,7 @@ class GlobalContextUtilTest { @Test void shouldReturnOnlyFilesWithPmDictionaryType() { // given - GlobalValidationContext globalContext = ValidationTestUtil.createGlobalContextFromPath(TEST_MANIFEST_PATH); + GlobalValidationContext globalContext = new ValidationTestUtil().createGlobalContextFromPath(TEST_MANIFEST_PATH); // when Set pmDictionaryFiles = GlobalContextUtil.findPmDictionaryFiles(globalContext); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidatorTest.java index d687e5e512..4492eac8e5 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatResourceValidatorTest.java @@ -29,7 +29,7 @@ public class HeatResourceValidatorTest { @Test public void testParseException(){ - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, "/org/openecomp/validation/validators/guideLineValidator/baseHeatDoesNotExposeNetwork/parseException/"); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatValidatorTest.java index ffcedbbbc8..a528985909 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/HeatValidatorTest.java @@ -41,7 +41,7 @@ public class HeatValidatorTest { @Test public void testInvalidHeatFormat() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/invalid_heat_format/negative_test/input"); Assert.assertNotNull(messages); @@ -61,7 +61,7 @@ public class HeatValidatorTest { @Test public void testDependsOn() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/depends_on_points_to_existing_resource/input"); Assert.assertNotNull(messages); @@ -79,7 +79,7 @@ public class HeatValidatorTest { @Test public void testResourcesReferencesExistInHeat() throws IOException { - Map messages = ValidationTestUtil.testValidator(new HeatValidator(), + Map messages = new ValidationTestUtil().testValidator(new HeatValidator(), RESOURCE_PATH + "/resource_references_exist_in_heat/negative_test/input"); Assert.assertNotNull(messages); @@ -98,7 +98,7 @@ public class HeatValidatorTest { @Test public void testGetResourceValueIsValid() { - Map messages = ValidationTestUtil.testValidator(new HeatValidator(), + Map messages = new ValidationTestUtil().testValidator(new HeatValidator(), RESOURCE_PATH + "/get_resource_value_valid/negative_test/input"); Assert.assertNotNull(messages); @@ -121,7 +121,7 @@ public class HeatValidatorTest { @Test public void testTwoResourcesDoesNotHoldSameId() throws IOException { - Map messages = ValidationTestUtil.testValidator(new HeatValidator(), + Map messages = new ValidationTestUtil().testValidator(new HeatValidator(), RESOURCE_PATH + "/two_resources_does_not_hold_same_id/positive_test/input"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); @@ -129,7 +129,7 @@ public class HeatValidatorTest { @Test public void testWithWrongFileExtension(){ - Map messages = ValidationTestUtil.testValidator(new HeatValidator(), + Map messages = new ValidationTestUtil().testValidator(new HeatValidator(), RESOURCE_PATH + "/wrongFileExtension"); Assert.assertNotNull(messages); Assert.assertEquals(messages.get("single.aad").getErrorMessageList().get(0).getMessage(), @@ -140,7 +140,7 @@ public class HeatValidatorTest { @Test public void testWithMissingManifestContent(){ - Map messages = ValidationTestUtil.testValidator(new HeatValidator(), + Map messages = new ValidationTestUtil().testValidator(new HeatValidator(), RESOURCE_PATH + "/missingManifestContent"); Assert.assertNotNull(messages); Assert.assertEquals(messages.get("single.yaml").getErrorMessageList().get(0).getMessage(), @@ -152,7 +152,7 @@ public class HeatValidatorTest { @Test public void testWithInvalidHeatContent(){ - Map messages = ValidationTestUtil.testValidator(new HeatValidator(), + Map messages = new ValidationTestUtil().testValidator(new HeatValidator(), RESOURCE_PATH + "/invalidHeatContent"); Assert.assertNotNull(messages); Assert.assertEquals(messages.get("single.yaml").getErrorMessageList().get(0).getMessage(), @@ -167,7 +167,7 @@ public class HeatValidatorTest { @Test public void testGeneratedArtifactExistInHeat() throws IOException { - Map messages = ValidationTestUtil.testValidator(new HeatValidator(), + Map messages = new ValidationTestUtil().testValidator(new HeatValidator(), RESOURCE_PATH + "/generated_artifact_exist/negative_test/input"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 3); @@ -188,7 +188,7 @@ public class HeatValidatorTest { @Test public void negativeTestGetParamPointToExistingParameter() throws IOException { - Map messages = ValidationTestUtil.testValidator(new HeatValidator(), + Map messages = new ValidationTestUtil().testValidator(new HeatValidator(), RESOURCE_PATH + "/get_param_points_to_existing_parameter/negative_test/input"); Assert.assertNotNull(messages); @@ -203,7 +203,7 @@ public class HeatValidatorTest { @Test public void testGetAttrFromNested() throws IOException { - Map messages =ValidationTestUtil.testValidator(new HeatValidator(), + Map messages =new ValidationTestUtil().testValidator(new HeatValidator(), RESOURCE_PATH + "/get_attr_from_nested/negative_test/input"); Assert.assertNotNull(messages); @@ -218,7 +218,7 @@ public class HeatValidatorTest { @Test public void testDefaultValueAlignWithType() throws IOException { - Map messages =ValidationTestUtil.testValidator(new HeatValidator(), + Map messages =new ValidationTestUtil().testValidator(new HeatValidator(), RESOURCE_PATH + "/default_value_align_with_type/negative_test/input"); Assert.assertNotNull(messages); @@ -234,7 +234,7 @@ public class HeatValidatorTest { @Test public void testEnvParametersMatchDefinedHeatParameterTypes() throws IOException { - Map messages =ValidationTestUtil.testValidator(new HeatValidator(), + Map messages =new ValidationTestUtil().testValidator(new HeatValidator(), RESOURCE_PATH + "/env_parameters_match_defined_types/negative_test/input"); Assert.assertNotNull(messages); @@ -249,7 +249,7 @@ public class HeatValidatorTest { @Test public void testReferencedArtifactsExist() throws IOException { - Map messages =ValidationTestUtil.testValidator(new HeatValidator(), + Map messages =new ValidationTestUtil().testValidator(new HeatValidator(), RESOURCE_PATH + "/referenced_artifacts_exist/negative_test/input"); Assert.assertNotNull(messages); @@ -264,7 +264,7 @@ public class HeatValidatorTest { @Test public void testEnvContentIsSubSetOfHeatParameters() throws IOException { - Map messages =ValidationTestUtil.testValidator(validator, + Map messages =new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/env_content_is_subset_of_heat/negative_test/input"); Assert.assertNotNull(messages); @@ -279,7 +279,7 @@ public class HeatValidatorTest { @Test public void testGetParamPseudoParameters() { - Map messages =ValidationTestUtil.testValidator(new HeatValidator(), + Map messages =new ValidationTestUtil().testValidator(new HeatValidator(), RESOURCE_PATH + "/pseudo_parameters/input"); Assert.assertNotNull(messages); @@ -288,7 +288,7 @@ public class HeatValidatorTest { } @Test public void testNoErrorWhenEmptyValueForParameterInEnv() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/env_empty_value/input"); Assert.assertNotNull(messages); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ManifestValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ManifestValidatorTest.java index 9e860ef2b3..778213dea8 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ManifestValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/ManifestValidatorTest.java @@ -39,7 +39,7 @@ public class ManifestValidatorTest { @Test public void testValidManifest() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/validFiles"); Assert.assertNotNull(messages); Assert.assertNotNull(messages); @@ -48,25 +48,25 @@ public class ManifestValidatorTest { @Test public void testManifestMissingFileInZip() { - Map messages = ValidationTestUtil.testValidator(new ManifestValidator(), + Map messages = new ValidationTestUtil().testValidator(new ManifestValidator(), RESOURCE_PATH + "/missingFileInZip"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertTrue(messages.containsKey("singleVol.yaml")); - ValidationTestUtil.validateErrorMessage(messages.get("singleVol.yaml").getErrorMessageList() + new ValidationTestUtil().validateErrorMessage(messages.get("singleVol.yaml").getErrorMessageList() .get(0).getMessage(), "ERROR: " + "[MNF4]: " + Messages.MISSING_FILE_IN_ZIP.getErrorMessage()); } @Test public void testInvalidManifest() { - Map messages = ValidationTestUtil.testValidator(new ManifestValidator(), + Map messages = new ValidationTestUtil().testValidator(new ManifestValidator(), RESOURCE_PATH + "/invalidManifest"); Assert.assertNotNull(messages); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertTrue(messages.containsKey(SdcCommon.MANIFEST_NAME)); - ValidationTestUtil.validateErrorMessage( + new ValidationTestUtil().validateErrorMessage( messages.get(SdcCommon.MANIFEST_NAME).getErrorMessageList().get(0).getMessage(), "ERROR: " +"[MNF6]: " + Messages.INVALID_MANIFEST_FILE.getErrorMessage()); @@ -74,28 +74,28 @@ public class ManifestValidatorTest { @Test public void testMissingFileInManifest() { - Map messages = ValidationTestUtil.testValidator(new ManifestValidator(), + Map messages = new ValidationTestUtil().testValidator(new ManifestValidator(), RESOURCE_PATH + "/missingFileInManifest"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertTrue(messages.containsKey("extraFile.env")); - ValidationTestUtil.validateErrorMessage(messages.get("extraFile.env").getErrorMessageList() + new ValidationTestUtil().validateErrorMessage(messages.get("extraFile.env").getErrorMessageList() .get(0).getMessage(), "WARNING: " + "[MNF5]: " + Messages.MISSING_FILE_IN_MANIFEST.getErrorMessage()); } @Test public void testMissingFileTypeInManifest() { - Map messages = ValidationTestUtil.testValidator(new ManifestValidator(), + Map messages = new ValidationTestUtil().testValidator(new ManifestValidator(), RESOURCE_PATH + "/missingFileTypeInManifest"); - ValidationTestUtil.validateErrorMessage( + new ValidationTestUtil().validateErrorMessage( messages.get("MANIFEST.json").getErrorMessageList().get(0).getMessage(), "ERROR: " + "[MNF7]: Missing file name in manifest"); } @Test public void testInvalidFileTypeInManifest() { - Map messages = ValidationTestUtil.testValidator(new ManifestValidator(), + Map messages = new ValidationTestUtil().testValidator(new ManifestValidator(), RESOURCE_PATH + "/invalidFileTypeInManifest"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 4); @@ -103,19 +103,19 @@ public class ManifestValidatorTest { Assert.assertTrue(messages.containsKey("illegalTypeFile.yaml")); Assert.assertTrue(messages.containsKey("single.yaml.illegalSuffix")); Assert.assertTrue(messages.containsKey("singleVol.yaml.illegalSuffix")); - ValidationTestUtil.validateErrorMessage( + new ValidationTestUtil().validateErrorMessage( messages.get("single.env.illegalSuffix").getErrorMessageList().get(0).getMessage(), "ERROR: "+"[MNF3]: " + Messages.WRONG_ENV_FILE_EXTENSION.getErrorMessage(), "single.env.illegalSuffix"); - ValidationTestUtil.validateErrorMessage( + new ValidationTestUtil().validateErrorMessage( messages.get("illegalTypeFile.yaml").getErrorMessageList().get(0).getMessage(), "ERROR: "+"[MNF8]: " + Messages.INVALID_FILE_TYPE.getErrorMessage(), "illegalTypeFile.yaml"); - ValidationTestUtil.validateErrorMessage( + new ValidationTestUtil().validateErrorMessage( messages.get("single.yaml.illegalSuffix").getErrorMessageList().get(0).getMessage(), "ERROR: "+"[MNF2]: " + Messages.WRONG_HEAT_FILE_EXTENSION.getErrorMessage(), "single.yaml.illegalSuffix"); - ValidationTestUtil.validateErrorMessage( + new ValidationTestUtil().validateErrorMessage( messages.get("singleVol.yaml.illegalSuffix").getErrorMessageList().get(0).getMessage(), "ERROR: "+"[MNF2]: " + Messages.WRONG_HEAT_FILE_EXTENSION.getErrorMessage(), "singleVol.yaml.illegalSuffix"); @@ -126,16 +126,16 @@ public class ManifestValidatorTest { @Test public void testMissingFileInManifestAndInZip() { - Map messages = ValidationTestUtil.testValidator(new ManifestValidator(), + Map messages = new ValidationTestUtil().testValidator(new ManifestValidator(), RESOURCE_PATH + "/missingFileInManifestAndInZip"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 2); Assert.assertTrue(messages.containsKey("extraFile.env")); Assert.assertTrue(messages.containsKey("singleVol.yaml")); - ValidationTestUtil.validateErrorMessage(messages.get("extraFile.env").getErrorMessageList() + new ValidationTestUtil().validateErrorMessage(messages.get("extraFile.env").getErrorMessageList() .get(0).getMessage(), "WARNING: " + "[MNF5]: "+ Messages.MISSING_FILE_IN_MANIFEST .getErrorMessage()); - ValidationTestUtil.validateErrorMessage(messages.get("singleVol.yaml").getErrorMessageList() + new ValidationTestUtil().validateErrorMessage(messages.get("singleVol.yaml").getErrorMessageList() .get(0).getMessage(), "ERROR: " + "[MNF4]: " + Messages.MISSING_FILE_IN_ZIP .getErrorMessage()); @@ -143,12 +143,12 @@ public class ManifestValidatorTest { @Test public void testEnvInRoot() { - Map messages = ValidationTestUtil.testValidator(new ManifestValidator(), + Map messages = new ValidationTestUtil().testValidator(new ManifestValidator(), RESOURCE_PATH + "/envInRoot"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); Assert.assertTrue(messages.containsKey("second.env")); - ValidationTestUtil.validateErrorMessage(messages.get("second.env").getErrorMessageList() + new ValidationTestUtil().validateErrorMessage(messages.get("second.env").getErrorMessageList() .get(0).getMessage(), "ERROR: [MNF1]: ENV file must be associated to a HEAT file"); } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidatorTest.java index b510eeb26a..210bdd3504 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidatorTest.java @@ -73,6 +73,6 @@ public class PmDictionaryValidatorTest { private Map runValidation(String path) { PmDictionaryValidator validator = new PmDictionaryValidator(); - return ValidationTestUtil.testValidator(validator, path); + return new ValidationTestUtil().testValidator(validator, path); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java index dde43e7808..a0b18b2922 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/SharedResourceGuideLineValidatorTest.java @@ -33,12 +33,12 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testBaseHeatExposeNetwork() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/baseHeatDoesNotExposeNetwork/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); - messages = ValidationTestUtil.testValidator(validator, + messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/baseHeatDoesNotExposeNetwork/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); @@ -49,7 +49,7 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testParseException(){ - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/baseHeatDoesNotExposeNetwork/parseException/"); Assert.assertEquals(messages.size(), 1); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1); @@ -64,7 +64,7 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testInvalidGetResource(){ - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/" + "baseHeatDoesNotExposeNetworkInvalidGetResource"); Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), @@ -74,12 +74,12 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testBaseHeatExposeNetworkAndVolume() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/baseHeatDoesNotExposeNetworkAndVolume/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); - messages = ValidationTestUtil.testValidator(validator, + messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/baseHeatDoesNotExposeNetworkAndVolume/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); @@ -92,12 +92,12 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testBaseHeatExposeServerGroup() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/baseHeatDoesNotExposeServerGroup/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); - messages = ValidationTestUtil.testValidator(validator, + messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/baseHeatDoesNotExposeServerGroup/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); @@ -108,12 +108,12 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testBaseHeatExposeSecurityGroup() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/baseHeatDoesNotExposeSecurityGroup/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); - messages = ValidationTestUtil.testValidator(validator, + messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/baseHeatDoesNotExposeSecurityGroup/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); @@ -124,12 +124,12 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testBaseHeatExposeVolume() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/baseHeatDoesNotExposeVolume/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); - messages = ValidationTestUtil.testValidator(validator, + messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/baseHeatDoesNotExposeVolume/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); @@ -140,12 +140,12 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testHeatVolumeExpose() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/heatVolumeExpose/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); - messages = ValidationTestUtil.testValidator(validator, + messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/heatVolumeExpose/negative/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); @@ -157,13 +157,13 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testResourceIsExposedByCallingGetResourceNotFromOutput() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/baseHeatExposeResourceUsingGetResource/positive"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); - messages = ValidationTestUtil.testValidator(validator, + messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/baseHeatExposeResourceUsingGetResource/negative"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); @@ -174,7 +174,7 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testMissingBaseHeat() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/missingBaseHeat/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); @@ -185,7 +185,7 @@ public class SharedResourceGuideLineValidatorTest { @Test public void testMultiBaseHeat() { - Map messages = ValidationTestUtil.testValidator(validator, + Map messages = new ValidationTestUtil().testValidator(validator, RESOURCE_PATH + "/multiBaseHeat/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 1); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/YamlValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/YamlValidatorTest.java index 637510abba..77e2f2a837 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/YamlValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/YamlValidatorTest.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,82 +31,67 @@ import org.openecomp.sdc.validation.util.ValidationTestUtil; public class YamlValidatorTest { - private static final String RESOURCE_PATH = "/org/openecomp/validation/validators/yaml_validator"; - - public Map runValidation(String path) { - YamlValidator validator = new YamlValidator(); - return ValidationTestUtil.testValidator(validator, path); - - } - - @Test - public void testValidYaml() { - - Map messages = runValidation( - RESOURCE_PATH + "/valid_yaml/input/validHeat.yaml"); - Assert.assertNotNull(messages); - Assert.assertEquals(messages.size(), 0); - } - - @Test - public void testInvalidTabYaml() { - - Map messages = runValidation( - RESOURCE_PATH + "/invalid_valid_yaml_structure/input/invalidYamlTab.yaml"); - Assert.assertNotNull(messages); - Assert.assertEquals(messages.size(), 1); - ValidationTestUtil.validateErrorMessage( - messages.get("invalidYamlTab.yaml").getErrorMessageList().get(0).getMessage(), - "ERROR: " +"[YML2]: "+ Messages.INVALID_YAML_FORMAT_REASON.getErrorMessage(), - "while scanning for the next tokenfound character '\\t(TAB)' that cannot start " + - "any token. (Do not use \\t(TAB) for indentation) in 'reader', line 14, " + - "column 5: \tadmin_state_up: true ^"); - } - - @Test - public void testDuplicateKeyInYaml() { - - Map messages = - runValidation(RESOURCE_PATH + "/duplicateKey.yaml"); - Assert.assertNotNull(messages); - Assert.assertEquals(messages.size(), 1); - Assert.assertTrue(messages.containsKey("duplicateKey.yaml")); - ValidationTestUtil.validateErrorMessage( - messages.get("duplicateKey.yaml").getErrorMessageList().get(0).getMessage(), - "ERROR: " +"[YML2]: "+ Messages.INVALID_YAML_FORMAT_REASON.getErrorMessage(), - "while parsing MappingNode in 'reader', line 6, column 3: " + - "Key_1_unique: ^duplicate key: Key_2_not_unique in 'reader', line 31, " + - "column 1: ^"); - } - - @Test - public void testInvalidYamlStructure() { - - Map messages = runValidation( - RESOURCE_PATH + "/invalidYamlStructure.yaml"); - Assert.assertNotNull(messages); - Assert.assertEquals(messages.size(), 1); - Assert.assertTrue(messages.containsKey("invalidYamlStructure.yaml")); - ValidationTestUtil.validateErrorMessage( - messages.get("invalidYamlStructure.yaml").getErrorMessageList().get(0).getMessage(), - "ERROR: " +"[YML2]: "+ Messages.INVALID_YAML_FORMAT_REASON.getErrorMessage(), - "while parsing a block mapping in 'reader', line 8, column 7: " + - "admin_state_up: true ^expected , but found BlockEntry in 'reader', " + - "line 10, column 7: - shared: true ^"); - } - - @Test - public void testEmptyYaml() { - - Map messages = - runValidation(RESOURCE_PATH + "/emptyYaml.yaml"); - Assert.assertNotNull(messages); - Assert.assertEquals(messages.size(), 1); - Assert.assertTrue(messages.containsKey("emptyYaml.yaml")); - ValidationTestUtil.validateErrorMessage(messages.get("emptyYaml.yaml").getErrorMessageList() - .get(0).getMessage(), - "ERROR: " +"[YML1]: "+ Messages.INVALID_YAML_FORMAT_REASON.getErrorMessage(), - Messages.EMPTY_YAML_FILE.getErrorMessage()); - } + private static final String RESOURCE_PATH = "/org/openecomp/validation/validators/yaml_validator"; + + public Map runValidation(String path) { + return new ValidationTestUtil().testValidator(new YamlValidator(), path); + } + + @Test + public void testValidYaml() { + Map messages = runValidation(RESOURCE_PATH + "/valid_yaml/input/validHeat.yaml"); + Assert.assertNotNull(messages); + Assert.assertEquals(0, messages.size()); + } + + @Test + public void testInvalidTabYaml() { + + Map messages = runValidation( + RESOURCE_PATH + "/invalid_valid_yaml_structure/input/invalidYamlTab.yaml"); + Assert.assertNotNull(messages); + Assert.assertEquals(1, messages.size()); + new ValidationTestUtil().validateErrorMessage( + messages.get("invalidYamlTab.yaml").getErrorMessageList().get(0).getMessage(), + "ERROR: " + "[YML2]: " + Messages.INVALID_YAML_FORMAT_REASON.getErrorMessage(), + "while scanning for the next tokenfound character '\\t(TAB)' that cannot start " + + "any token. (Do not use \\t(TAB) for indentation) in 'reader', line 14, " + + "column 5: \tadmin_state_up: true ^"); + } + + @Test + public void testDuplicateKeyInYaml() { + Map messages = new ValidationTestUtil().testValidator(new YamlValidator(), RESOURCE_PATH + "/duplicateKey.yaml"); + Assert.assertNotNull(messages); + Assert.assertEquals(1, messages.size()); + Assert.assertTrue(messages.containsKey("duplicateKey.yaml")); + Assert.assertTrue(messages.get("duplicateKey.yaml").getErrorMessageList().get(0).getMessage().contains("Key_2_not_unique")); + } + + @Test + public void testInvalidYamlStructure() { + Map messages = runValidation(RESOURCE_PATH + "/invalidYamlStructure.yaml"); + Assert.assertNotNull(messages); + Assert.assertEquals(1, messages.size()); + Assert.assertTrue(messages.containsKey("invalidYamlStructure.yaml")); + new ValidationTestUtil().validateErrorMessage( + messages.get("invalidYamlStructure.yaml").getErrorMessageList().get(0).getMessage(), + "ERROR: " + "[YML2]: " + Messages.INVALID_YAML_FORMAT_REASON.getErrorMessage(), + "while parsing a block mapping in 'reader', line 8, column 7: " + + "admin_state_up: true ^expected , but found '-' in 'reader', " + + "line 10, column 7: - shared: true ^"); + } + + @Test + public void testEmptyYaml() { + Map messages = runValidation(RESOURCE_PATH + "/emptyYaml.yaml"); + Assert.assertNotNull(messages); + Assert.assertEquals(1, messages.size()); + Assert.assertTrue(messages.containsKey("emptyYaml.yaml")); + new ValidationTestUtil().validateErrorMessage(messages.get("emptyYaml.yaml").getErrorMessageList() + .get(0).getMessage(), + "ERROR: " + "[YML1]: " + Messages.INVALID_YAML_FORMAT_REASON.getErrorMessage(), + Messages.EMPTY_YAML_FILE.getErrorMessage()); + } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidatorTest.java index 43041140a3..707848f1bd 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ContrailNetworkPolicyResourceValidatorTest.java @@ -37,7 +37,7 @@ public class ContrailNetworkPolicyResourceValidatorTest { private static final String PATH = "/org/openecomp/validation/validators/heat_validator/network_policy_associated_with_attach_policy/"; @Test public void testNetworkPolicyAssociatedWithAttachPolicy() throws IOException { - Map messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator , HeatResourcesTypes.CONTRAIL_NETWORK_RULE_RESOURCE_TYPE.getHeatResource(), PATH + "positive"); @@ -52,7 +52,7 @@ public class ContrailNetworkPolicyResourceValidatorTest { @Test public void testNonNetworkPolicyResource() throws IOException { - Map messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator , HeatResourcesTypes.CONTRAIL_VIRTUAL_NETWORK_RESOURCE_TYPE.getHeatResource(), PATH + "negative"); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidatorTest.java index b864a2d557..d8cecc9ca1 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NestedResourceValidatorTest.java @@ -38,7 +38,7 @@ public class NestedResourceValidatorTest { @Test public void testNoLoopsNesting() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, null, PATH + "no_loops_nesting/negative_test/input"); @@ -74,7 +74,7 @@ public class NestedResourceValidatorTest { @Test public void testPropertiesMatchNestedParameters() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, null, PATH + "properties_match_nested_parameters/negative_test/input"); @@ -89,7 +89,7 @@ public class NestedResourceValidatorTest { @Test public void testWrongValueTypeAssigned() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, null, PATH + "properties_match_nested_parameters/wrong_value_type_assigned/input"); @@ -107,7 +107,7 @@ public class NestedResourceValidatorTest { final Resource resource = new Resource(); resource.setType("nested-pps_v1.0.yaml"); - final GlobalValidationContext globalValidationContext = ValidationTestUtil.createGlobalContextFromPath(PATH + "missing_nested_file/input"); + final GlobalValidationContext globalValidationContext = new ValidationTestUtil().createGlobalContextFromPath(PATH + "missing_nested_file/input"); NestedResourceValidator.validateAllPropertiesMatchNestedParameters(null, null, resource, Optional.empty(), globalValidationContext); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidatorTest.java index 10c70b64d4..0e02a1d6ee 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronPortResourceValidatorTest.java @@ -36,7 +36,7 @@ public class NeutronPortResourceValidatorTest { private static final String PATH = "/org/openecomp/validation/validators/heat_validator/"; @Test public void testMoreThanOneBindFromNovaToPort() throws IOException { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), PATH + "one_nova_points_to_one_port/negative_test/input"); @@ -51,7 +51,7 @@ public class NeutronPortResourceValidatorTest { @Test public void testPortNotBindToAnyNovaServerHPR1() throws IOException { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "no_neutron_port/input"); @@ -66,7 +66,7 @@ public class NeutronPortResourceValidatorTest { @Test public void testPortNotBindToAnyNovaServerHPR3() throws IOException { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "port_no_bind_to_any_nova_server/input"); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidatorTest.java index fabc833106..10de81350d 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NeutronSecurityGroupResourceValidatorTest.java @@ -37,7 +37,7 @@ public class NeutronSecurityGroupResourceValidatorTest { @Test public void testSecurityGroupBaseFileNoPorts() throws IOException { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NEUTRON_SECURITY_GROUP_RESOURCE_TYPE.getHeatResource(), PATH + "security_group_base_file_no_ports/input"); @@ -52,7 +52,7 @@ public class NeutronSecurityGroupResourceValidatorTest { @Test public void testSecurityGroupsCalledByPort() throws IOException { - Map messages =ValidationTestUtil.testValidator(baseValidator, + Map messages =new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NEUTRON_SECURITY_GROUP_RESOURCE_TYPE.getHeatResource(), PATH + "security_group_called_by_port/input"); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java index e9c70b0251..b22dd4df4a 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerGroupResourceValidatorTest.java @@ -35,7 +35,7 @@ public class NovaServerGroupResourceValidatorTest { private static final String PATH = "/org/openecomp/validation/validators/heat_validator/"; @Test public void testPolicyIsAffinityOrAntiAffinity() throws IOException { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource(), PATH + "policy_is_affinity_or_anti_affinity/negative_test/input"); @@ -50,7 +50,7 @@ public class NovaServerGroupResourceValidatorTest { @Test public void testServerGroupCalledByServer() throws IOException { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource(), PATH + "server_group_called_by_nova_server/input"); @@ -66,7 +66,7 @@ public class NovaServerGroupResourceValidatorTest { @Test public void testNonServerGroup() throws IOException { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "server_group_called_by_nova_server_negative/input"); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidatorTest.java index 63523329cc..d56a5eaf2b 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidatorTest.java @@ -35,7 +35,7 @@ public class NovaServerResourceValidatorTest { private static final String PATH = "/org/openecomp/validation/validators/heat_validator/"; @Test public void testNovaPropertiesHasAssignedValue() throws IOException { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "nova_properties_has_assigned_value/negative_test/input"); @@ -50,7 +50,7 @@ public class NovaServerResourceValidatorTest { @Test public void testServerGroupsPointedByServersDefinedCorrectly() throws IOException { - Map messages =ValidationTestUtil.testValidator(baseValidator, + Map messages =new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "server_groups_defined_correctly/negative_test/input"); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidatorTest.java index 07cfaf7481..b80788a9c3 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/ResourceGroupResourceValidatorTest.java @@ -35,7 +35,7 @@ public class ResourceGroupResourceValidatorTest { private static final String PATH = "/org/openecomp/validation/validators/heat_validator/"; @Test public void testResourceGroupWithInvalidIndexVar() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.RESOURCE_GROUP_RESOURCE_TYPE.getHeatResource(), PATH + "resource_group_invalid_indexvar/negative_test/input"); @@ -89,7 +89,7 @@ public class ResourceGroupResourceValidatorTest { @Test public void testResourceGroupWithInvalidType() { - Map messages =ValidationTestUtil.testValidator(baseValidator, + Map messages =new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.RESOURCE_GROUP_RESOURCE_TYPE.getHeatResource(), PATH + "resource_group_invalid_type/negative_test/input"); @@ -110,7 +110,7 @@ public class ResourceGroupResourceValidatorTest { @Test public void testResourcesGroupWithNested() { - Map messages =ValidationTestUtil.testValidator(baseValidator, + Map messages =new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.RESOURCE_GROUP_RESOURCE_TYPE.getHeatResource(), PATH + "resources_group_with_nested/negative_test/input"); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java index 9fcef284a9..4a8e7970b5 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/heatresource/VirtualMachineInterfaceValidatorTest.java @@ -17,6 +17,7 @@ package org.openecomp.sdc.validation.impl.validators.heatresource; import java.util.Map; + import org.junit.Assert; import org.junit.Test; import org.openecomp.core.validation.types.MessageContainer; @@ -30,128 +31,121 @@ import org.openecomp.sdc.validation.util.ValidationTestUtil; */ public class VirtualMachineInterfaceValidatorTest { - private static final String PATH = - "/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/"; - - - @Test - public void hasSingleParentPortNegative() { - HeatResourceValidator baseValidator = new HeatResourceValidator(); - VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, - resourceValidator, - HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), - PATH + "vlan_multiple_parent_ports/negative_test/input"); - - Assert.assertNotNull(messages); - Assert.assertEquals(messages.size(), 1); - - Assert.assertEquals(messages.get("nested.yml").getErrorMessageList().size(), 1); - Assert.assertEquals( - messages.get("nested.yml").getErrorMessageList().get(0).getMessage(), - "ERROR: [VLAN1]: More than one parent port found, " + - "there should be only one parent port for a VLAN sub-interface ID [template_Vlan_2]"); - } - - @Test - public void hasSingleParentPortNegativeWithGetResource() { - HeatResourceValidator baseValidator = new HeatResourceValidator(); - VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, - resourceValidator, - HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), - PATH + "vlan_multiple_parent_ports/negative_get_resource/input"); - - Assert.assertNotNull(messages); - Assert.assertEquals(messages.size(), 0); - } - - - @Test - public void hasSingleParentPortPositive() { - HeatResourceValidator baseValidator = new HeatResourceValidator(); - VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, - resourceValidator, - HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), - PATH + "vlan_multiple_parent_ports/positive_test/input"); - - Assert.assertNotNull(messages); - Assert.assertEquals(messages.size(), 0); - - - } - - - @Test - public void hasBothPropertiesNegativeMissingVlanTag() { - HeatResourceValidator baseValidator = new HeatResourceValidator(); - VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, - resourceValidator, - HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), - PATH + "vlan_has_two_properties/negative_tag_missing/input"); - - Assert.assertNotNull(messages); - Assert.assertEquals(messages.size(), 1); - - Assert.assertEquals(messages.get("nested.yml").getErrorMessageList().size(), 1); - Assert.assertEquals( - messages.get("nested.yml").getErrorMessageList().get(0).getMessage(), - "WARNING: [VLAN2]: VLAN Tag property " + - "virtual_machine_interface_properties_sub_interface_vlan_tag " + - "is missing in VLAN Resource ID [template_Vlan_2]"); - } - - @Test - public void hasBothPropertiesNegativeMissingRefs() { - HeatResourceValidator baseValidator = new HeatResourceValidator(); - VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, - resourceValidator, - HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), - PATH + "vlan_has_two_properties/negative_refs_missing/input"); - - Assert.assertNotNull(messages); - Assert.assertEquals(messages.size(), 1); - - Assert.assertEquals(messages.get("nested.yml").getErrorMessageList().size(), 1); - Assert.assertEquals( - messages.get("nested.yml").getErrorMessageList().get(0).getMessage(), - "WARNING: [VLAN2]: Parent port property virtual_machine_interface_refs is " + - "missing in VLAN Resource ID [template_Vlan_2]"); - } - - @Test - public void hasBothPropertiesBothMissingWhichMeansPositive() { - HeatResourceValidator baseValidator = new HeatResourceValidator(); - VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, - resourceValidator, - HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), - PATH + "vlan_has_two_properties/negative_both_missing/input"); - - Assert.assertNotNull(messages); - Assert.assertEquals(messages.size(), 0); - - } - - - @Test - public void hasBothPropertiesPositive() { - HeatResourceValidator baseValidator = new HeatResourceValidator(); - VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, - resourceValidator, - HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), - PATH + "vlan_has_two_properties/positive_test/input"); - - Assert.assertNotNull(messages); - Assert.assertEquals(messages.size(), 0); - - - } - - - + private static final String PATH = + "/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/"; + + + @Test + public void hasSingleParentPortNegative() { + HeatResourceValidator baseValidator = new HeatResourceValidator(); + VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); + Map messages = new ValidationTestUtil().testValidator(baseValidator, + resourceValidator, + HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), + PATH + "vlan_multiple_parent_ports/negative_test/input"); + + Assert.assertNotNull(messages); + Assert.assertEquals(1, messages.size()); + + Assert.assertEquals(1, messages.get("nested.yml").getErrorMessageList().size()); + Assert.assertEquals( + messages.get("nested.yml").getErrorMessageList().get(0).getMessage(), + "ERROR: [VLAN1]: More than one parent port found, " + + "there should be only one parent port for a VLAN sub-interface ID [template_Vlan_2]"); + } + + @Test + public void hasSingleParentPortNegativeWithGetResource() { + HeatResourceValidator baseValidator = new HeatResourceValidator(); + VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); + Map messages = new ValidationTestUtil().testValidator(baseValidator, + resourceValidator, + HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), + PATH + "vlan_multiple_parent_ports/negative_get_resource/input"); + + Assert.assertNotNull(messages); + Assert.assertEquals(messages.size(), 0); + } + + + @Test + public void hasSingleParentPortPositive() { + HeatResourceValidator baseValidator = new HeatResourceValidator(); + VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); + Map messages = new ValidationTestUtil().testValidator(baseValidator, + resourceValidator, + HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), + PATH + "vlan_multiple_parent_ports/positive_test/input"); + + Assert.assertNotNull(messages); + Assert.assertEquals(0, messages.size()); + } + + + @Test + public void hasBothPropertiesNegativeMissingVlanTag() { + HeatResourceValidator baseValidator = new HeatResourceValidator(); + VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); + Map messages = new ValidationTestUtil().testValidator(baseValidator, + resourceValidator, + HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), + PATH + "vlan_has_two_properties/negative_tag_missing/input"); + + Assert.assertNotNull(messages); + Assert.assertEquals(messages.size(), 1); + + Assert.assertEquals(messages.get("nested.yml").getErrorMessageList().size(), 1); + Assert.assertEquals( + messages.get("nested.yml").getErrorMessageList().get(0).getMessage(), + "WARNING: [VLAN2]: VLAN Tag property " + + "virtual_machine_interface_properties_sub_interface_vlan_tag " + + "is missing in VLAN Resource ID [template_Vlan_2]"); + } + + @Test + public void hasBothPropertiesNegativeMissingRefs() { + HeatResourceValidator baseValidator = new HeatResourceValidator(); + VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); + Map messages = new ValidationTestUtil().testValidator(baseValidator, + resourceValidator, + HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), + PATH + "vlan_has_two_properties/negative_refs_missing/input"); + + Assert.assertNotNull(messages); + Assert.assertEquals(messages.size(), 1); + + Assert.assertEquals(messages.get("nested.yml").getErrorMessageList().size(), 1); + Assert.assertEquals( + messages.get("nested.yml").getErrorMessageList().get(0).getMessage(), + "WARNING: [VLAN2]: Parent port property virtual_machine_interface_refs is " + + "missing in VLAN Resource ID [template_Vlan_2]"); + } + + @Test + public void hasBothPropertiesBothMissingWhichMeansPositive() { + HeatResourceValidator baseValidator = new HeatResourceValidator(); + VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); + Map messages = new ValidationTestUtil().testValidator(baseValidator, + resourceValidator, + HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), + PATH + "vlan_has_two_properties/negative_both_missing/input"); + + Assert.assertNotNull(messages); + Assert.assertEquals(messages.size(), 0); + + } + + + @Test + public void hasBothPropertiesPositive() { + HeatResourceValidator baseValidator = new HeatResourceValidator(); + VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator(); + Map messages = new ValidationTestUtil().testValidator(baseValidator, + resourceValidator, + HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), + PATH + "vlan_has_two_properties/positive_test/input"); + + Assert.assertNotNull(messages); + Assert.assertEquals(messages.size(), 0); + } } \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java index d61d71839a..dd74f98ed6 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceInstanceNamingConventionValidatorTest.java @@ -36,7 +36,7 @@ public class ContrailServiceInstanceNamingConventionValidatorTest { @Test public void testContrailServiceInstanceAvailabilityZoneNotAlignedWithNamingConvention() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_INSTANCE.getHeatResource(), PATH + "notaligned"); Assert.assertNotNull(messages); @@ -48,7 +48,7 @@ public class ContrailServiceInstanceNamingConventionValidatorTest { @Test public void testContrailServiceInstanceAvailabilityZoneAlignedWithNamingConvention() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_INSTANCE.getHeatResource(), PATH + "aligned"); Assert.assertNotNull(messages); @@ -56,7 +56,7 @@ public class ContrailServiceInstanceNamingConventionValidatorTest { } @Test public void testContrailServiceInstanceAvailabilityZoneNotAlignedWithNamingConventionMissingParam() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_INSTANCE.getHeatResource(), PATH + "missingparam"); Assert.assertNotNull(messages); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidatorTest.java index f9e0765158..f04778c1b0 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/ContrailServiceTemplateNamingConventionValidatorTest.java @@ -36,7 +36,7 @@ public class ContrailServiceTemplateNamingConventionValidatorTest { @Test public void testContrailServiceTemplateImageAndFlavorNamesAlignedWithNamingConventionButDifferentVmType() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(), PATH + "imageandflavordifferentvmtype"); Assert.assertNotNull(messages); @@ -49,7 +49,7 @@ public class ContrailServiceTemplateNamingConventionValidatorTest { @Test public void testContrailServiceTemplateImageAndFlavorNamesNotAlignedWithNamingConvention() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(), PATH + "/notaligned"); Assert.assertNotNull(messages); @@ -63,7 +63,7 @@ public class ContrailServiceTemplateNamingConventionValidatorTest { @Test public void testContrailServiceTemplateImageAndFlavorNamesAlignedWithNamingConvention() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(), PATH + "aligned"); Assert.assertNotNull(messages); @@ -72,7 +72,7 @@ public class ContrailServiceTemplateNamingConventionValidatorTest { @Test public void testContrailServiceTemplateMissingParam() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(), PATH + "missingparam"); Assert.assertNotNull(messages); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java index 00f95ef383..8dad17bcd1 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NeutronPortNamingConventionValidatorTest.java @@ -30,18 +30,17 @@ import org.openecomp.sdc.validation.util.ValidationTestUtil; public class NeutronPortNamingConventionValidatorTest { NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator(); - NeutronPortNamingConventionValidator resourceValidator = new - NeutronPortNamingConventionValidator(); - private static final String PATH = "/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/"; + NeutronPortNamingConventionValidator resourceValidator = new NeutronPortNamingConventionValidator(); + private static final String PATH = "/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/"; @Test public void testHeatPortNetworkNamingConvention() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), PATH + "positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); - messages = ValidationTestUtil.testValidator(baseValidator, + messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), PATH + "negative/"); Assert.assertNotNull(messages); @@ -53,13 +52,13 @@ public class NeutronPortNamingConventionValidatorTest { @Test public void testNeutronFixedIpName() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), PATH + "positiveFixedIP"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); - messages = ValidationTestUtil.testValidator(baseValidator, + messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), PATH + "negativeFixedIP/"); Assert.assertNotNull(messages); @@ -76,13 +75,13 @@ public class NeutronPortNamingConventionValidatorTest { @Test public void testMissingParam() { - Map messages = ValidationTestUtil.testValidator(baseValidator, - resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), + Map messages = new ValidationTestUtil().testValidator(new NamingConventionGuideLineValidator(), + new NeutronPortNamingConventionValidator(), HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(), PATH + "missingparam/"); Assert.assertNotNull(messages); - Assert.assertEquals(messages.size(), 1); - Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().size(), 1); - Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), - "WARNING: [NNP2]: Missing get_param in network or network_id, Resource Id [port_resource_2]"); + Assert.assertEquals(1, messages.size()); + Assert.assertEquals(1, messages.get("first.yaml").getErrorMessageList().size()); + Assert.assertEquals("WARNING: [NNP2]: Missing get_param in network or network_id, Resource Id [port_resource_2]", + messages.get("first.yaml").getErrorMessageList().get(0).getMessage()); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java index 01750c5f54..cfa3a86325 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidatorTest.java @@ -36,13 +36,13 @@ public class NovaServerNamingConventionGuideLineValidatorTest { private static final String PATH = "/org/openecomp/validation/validators/guideLineValidator/novaserverValidation/"; @Test public void testHeatNovaServerMetaDataValidation() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "heatNovaServerMetaDataValidation/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); - messages = ValidationTestUtil.testValidator(baseValidator, + messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "heatNovaServerMetaDataValidation/negative/"); Assert.assertNotNull(messages); @@ -54,13 +54,13 @@ public class NovaServerNamingConventionGuideLineValidatorTest { @Test public void testNovaServerAvailabilityZoneName() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "heatNovaServerAvailabilityZoneName/positive"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); - messages = ValidationTestUtil.testValidator(baseValidator, + messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "heatNovaServerAvailabilityZoneName/negative"); Assert.assertNotNull(messages); @@ -74,7 +74,7 @@ public class NovaServerNamingConventionGuideLineValidatorTest { @Test public void testNovaImageAndFlavorNamesEmptyProperties() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "heatNovaServerImageAndFlavor/negativeEmptyProperties"); Assert.assertNotNull(messages); @@ -86,13 +86,13 @@ public class NovaServerNamingConventionGuideLineValidatorTest { @Test public void testNovaImageAndFlavorNames() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "heatNovaServerImageAndFlavor/positive"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); - messages = ValidationTestUtil.testValidator(baseValidator, + messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "heatNovaServerImageAndFlavor/negative"); Assert.assertNotNull(messages); @@ -106,12 +106,12 @@ public class NovaServerNamingConventionGuideLineValidatorTest { @Test public void testNovaResourceNetworkUniqueRole() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "heatNovaNetworkUniqueRoleConvention/positive/"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); - messages = ValidationTestUtil.testValidator(baseValidator, + messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "heatNovaNetworkUniqueRoleConvention/negative/"); Assert.assertNotNull(messages); @@ -123,13 +123,13 @@ public class NovaServerNamingConventionGuideLineValidatorTest { @Test public void testNovaServerName() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "heatNovaServerNameValidation/positive"); Assert.assertNotNull(messages); Assert.assertEquals(messages.size(), 0); - messages = ValidationTestUtil.testValidator(baseValidator, + messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "heatNovaServerNameValidation/negative/"); Assert.assertNotNull(messages); @@ -141,7 +141,7 @@ public class NovaServerNamingConventionGuideLineValidatorTest { @Test public void testVMNameSyncInNova() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "input"); @@ -161,7 +161,7 @@ public class NovaServerNamingConventionGuideLineValidatorTest { @Test public void testAvailabilityZoneName() throws IOException { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "availability_zone_name/input"); @@ -179,7 +179,7 @@ public class NovaServerNamingConventionGuideLineValidatorTest { @Test public void testHeatNovaServerVnfIDValidation() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), "/org/openecomp/validation/validators/guideLineValidator/novaserverValidation/heatNovaServerMetaDataValidation/negativemissingvnfid/"); Assert.assertNotNull(messages); @@ -190,7 +190,7 @@ public class NovaServerNamingConventionGuideLineValidatorTest { @Test public void testHeatNovaServerVfModuleValidation() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), "/org/openecomp/validation/validators/guideLineValidator/novaserverValidation/heatNovaServerMetaDataValidation/negativemisningvfmodule/"); Assert.assertNotNull(messages); @@ -200,7 +200,7 @@ public class NovaServerNamingConventionGuideLineValidatorTest { @Test public void testMissingParam() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "heatNovaNetworkUniqueRoleConvention/missingportNetwork/"); Assert.assertNotNull(messages); @@ -217,7 +217,7 @@ public class NovaServerNamingConventionGuideLineValidatorTest { @Test public void testNovaResource() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "heatNovaNetworkUniqueRoleConvention/invalidresource/"); Assert.assertNotNull(messages); @@ -227,7 +227,7 @@ public class NovaServerNamingConventionGuideLineValidatorTest { @Test public void testEnvFileContent() { - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(), PATH + "heatNovaNetworkUniqueRoleConvention/input/"); Assert.assertNotNull(messages); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/VirtualMachineInterfaceGuidelineValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/VirtualMachineInterfaceGuidelineValidatorTest.java index e660fbffd5..21b5ca6f5f 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/VirtualMachineInterfaceGuidelineValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/namingconvention/VirtualMachineInterfaceGuidelineValidatorTest.java @@ -34,7 +34,7 @@ public class VirtualMachineInterfaceGuidelineValidatorTest { NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator(); VirtualMachineInterfaceGuidelineValidator resourceValidator = new VirtualMachineInterfaceGuidelineValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), PATH + "modeled_through_resource_group/positive_test/input"); @@ -50,7 +50,7 @@ public class VirtualMachineInterfaceGuidelineValidatorTest { NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator(); VirtualMachineInterfaceGuidelineValidator resourceValidator = new VirtualMachineInterfaceGuidelineValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), PATH + "modeled_through_resource_group/negative_test/input"); @@ -71,7 +71,7 @@ public class VirtualMachineInterfaceGuidelineValidatorTest { NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator(); VirtualMachineInterfaceGuidelineValidator resourceValidator = new VirtualMachineInterfaceGuidelineValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), PATH + "modeled_through_resource_group/negative_test_non_string/input"); @@ -92,7 +92,7 @@ public class VirtualMachineInterfaceGuidelineValidatorTest { NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator(); VirtualMachineInterfaceGuidelineValidator resourceValidator = new VirtualMachineInterfaceGuidelineValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), PATH + "modeled_through_resource_group/negative_get_resource/input"); @@ -114,7 +114,7 @@ public class VirtualMachineInterfaceGuidelineValidatorTest { NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator(); VirtualMachineInterfaceGuidelineValidator resourceValidator = new VirtualMachineInterfaceGuidelineValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), PATH + "single_vlan_resource/positive_test/input"); @@ -130,7 +130,7 @@ public class VirtualMachineInterfaceGuidelineValidatorTest { NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator(); VirtualMachineInterfaceGuidelineValidator resourceValidator = new VirtualMachineInterfaceGuidelineValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), PATH + "single_vlan_resource/negative_test/two_vlans"); @@ -151,7 +151,7 @@ public class VirtualMachineInterfaceGuidelineValidatorTest { NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator(); VirtualMachineInterfaceGuidelineValidator resourceValidator = new VirtualMachineInterfaceGuidelineValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), PATH + "single_vlan_resource/negative_test/vlan_and_nova"); @@ -171,7 +171,7 @@ public class VirtualMachineInterfaceGuidelineValidatorTest { NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator(); VirtualMachineInterfaceGuidelineValidator resourceValidator = new VirtualMachineInterfaceGuidelineValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), PATH + "naming_convention/negative_test/input"); @@ -192,7 +192,7 @@ public class VirtualMachineInterfaceGuidelineValidatorTest { NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator(); VirtualMachineInterfaceGuidelineValidator resourceValidator = new VirtualMachineInterfaceGuidelineValidator(); - Map messages = ValidationTestUtil.testValidator(baseValidator, + Map messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator, HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(), PATH + "naming_convention/positive_test/input"); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java index 68ba5c911d..11ed22966c 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java @@ -49,9 +49,9 @@ import org.openecomp.sdc.validation.base.ResourceBaseValidator; */ public class ValidationTestUtil { - private ValidationTestUtil(){} + public ValidationTestUtil(){} - public static GlobalValidationContext createGlobalContextFromPath(String path) { + public GlobalValidationContext createGlobalContextFromPath(String path) { GlobalValidationContext globalValidationContext = new GlobalValidationContext(); Map contentMap = getContentMapByPath(path); if (contentMap == null) { @@ -62,7 +62,7 @@ public class ValidationTestUtil { return globalValidationContext; } - private static Map getContentMapByPath(String path) { + private Map getContentMapByPath(String path) { Map contentMap = new HashMap<>(); URL url = ValidationTestUtil.class.getResource(path); File pathFile = new File(url.getFile()); @@ -89,8 +89,7 @@ public class ValidationTestUtil { return contentMap; } - public static Map testValidator(Validator validator, String path) { - + public Map testValidator(Validator validator, String path) { GlobalValidationContext globalValidationContext = createGlobalContextFromPath(path); validator.validate(globalValidationContext); @@ -100,7 +99,7 @@ public class ValidationTestUtil { } - public static Map testValidator(ResourceBaseValidator baseValidator, + public Map testValidator(ResourceBaseValidator baseValidator, ResourceValidator resourceValidator, String resourceTypeToValidate, String path) { @@ -117,7 +116,7 @@ public class ValidationTestUtil { return globalContext.getContextMessageContainers(); } - private static void validateFiles(ResourceBaseValidator baseValidator, + private void validateFiles(ResourceBaseValidator baseValidator, ResourceValidator resourceValidator, GlobalValidationContext globalContext, Map fileEnvMap, @@ -144,7 +143,7 @@ public class ValidationTestUtil { } } - private static void validateResources(String fileName, ResourceValidator resourceValidator, + private void validateResources(String fileName, ResourceValidator resourceValidator, String resourceTypeToValidate, ValidationContext validationContext, GlobalValidationContext globalValidationContext){ @@ -166,7 +165,7 @@ public class ValidationTestUtil { (fileName, resourceEntry, globalValidationContext, validationContext)); } - private static boolean isResourceNeedToBeTested(String currResource, String resourceToTest){ + private boolean isResourceNeedToBeTested(String currResource, String resourceToTest){ if(Objects.isNull(resourceToTest)){ return HeatStructureUtil.isNestedResource(currResource); } @@ -174,14 +173,13 @@ public class ValidationTestUtil { return currResource.equals(resourceToTest); } - public static void validateErrorMessage(String actualMessage, String expected, String... params) { - + public void validateErrorMessage(String actualMessage, String expected, String... params) { Assert.assertEquals(actualMessage.replace("\n", "").replace("\r", ""), ErrorMessagesFormatBuilder.getErrorWithParameters(expected, params).replace("\n", "") .replace("\r", "")); } - public static Map getResourceMap(String configFileName) throws IOException { + public Map getResourceMap(String configFileName) throws IOException { URL mockResource = ValidationTestUtil.class.getResource(configFileName); String json = IOUtils.toString(mockResource.openStream(), "UTF-8"); return JsonUtil.json2Object(json, Map.class); diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/missingparam/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/missingparam/first.yaml index 0fd281d692..b1bfd9e6e3 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/missingparam/first.yaml +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/missingparam/first.yaml @@ -2,20 +2,11 @@ heat_template_version: 2013-05-23 description: heat expose volume resource -resources: - port_resource_0: - type: OS::Neutron::Port - properties: - network_id: { get_param: Internal1_net_id } -resources: - port_resource_1: - type: OS::Neutron::Port - properties: - network_id: { get_param: Internal1_net_name } resources: port_resource_2: type: OS::Neutron::Port properties: + # required to be 'not a map' to trigger error NNP2 network_id: Internal1_net_fqdn diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/first.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/first.yaml index 12ee08952d..560aa61c68 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/first.yaml +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/heatPortNetworkNamingConvention/positive/first.yaml @@ -7,17 +7,6 @@ resources: type: OS::Neutron::Port properties: network_id: { get_param: Internal1_net_id } -resources: - port_resource_1: - type: OS::Neutron::Port - properties: - network_id: { get_param: Internal1_net_name } -resources: - port_resource_2: - type: OS::Neutron::Port - properties: - network_id: { get_param: Internal1_net_fqdn } - outputs: expose_resource_port_output_0: diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/vlan_validation/modeled_through_resource_group/negative_test/input/main.yml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/vlan_validation/modeled_through_resource_group/negative_test/input/main.yml index 2fc1d1614c..ea28e7fa4e 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/vlan_validation/modeled_through_resource_group/negative_test/input/main.yml +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/vlan_validation/modeled_through_resource_group/negative_test/input/main.yml @@ -65,17 +65,6 @@ resources: - port: { get_resource: template_VMInt_OAM_lb_1 } - port: { get_resource: cmaui_port_2 } - - type: OS::ContrailV2::VirtualMachineInterface - properties: - virtual_machine_interface_properties: - { - virtual_machine_interface_properties_service_interface_type: { get_param: lb_st_interface_type_oam }, - } - virtual_network_refs: [{ get_resource: test_net1 }] - port_tuple_refs: [{ get_param: template_PortTuple_LB1 }] - security_group_refs: [{ get_param: oam_sec_group_name}] - cmaui_port_2: type: OS::Neutron::Port properties: diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/vlan_validation/modeled_through_resource_group/negative_test_non_string/input/main.yml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/vlan_validation/modeled_through_resource_group/negative_test_non_string/input/main.yml index 2fc1d1614c..ea28e7fa4e 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/vlan_validation/modeled_through_resource_group/negative_test_non_string/input/main.yml +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/guideLineValidator/vlan_validation/modeled_through_resource_group/negative_test_non_string/input/main.yml @@ -65,17 +65,6 @@ resources: - port: { get_resource: template_VMInt_OAM_lb_1 } - port: { get_resource: cmaui_port_2 } - - type: OS::ContrailV2::VirtualMachineInterface - properties: - virtual_machine_interface_properties: - { - virtual_machine_interface_properties_service_interface_type: { get_param: lb_st_interface_type_oam }, - } - virtual_network_refs: [{ get_resource: test_net1 }] - port_tuple_refs: [{ get_param: template_PortTuple_LB1 }] - security_group_refs: [{ get_param: oam_sec_group_name}] - cmaui_port_2: type: OS::Neutron::Port properties: diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_multiple_parent_ports/negative_test/input/main.yml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_multiple_parent_ports/negative_test/input/main.yml index 2fc1d1614c..ea28e7fa4e 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_multiple_parent_ports/negative_test/input/main.yml +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_multiple_parent_ports/negative_test/input/main.yml @@ -65,17 +65,6 @@ resources: - port: { get_resource: template_VMInt_OAM_lb_1 } - port: { get_resource: cmaui_port_2 } - - type: OS::ContrailV2::VirtualMachineInterface - properties: - virtual_machine_interface_properties: - { - virtual_machine_interface_properties_service_interface_type: { get_param: lb_st_interface_type_oam }, - } - virtual_network_refs: [{ get_resource: test_net1 }] - port_tuple_refs: [{ get_param: template_PortTuple_LB1 }] - security_group_refs: [{ get_param: oam_sec_group_name}] - cmaui_port_2: type: OS::Neutron::Port properties: diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_multiple_parent_ports/positive_test/input/main.yml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_multiple_parent_ports/positive_test/input/main.yml index 9b0c3ec0eb..ea28e7fa4e 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_multiple_parent_ports/positive_test/input/main.yml +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/vlan_multiple_parent_ports/positive_test/input/main.yml @@ -65,17 +65,6 @@ resources: - port: { get_resource: template_VMInt_OAM_lb_1 } - port: { get_resource: cmaui_port_2 } - - type: OS::ContrailV2::VirtualMachineInterface - properties: - virtual_machine_interface_properties: - { - virtual_machine_interface_properties_service_interface_type: { get_param: lb_st_interface_type_oam }, - } - virtual_network_refs: [{ get_resource: test_net1 }] - port_tuple_refs: [{ get_param: template_PortTuple_LB1 }] - security_group_refs: [{ get_param: oam_sec_group_name}] - cmaui_port_2: type: OS::Neutron::Port properties: diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/pom.xml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/pom.xml index 54b6964bbc..4d2ec69003 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/pom.xml @@ -7,9 +7,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-validation-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/base/ResourceBaseValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/base/ResourceBaseValidator.java index ba23c8b649..a15c7678f7 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/base/ResourceBaseValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/base/ResourceBaseValidator.java @@ -56,7 +56,7 @@ public class ResourceBaseValidator implements Validator { return MapUtils.unmodifiableMap(this.resourceTypeToImpl); } -@Override + @Override public void init(Map properties) { if (MapUtils.isEmpty(properties)) { return; diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/base/ResourceBaseValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/base/ResourceBaseValidatorTest.java index 35a8c00ee9..095df4f859 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/base/ResourceBaseValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/base/ResourceBaseValidatorTest.java @@ -19,97 +19,228 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import org.apache.commons.collections4.MapUtils; +import org.apache.commons.io.IOUtils; import org.junit.jupiter.api.Test; +import org.openecomp.core.utilities.file.FileUtils; +import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder; +import org.openecomp.core.validation.types.GlobalValidationContext; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration; +import org.openecomp.sdc.heat.datatypes.manifest.FileData; +import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent; +import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate; +import org.openecomp.sdc.heat.datatypes.model.Resource; +import org.openecomp.sdc.heat.services.HeatStructureUtil; +import org.openecomp.sdc.heat.services.manifest.ManifestUtil; +import org.openecomp.sdc.validation.ResourceValidator; +import org.openecomp.sdc.validation.ValidationContext; +import org.openecomp.sdc.validation.Validator; import org.openecomp.sdc.validation.type.ConfigConstants; -import org.openecomp.sdc.validation.util.ValidationTestUtil; +import org.openecomp.sdc.validation.util.ValidationUtil; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URL; +import java.util.*; public class ResourceBaseValidatorTest { -private String testValidator = "testValidator"; - - @Test - public void testInvalidResourceType(){ - ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); - Map messages = ValidationTestUtil.testValidator( - resourceBaseValidator, "/InvalidResourceType"); - assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), - "WARNING: [RBV1]: A resource has an invalid or unsupported type - null, " + - "Resource ID [FSB2]"); - } - - @Test - public void testInvalidHeatStructure(){ - ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); - Map messages = ValidationTestUtil.testValidator(resourceBaseValidator, - "/InvalidHeatStructure"); - assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), - "ERROR: [RBV2]: Invalid HEAT format problem - [while scanning for the next " + - "token\n" + "found character '\\t(TAB)' that cannot start any token. " + - "(Do not use \\t(TAB) for indentation)\n" + - " in 'reader', line 10, column 1:\n" + - " \t\t\tresources:\n" + - " ^\n" + - "]"); - } - - @Test - public void testInitWithEmptyPropertiesMap() { - ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); - Map properties = new HashMap<>(); - resourceBaseValidator.init(properties); - - assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); - } - - @Test - public void testInitPropertiesMap() { - ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); - initProperties(resourceBaseValidator, getValidImplementationConfiguration()); - - Map resourceTypeToImpl = - resourceBaseValidator.getResourceTypeToImpl(); - assertTrue(MapUtils.isNotEmpty(resourceTypeToImpl)); - assertTrue(resourceTypeToImpl.containsKey(testValidator)); - } - - @Test - public void testInitPropertiesWithString() { - ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); - Map properties = new HashMap<>(); - properties.put(testValidator, "invalidValue"); - - resourceBaseValidator.init(properties); - - assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); - } - - @Test - public void testInitPropertiesWithoutImplClass() { - ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); - initProperties(resourceBaseValidator, new HashMap<>()); - - assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); - } - - public Map getValidImplementationConfiguration() { - Map implConfiguration = new HashMap<>(); - implConfiguration.put( - ConfigConstants.Impl_Class, "org.openecomp.sdc.validation.impl.validators.ForbiddenResourceGuideLineValidator"); - implConfiguration.put(ConfigConstants.Enable, true); - - return implConfiguration; - } - - private void initProperties(ResourceBaseValidator resourceBaseValidator, - Map implementationConfiguration) { - Map properties = - Collections.singletonMap(testValidator, implementationConfiguration); - - resourceBaseValidator.init(properties); - } + private String testValidator = "testValidator"; + + @Test + public void testInvalidResourceType() { + ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); + Map messages = testValidator(resourceBaseValidator, "/InvalidResourceType"); + assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), + "WARNING: [RBV1]: A resource has an invalid or unsupported type - null, Resource ID [FSB2]"); + } + + @Test + public void testInvalidHeatStructure() { + ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); + Map messages = testValidator(resourceBaseValidator, "/InvalidHeatStructure"); + assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), + "ERROR: [RBV2]: Invalid HEAT format problem - [while scanning for the next " + + "token\n" + "found character '\\t(TAB)' that cannot start any token. " + + "(Do not use \\t(TAB) for indentation)\n" + + " in 'reader', line 10, column 1:\n" + + " \t\t\tresources:\n" + + " ^\n" + + "]"); + } + + @Test + public void testInitWithEmptyPropertiesMap() { + ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); + Map properties = new HashMap<>(); + resourceBaseValidator.init(properties); + assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); + } + + @Test + public void testInitPropertiesMap() { + ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); + initProperties(resourceBaseValidator, getValidImplementationConfiguration()); + + Map resourceTypeToImpl = resourceBaseValidator.getResourceTypeToImpl(); + assertTrue(MapUtils.isNotEmpty(resourceTypeToImpl)); + assertTrue(resourceTypeToImpl.containsKey(testValidator)); + } + + @Test + public void testInitPropertiesWithString() { + ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); + Map properties = new HashMap<>(); + properties.put(testValidator, "invalidValue"); + resourceBaseValidator.init(properties); + assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); + } + + @Test + public void testInitPropertiesWithoutImplClass() { + ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); + initProperties(resourceBaseValidator, new HashMap<>()); + assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); + } + + public Map getValidImplementationConfiguration() { + Map implConfiguration = new HashMap<>(); + implConfiguration.put(ConfigConstants.Impl_Class, "org.openecomp.sdc.validation.impl.validators.ForbiddenResourceGuideLineValidator"); + implConfiguration.put(ConfigConstants.Enable, true); + + return implConfiguration; + } + + private void initProperties(ResourceBaseValidator resourceBaseValidator, Map implementationConfiguration) { + Map properties = Collections.singletonMap(testValidator, implementationConfiguration); + resourceBaseValidator.init(properties); + } + + public GlobalValidationContext createGlobalContextFromPath(String path) { + GlobalValidationContext globalValidationContext = new GlobalValidationContext(); + Map contentMap = getContentMapByPath(path); + if (contentMap == null) { + return null; + } + contentMap.forEach(globalValidationContext::addFileContext); + + return globalValidationContext; + } + + private Map getContentMapByPath(String path) { + Map contentMap = new HashMap<>(); + URL url = ResourceBaseValidator.class.getResource(path); + File pathFile = new File(url.getFile()); + File[] files; + if (pathFile.isDirectory()) { + files = pathFile.listFiles(); + } else { + files = new File[]{pathFile}; + } + + if (files == null || files.length == 0) { + return null; + } + + for (File file : files) { + + try (FileInputStream fis = new FileInputStream(file)) { + contentMap.put(file.getName(), FileUtils.toByteArray(fis)); + } catch (IOException e) { + throw new RuntimeException("Failed to read file: " + file, e); + } + + } + return contentMap; + } + + public Map testValidator(Validator validator, String path) { + GlobalValidationContext globalValidationContext = createGlobalContextFromPath(path); + validator.validate(globalValidationContext); + + assert globalValidationContext != null; + return globalValidationContext.getContextMessageContainers(); + } + + public Map testValidator(ResourceBaseValidator baseValidator, + ResourceValidator resourceValidator, + String resourceTypeToValidate, String path) { + + GlobalValidationContext globalContext = Objects.requireNonNull( + createGlobalContextFromPath(path), "Global validation context cannot be null"); + + ManifestContent manifestContent = ValidationUtil.validateManifest(globalContext); + Map fileTypeMap = ManifestUtil.getFileTypeMap(manifestContent); + Map fileEnvMap = ManifestUtil.getFileAndItsEnv(manifestContent); + + validateFiles(baseValidator, resourceValidator, globalContext, fileEnvMap, fileTypeMap, + resourceTypeToValidate); + + return globalContext.getContextMessageContainers(); + } + + private void validateFiles(ResourceBaseValidator baseValidator, + ResourceValidator resourceValidator, + GlobalValidationContext globalContext, + Map fileEnvMap, + Map fileTypeMap, + String resourceTypeToValidate) { + + Collection files = globalContext.getFiles(); + for (String fileName : files) { + if (FileData.isHeatFile(fileTypeMap.get(fileName))) { + HeatOrchestrationTemplate heatOrchestrationTemplate = + ValidationUtil.checkHeatOrchestrationPreCondition(fileName, globalContext); + + if (Objects.isNull(heatOrchestrationTemplate)) { + continue; + } + + ValidationContext validationContext = baseValidator.createValidationContext(fileName, + fileEnvMap.get(fileName) == null ? null : fileEnvMap.get(fileName).getFile(), + heatOrchestrationTemplate, globalContext); + + validateResources(fileName, resourceValidator, resourceTypeToValidate, validationContext, + globalContext); + } + } + } + + private void validateResources(String fileName, ResourceValidator resourceValidator, + String resourceTypeToValidate, ValidationContext validationContext, + GlobalValidationContext globalValidationContext) { + + HeatOrchestrationTemplate heatOrchestrationTemplate = + ValidationUtil.checkHeatOrchestrationPreCondition(fileName, globalValidationContext); + + Map resourcesMap = + Objects.requireNonNull(heatOrchestrationTemplate, "Orchestration template cannot be null").getResources(); + + if (MapUtils.isEmpty(resourcesMap)) { + return; + } + + resourcesMap.entrySet() + .stream() + .filter(resourceEntry -> isResourceNeedToBeTested(resourceEntry.getValue().getType(), resourceTypeToValidate)) + .forEach(resourceEntry -> + resourceValidator.validate + (fileName, resourceEntry, globalValidationContext, validationContext)); + } + + private boolean isResourceNeedToBeTested(String currResource, String resourceToTest) { + if (Objects.isNull(resourceToTest)) { + return HeatStructureUtil.isNestedResource(currResource); + } + + return currResource.equals(resourceToTest); + } + + public void validateErrorMessage(String actualMessage, String expected, String... params) { + assertEquals(actualMessage.replace("\n", "").replace("\r", ""), + ErrorMessagesFormatBuilder.getErrorWithParameters(expected, params).replace("\n", "") + .replace("\r", "")); + } + } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/pom.xml b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/pom.xml index 69d26f9d02..54fffa0355 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/pom.xml @@ -7,9 +7,8 @@ openecomp-sdc-vendor-license-api org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-vendor-license-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml index b6603df0f6..bb0c581ade 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/pom.xml @@ -9,9 +9,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-vendor-license-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml index ed629ec753..ecaea75df3 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/pom.xml @@ -12,11 +12,9 @@ 1.8.1-SNAPSHOT - openecomp-sdc-vendor-software-product-api openecomp-sdc-vendor-software-product-core - diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml index d948c2931e..526d27adfa 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/pom.xml @@ -23,9 +23,8 @@ openecomp-sdc-versioning-api org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-versioning-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml index 77d4b778a7..3347fb3fc7 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/pom.xml @@ -9,9 +9,8 @@ org.openecomp.sdc - openecomp-sdc-lib + openecomp-sdc-versioning-lib 1.8.1-SNAPSHOT - ../.. diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/pom.xml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/pom.xml index 1292586816..1853916aab 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/pom.xml +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/pom.xml @@ -9,16 +9,6 @@ onap-tosca-datatype ${project.version} - - org.openecomp.sdc.core - openecomp-tosca-lib - ${project.version} - - - org.openecomp.sdc.core - openecomp-facade-core - ${project.version} - diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml index eba914a79b..9d63529c72 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml @@ -9,16 +9,6 @@ openecomp-tosca-converter-api ${project.version} - - org.openecomp.sdc.core - openecomp-tosca-lib - ${project.version} - - - org.openecomp.sdc.core - openecomp-facade-core - ${project.version} - org.openecomp.sdc openecomp-sdc-translator-core diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/pnfd/PnfTransformationEngineParameterizedTest.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/pnfd/PnfTransformationEngineParameterizedTest.java index 1eb09a8b44..dfca19b96e 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/pnfd/PnfTransformationEngineParameterizedTest.java +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/pnfd/PnfTransformationEngineParameterizedTest.java @@ -19,7 +19,13 @@ package org.openecomp.core.converter.impl.pnfd; -import static org.junit.Assert.assertEquals; +import org.junit.Test; +import org.onap.sdc.tosca.datatypes.model.ServiceTemplate; +import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil; +import org.onap.sdc.tosca.services.YamlUtil; +import org.openecomp.core.converter.ServiceTemplateReaderService; +import org.openecomp.core.converter.pnfd.PnfdTransformationEngine; +import org.openecomp.core.impl.services.ServiceTemplateReaderServiceImpl; import java.io.IOException; import java.io.InputStream; @@ -31,20 +37,11 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; -import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.onap.sdc.tosca.datatypes.model.ServiceTemplate; -import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil; -import org.onap.sdc.tosca.services.YamlUtil; -import org.openecomp.core.converter.ServiceTemplateReaderService; -import org.openecomp.core.converter.pnfd.PnfdTransformationEngine; -import org.openecomp.core.impl.services.ServiceTemplateReaderServiceImpl; -@RunWith(Parameterized.class) +import static org.junit.Assert.assertEquals; + public class PnfTransformationEngineParameterizedTest { private static final String TEST_CASES_PATH = "transformation/pnfParseEngine"; @@ -52,38 +49,9 @@ public class PnfTransformationEngineParameterizedTest { private static final String OUTPUT_FOLDER = "expectedOutput"; private static final String DEFAULT_OUTPUT_FILE_NAME = "defaultOutput.yaml"; - private final String inputFileName; - private final Path inputFilePath; - private final String outputFileName; - private final Path outputFilePath; - private final String transformationDescriptorFileName; - private final Path transformationDescriptorFilePath; private final YamlUtil yamlUtil = new YamlUtil(); private final ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil(); - public PnfTransformationEngineParameterizedTest(final String inputFileName, final Path inputFilePath, - final String outputFileName, final Path outputFilePath, - final String transformationDescriptorFileName, final Path transformationDescriptorFilePath) { - this.inputFileName = inputFileName; - this.inputFilePath = inputFilePath; - this.outputFileName = outputFileName; - this.outputFilePath = outputFilePath; - this.transformationDescriptorFileName = transformationDescriptorFileName; - this.transformationDescriptorFilePath = transformationDescriptorFilePath; - } - - - @Parameterized.Parameters(name = "{index}: input: {0}, descriptor: {4}, output: {2}") - public static Collection input() throws IOException, URISyntaxException { - return Files.list(getPathFromClasspath(TEST_CASES_PATH)).map(path -> { - try { - return buildTestCase(path); - } catch (final IOException e) { - return null; - } - }).filter(Objects::nonNull).flatMap(Collection::stream).collect(Collectors.toList()); - } - private static Collection buildTestCase(final Path testCasePath) throws IOException { final Path inputFilePath = Files.list(testCasePath) .filter(path -> path.toFile().getName().endsWith("yaml")) @@ -94,7 +62,7 @@ public class PnfTransformationEngineParameterizedTest { } final List transformationDescriptorList; try (final Stream files = Files.walk(testCasePath.resolve(TRANSFORMATION_DESCRIPTOR_FOLDER))) { - transformationDescriptorList = files.filter(path -> Files.isRegularFile(path)) + transformationDescriptorList = files.filter(Files::isRegularFile) .map(path -> Paths.get(TEST_CASES_PATH, testCasePath.getFileName().toString() , TRANSFORMATION_DESCRIPTOR_FOLDER, path.getFileName().toString())) .collect(Collectors.toList()); @@ -102,7 +70,7 @@ public class PnfTransformationEngineParameterizedTest { final List outputList; try (final Stream files = Files.walk(testCasePath.resolve(OUTPUT_FOLDER))) { - outputList = files.filter(path -> Files.isRegularFile(path)).collect(Collectors.toList()); + outputList = files.filter(Files::isRegularFile).collect(Collectors.toList()); } final Path defaultOutput = outputList.stream() .filter(path -> path.toFile().getName().equals(DEFAULT_OUTPUT_FILE_NAME)) @@ -115,29 +83,38 @@ public class PnfTransformationEngineParameterizedTest { .filter(path -> path.toFile().getName().equals(transformationDescriptorPath.toFile().getName())) .findFirst().orElse(defaultOutput); if (outputPath != null) { - testCaseList.add(new Object[] {inputFilePath.toFile().getName(), inputFilePath, - outputPath.toFile().getName(), outputPath, - transformationDescriptorPath.toFile().getName(), transformationDescriptorPath}); + testCaseList.add(new Object[]{ inputFilePath, outputPath, transformationDescriptorPath}); } } - return testCaseList; - } @Test - public void testTopologyTemplateConversions() throws IOException { - final byte[] descriptor = Files.readAllBytes(inputFilePath); - final ServiceTemplateReaderService serviceTemplateReaderService = new ServiceTemplateReaderServiceImpl(descriptor); - final ServiceTemplate serviceTemplate = new ServiceTemplate(); - - final PnfdTransformationEngine pnfdTransformationEngine = new PnfdNodeTemplateTransformationEngine( - serviceTemplateReaderService, serviceTemplate, transformationDescriptorFilePath.toString()); - pnfdTransformationEngine.transform(); - - final String result = yamlUtil.objectToYaml(serviceTemplate); - final String expectedResult = parseToYaml(outputFilePath); - assertEquals(expectedResult, result); + public void testTopologyTemplateConversions() throws IOException, URISyntaxException { + Files.list(getPathFromClasspath()).forEach(testCasePath -> { + try { + var paths = buildTestCase(testCasePath); + paths.forEach(p -> { + try { + final ServiceTemplateReaderService serviceTemplateReaderService = new ServiceTemplateReaderServiceImpl(Files.readAllBytes((Path) p[0])); + final ServiceTemplate serviceTemplate = new ServiceTemplate(); + + final PnfdTransformationEngine pnfdTransformationEngine = new PnfdNodeTemplateTransformationEngine( + serviceTemplateReaderService, serviceTemplate, p[2].toString()); + pnfdTransformationEngine.transform(); + + final String result = yamlUtil.objectToYaml(serviceTemplate); + final String expectedResult = parseToYaml((Path) p[1]); + assertEquals(expectedResult, result); + } catch (IOException e) { + e.printStackTrace(); + } + }); + } catch (Exception e) { + e.printStackTrace(); + } + } + ); } private String parseToYaml(final Path filePath) throws IOException { @@ -147,7 +124,7 @@ public class PnfTransformationEngineParameterizedTest { } } - private static Path getPathFromClasspath(final String location) throws URISyntaxException { - return Paths.get(PnfTransformationEngineParameterizedTest.class.getClassLoader().getResource(location).toURI()); + private static Path getPathFromClasspath() throws URISyntaxException { + return Paths.get(PnfTransformationEngineParameterizedTest.class.getClassLoader().getResource(PnfTransformationEngineParameterizedTest.TEST_CASES_PATH).toURI()); } } \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/pom.xml b/openecomp-be/lib/openecomp-tosca-converter-lib/pom.xml index 843923aa12..24a0866208 100644 --- a/openecomp-be/lib/openecomp-tosca-converter-lib/pom.xml +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/pom.xml @@ -18,5 +18,16 @@ openecomp-tosca-converter-core - + + + org.openecomp.sdc.core + openecomp-tosca-lib + ${project.version} + + + org.openecomp.sdc.core + openecomp-facade-core + ${project.version} + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5766496010..b917838f88 100644 --- a/pom.xml +++ b/pom.xml @@ -78,7 +78,7 @@ Modifications copyright (c) 2018-2019 Nokia false - 1.14 + 1.26 4.7 4.5.3 4.4.1 diff --git a/utils/DmaapPublisher/pom.xml b/utils/DmaapPublisher/pom.xml index 73ad30341c..f0756c576c 100644 --- a/utils/DmaapPublisher/pom.xml +++ b/utils/DmaapPublisher/pom.xml @@ -50,7 +50,7 @@ org.yaml snakeyaml - 1.18 + ${snakeyaml.version} org.assertj -- cgit 1.2.3-korg