Upgrade Vulnerable Direct Dependencies [snakeyaml]
Change-Id: I84417ab3d4f18634be519b837a34d1f1e774ceff
Signed-off-by: amohamad <a.mohamad@queensu.ca>
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 <a.mohamad@queensu.ca>
Signed-off-by: JulienBe <julien.bertozzi@intl.att.com>
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 6c70e93..d2a8033 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 @@
public class UnsortedPropertyUtils extends PropertyUtils {
@Override
- protected Set<Property> createPropertySet(final Class clazz, final BeanAccess beanAccess) throws IntrospectionException {
+ protected Set<Property> createPropertySet(final Class clazz, final BeanAccess beanAccess) {
final Collection<Property> 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 ddea498..97b113e 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 @@
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 @@
private static class UnsortedPropertyUtils extends PropertyUtils {
@Override
- protected Set<Property> createPropertySet(Class type, BeanAccess bAccess)
- throws IntrospectionException {
+ protected Set<Property> createPropertySet(Class type, BeanAccess bAccess) {
Collection<Property> 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 570d48b..a79c13d 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 @@
<artifactId>onap-generic-artifact-browser-service</artifactId>
<properties>
- <snakeyaml.version>1.21</snakeyaml.version>
<jsurfer.version>1.4.3</jsurfer.version>
<jacoco.skip>false</jacoco.skip>
</properties>
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 0000000..466d669
--- /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<Property> createPropertySet(Class<? extends Object> 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 0000000..7babd42
--- /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<Object, Object> createDefaultMap(int initSize) {
+ final Map<Object, Object> 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<Entry<Object, Object>> entrySet() {
+ return delegate.entrySet();
+ }
+ };
+ }
+
+ @Override
+ protected Map<Object, Object> 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 45499d1..37d8411 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 ToscaPropertyUtilsWithHeatExtension extends MyPropertyUtils {
@Override
- public Property getProperty(Class<? extends Object> type, String name) throws IntrospectionException {
+ public Property getProperty(Class<? extends Object> type, String name) {
Class<? extends Object> 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 4ac60d4..8530846 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 @@
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";
+ static final String DEFAULT = "default";
+ static final String DEFAULT_STR = "_default";
- /**
- * Yaml to object t.
- *
- * @param <T> the type parameter
- * @param yamlContent the yaml content
- * @param typClass the t class
- * @return the t
- */
- public <T> T yamlToObject(String yamlContent, Class<T> 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;
- }
-
- public InputStream loadYamlFileIs(String yamlFullFileName) {
- return YamlUtil.class.getResourceAsStream(yamlFullFileName);
- }
-
- /**
- * Yaml to object t.
- *
- * @param <T> the type parameter
- * @param yamlContent the yaml content
- * @param typClass the t class
- * @return the t
- */
- public <T> T yamlToObject(InputStream yamlContent, Class<T> 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 <T> the type parameter
+ * @param yamlContent the yaml content
+ * @param typClass the t class
+ * @return the t
+ */
+ public <T> T yamlToObject(String yamlContent, Class<T> 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();
- }
- } catch (IOException ignore) {
- //do nothing
- }
}
- }
+
+ public InputStream loadYamlFileIs(String yamlFullFileName) {
+ return YamlUtil.class.getResourceAsStream(yamlFullFileName);
+ }
+
+ /**
+ * Yaml to object t.
+ *
+ * @param <T> the type parameter
+ * @param yamlContent the yaml content
+ * @param typClass the t class
+ * @return the t
+ */
+ public <T> T yamlToObject(InputStream yamlContent, Class<T> 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
+ }
+ }
+ }
+
+ private LoaderOptions getLoaderOptions() {
+ LoaderOptions options = new LoaderOptions();
+ options.setAllowDuplicateKeys(false);
+ options.setMaxAliasesForCollections(9999);
+ return options;
+ }
- /**
- * Gets constructor.
- *
- * @param <T> the type parameter
- * @param typClass the t class
- * @return the constructor
- */
- public <T> Constructor getConstructor(Class<T> typClass) {
- return new StrictMapAppenderConstructor(typClass);
- }
+ /**
+ * Gets constructor.
+ *
+ * @param <T> the type parameter
+ * @param typClass the t class
+ * @return the constructor
+ */
+ public <T> Constructor getConstructor(Class<T> typClass) {
+ return new StrictMapAppenderConstructor(typClass);
+ }
- /**
- * Gets property utils.
- *
- * @return the property utils
- */
- protected PropertyUtils getPropertyUtils() {
- return new MyPropertyUtils();
- }
+ /**
+ * 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<String, LinkedHashMap<String, Object>> yamlToMap(InputStream yamlContent) {
- Yaml yaml = new Yaml();
- return (Map<String, LinkedHashMap<String, Object>>) yaml.load(yamlContent);
- }
+ /**
+ * Yaml to map map.
+ *
+ * @param yamlContent the yaml content
+ * @return the map
+ */
+ public Map<String, LinkedHashMap<String, Object>> yamlToMap(InputStream yamlContent) {
+ return new Yaml().load(yamlContent);
+ }
/**
@@ -172,137 +169,66 @@
* @return The YAML Object
*/
public static Object read(final InputStream yamlFileInputStream) {
- final Yaml yaml = new Yaml();
- return yaml.load(yamlFileInputStream);
+ return new 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<Property> 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<Property> createPropertySet(Class<? extends Object> type, BeanAccess bnAccess)
- throws IntrospectionException {
- return new LinkedHashSet<>(getPropertiesMap(type,
- BeanAccess.FIELD).values());
- }
-
- @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);
- }
-
- }
-
- /**
- * The type Strict map appender constructor.
- */
- protected class StrictMapAppenderConstructor extends Constructor {
-
/**
- * Instantiates a new Strict map appender constructor.
+ * Object to yaml string.
*
- * @param theRoot the the root
+ * @param obj the obj
+ * @return the string
*/
- public StrictMapAppenderConstructor(Class<?> theRoot) {
- super(theRoot);
+ 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);
}
- @Override
- protected Map<Object, Object> createDefaultMap() {
- final Map<Object, Object> delegate = super.createDefaultMap();
- return new AbstractMap<Object, Object>() {
+ /**
+ * Is yaml file content valid boolean.
+ *
+ * @param yamlFullFileName the yaml full file name
+ * @return the boolean
+ */
+ public boolean isYamlFileContentValid(String yamlFullFileName) {
+ try {
+ return new Yaml().load(yamlFullFileName) != null;
+ } catch (Exception exception) {
+ return false;
+ }
+ }
+
+
+ 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<Property> 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<Entry<Object, Object>> 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);
- @Override
- protected Map<Object, Object> constructMapping(MappingNode node) {
- try {
- return super.constructMapping(node);
- } catch (IllegalStateException exception) {
- throw new ParserException("while parsing MappingNode",
- node.getStartMark(), exception.getMessage(),
- node.getEndMark());
- }
+ return DEFAULT_STR.equals(property.getName())
+ ? new NodeTuple(representData(DEFAULT), defaultNode.getValueNode())
+ : defaultNode;
+ }
+ }
}
- }
}
diff --git a/onboarding/pom.xml b/onboarding/pom.xml
index b5fb0e2..3bb2105 100644
--- a/onboarding/pom.xml
+++ b/onboarding/pom.xml
@@ -97,7 +97,6 @@
<org.reflections.version>0.9.10</org.reflections.version>
<servlet.version>2.5</servlet.version>
<slf4j.version>1.7.21</slf4j.version>
- <snakeyaml.version>1.17</snakeyaml.version>
<spring.framework.version>4.3.18.RELEASE</spring.framework.version>
<swagger.version>2.0.8</swagger.version>
<woodstox.version>4.4.1</woodstox.version>
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 e41cc0b..0b8fa75 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 @@
<groupId>org.openecomp.sdc.onboarding</groupId>
<artifactId>action-library-rest</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../</relativePath>
</parent>
<dependencies>
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 a376807..a8973c8 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 @@
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-rest-webapp</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../</relativePath>
</parent>
<modules>
<module>/action-library-rest-services</module>
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 9f3c3e7..3cc19ab 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc</artifactId>
- <relativePath>../../..</relativePath>
+ <artifactId>openecomp-sdc-rest-webapp</artifactId>
<version>1.8.1-SNAPSHOT</version>
</parent>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/pom.xml
index 487378b..48ef428 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 @@
</parent>
<modules>
- <module>/openecomp-sdc-common-rest</module>
- <module>/vendor-license-rest</module>
- <module>/onboarding-rest-war</module>
- <module>/vendor-software-products-rest</module>
- <module>/validation-rest</module>
- <module>/action-library-rest</module>
- <module>/application-config-rest</module>
- <module>/healthcheck-rest</module>
+ <module>openecomp-sdc-common-rest</module>
+ <module>vendor-license-rest</module>
+ <module>onboarding-rest-war</module>
+ <module>vendor-software-products-rest</module>
+ <module>validation-rest</module>
+ <module>action-library-rest</module>
+ <module>application-config-rest</module>
+ <module>healthcheck-rest</module>
<module>conflict-rest</module>
<module>item-permissions-rest</module>
<module>item-rest</module>
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 be8480f..5af20da 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 @@
<groupId>org.openecomp.sdc.onboarding</groupId>
<artifactId>validation-rest</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../</relativePath>
</parent>
<dependencies>
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 f00b8da..a3e7435 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 @@
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-rest-webapp</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../</relativePath>
</parent>
<modules>
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 25e4031..1700e95 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 @@
<groupId>org.openecomp.sdc.onboarding</groupId>
<artifactId>vendor-license-rest</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../</relativePath>
</parent>
<properties>
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 f9b76c7..1df2e81 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 @@
<groupId>org.openecomp.sdc.onboarding</groupId>
<artifactId>vendor-license-rest</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../</relativePath>
</parent>
<dependencies>
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 721a839..fd030a9 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 @@
<groupId>org.openecomp.sdc.onboarding</groupId>
<artifactId>vendor-software-products-rest</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../</relativePath>
</parent>
<dependencies>
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 2053373..33a558e 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 @@
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 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 @@
final List<ErrorMessage> 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<String, List<ErrorMessage>> actualErrorMap = sol004MetaDirectoryValidator
- .validateContent(handler);
+ final Map<String, List<ErrorMessage>> actualErrorMap = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList);
}
@@ -1253,22 +1236,6 @@
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList);
}
- protected void assertExpectedErrors(List<ErrorMessage> actualErrorList, final List<ErrorMessage> 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<String, List<ErrorMessage>> errors, final int expectedErrors){
final List<ErrorMessage> errorMessages = errors.get(SdcCommon.UPLOAD_FILE);
printErrorMessages(errorMessages);
@@ -1287,4 +1254,25 @@
}
}
+ private void assertExpectedErrors(List<ErrorMessage> actualErrorList, final List<ErrorMessage> 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<ErrorMessage> 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 ae6ea77..9fa74e6 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 @@
<name>openecomp-facade-api</name>
<artifactId>openecomp-facade-api</artifactId>
- <groupId>org.openecomp.sdc.core</groupId>
<parent>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <groupId>org.openecomp.sdc.core</groupId>
+ <artifactId>openecomp-facade-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../../../</relativePath>
</parent>
<dependencies>
-
<dependency>
<groupId>org.openecomp.sdc.core</groupId>
<artifactId>openecomp-utilities-lib</artifactId>
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 b45af10..25b682a 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 @@
<artifactId>openecomp-facade-core</artifactId>
<name>openecomp-facade-core</name>
- <groupId>org.openecomp.sdc.core</groupId>
<parent>
- <artifactId>openecomp-sdc-lib</artifactId>
- <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-facade-lib</artifactId>
+ <groupId>org.openecomp.sdc.core</groupId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../../..</relativePath>
</parent>
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 f892ddb..3d3e35a 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 @@
<name>openecomp-facade-lib</name>
<artifactId>openecomp-facade-lib</artifactId>
-
<packaging>pom</packaging>
+
<parent>
<artifactId>openecomp-core-lib</artifactId>
<groupId>org.openecomp.sdc.core</groupId>
@@ -17,18 +17,4 @@
<module>openecomp-facade-core</module>
</modules>
- <dependencies>
- <dependency>
- <groupId>org.openecomp.sdc.core</groupId>
- <artifactId>openecomp-facade-api</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc.core</groupId>
- <artifactId>openecomp-facade-core</artifactId>
- <version>${project.version}</version>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
</project>
\ 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 3a48db6..bd3f421 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 @@
<module>openecomp-nosqldb-api</module>
<module>openecomp-nosqldb-core</module>
</modules>
-
</project>
\ 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 6329060..48a4ef1 100644
--- a/openecomp-be/lib/openecomp-core-lib/pom.xml
+++ b/openecomp-be/lib/openecomp-core-lib/pom.xml
@@ -14,11 +14,11 @@
</parent>
<modules>
- <module>/openecomp-facade-lib</module>
- <module>/openecomp-nosqldb-lib</module>
- <module>/openecomp-utilities-lib</module>
- <module>/openecomp-config-lib</module>
- <module>/openecomp-zusammen-lib</module>
- <module>/openecomp-session-lib</module>
+ <module>openecomp-facade-lib</module>
+ <module>openecomp-nosqldb-lib</module>
+ <module>openecomp-utilities-lib</module>
+ <module>openecomp-config-lib</module>
+ <module>openecomp-zusammen-lib</module>
+ <module>openecomp-session-lib</module>
</modules>
</project>
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 a96fe63..0dc9aa1 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-enrichment-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 639f8f5..a0d7937 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-enrichment-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 351e163..c35bbc1 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-enrichment-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 a34f691..cf9ec3c 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 @@
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 @@
}
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 b1158dc..a8ca199 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 @@
<module>openecomp-sdc-enrichment-core</module>
<module>openecomp-sdc-enrichment-impl</module>
</modules>
-
- <dependencies>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-enrichment-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-enrichment-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-vendor-software-product-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!--dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-validation-impl</artifactId>
- <version>${project.version}</version>
- </dependency-->
- </dependencies>
</project>
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 30dc51c..8215b1c 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-externaltesting-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 a4b0b37..c5df0fc 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-externaltesting-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 2facd82..9860f0b 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 @@
<name>openecomp-sdc-model-api</name>
<artifactId>openecomp-sdc-model-api</artifactId>
-
- <parent>
+ <parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-model-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
@@ -22,11 +20,6 @@
</dependency>
<dependency>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-validation-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-versioning-core</artifactId>
<version>${project.version}</version>
</dependency>
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 2b9394d..b4e50cb 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-model-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml b/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml
index 05a0ea2..b25336f 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 @@
<module>openecomp-sdc-model-api</module>
<module>openecomp-sdc-model-impl</module>
</modules>
-
- <dependencies>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-model-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-model-impl</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
</project>
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 b49317c..dd48be3 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 @@
<artifactId>openecomp-sdc-notification-api</artifactId>
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-notification-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
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 c9eede9..05654aa 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-notification-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
<dependency>
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 b0c4a49..ab0f6b0 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-notification-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 f569d9e..a4f7566 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-notification-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 dde9352..2468b2b 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-tosca-generator-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 8840c46..ff17a1a 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-tosca-generator-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 8229262..b8d348b 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-translator-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 f523b7e..94abe98 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-translator-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 703fa0d..f65b0bb 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 @@
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 @@
}
}
+ private static String sanitize(String s) {
+ return s.trim().replaceAll("\n", "").replaceAll("\r", "").replaceAll("\\s{2,}", " ").trim();
+ }
+
public static String getErrorAsString(Map<String, List<ErrorMessage>> 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 d73bbef..2ebfeaf 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 @@
- 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 8a3eb21..ea29e3d 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 @@
- 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 d006cc9..16aa486 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 @@
- 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 9e3d82d..314f49d 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 @@
- 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 0e58aeb..b2273d1 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 @@
- 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 dd5a477..bdb212a 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 @@
- 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 a4e5814..f28ddc5 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 @@
- 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 1ddd292..6caa016 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 @@
- 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 2a5fcb1..c46e8e1 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 @@
- 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 8095b88..54be7c3 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 @@
- 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 3561f35..1213eb8 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 @@
- 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 cf09f4b..4ec4072 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 @@
- 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 ea845e8..39490da 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 @@
- 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 d575e26..2efbf74 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 @@
- 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 1086507..afe89ba 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 @@
- 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 22a9564..39e5360 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 @@
- 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 d9fb652..8e317f8 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 @@
- 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 43335d6..409d682 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 @@
- 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 d850213..e1e59f5 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 @@
- 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 b2c73f9..240a684 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 @@
- 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 79665df..ab5c35a 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-validation-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 0d69912..b25581f 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-validation-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 2f5a8ce..a25b8ae 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.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 @@
public class ValidationManagerImpl implements ValidationManager {
- private static Logger logger = (Logger) LoggerFactory.getLogger(ValidationManagerImpl.class);
-
private GlobalValidationContext globalContext;
private List<Validator> 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 8dfea9e..abf4fb3 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-validation-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 b11ff5e..c433c3e 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.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.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<String> pmDictionaryFiles = GlobalContextUtil.findPmDictionaryFiles(globalContext);
+ @Override
+ public void validate(GlobalValidationContext globalContext) {
+ Set<String> pmDictionaryFiles = GlobalContextUtil.findPmDictionaryFiles(globalContext);
- Collection<String> files = globalContext.files(
- (fileName, globalValidationContext) -> FileExtensionUtils.isYaml(fileName)
- && !pmDictionaryFiles.contains(fileName));
+ Collection<String> 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<InputStream> 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<InputStream> 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 */
+ }
- globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder
- .getErrorWithParameters(ERROR_CODE_YML_2, Messages
- .INVALID_YAML_FORMAT_REASON.getErrorMessage(),
- YamlValidatorUtil.getParserExceptionReason(exception)));
+ 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);
+
+ 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> T convert(InputStream content, Class<T> 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 b3d3461..760c73a 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.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");
+ 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<String, Resource> 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;
- }
- 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;
+ @Override
+ public void validate(String fileName, Map.Entry<String, Resource> resourceEntry,
+ GlobalValidationContext globalContext, ValidationContext validationContext) {
+ NamingConventionValidationContext namingConventionValidationContext = (NamingConventionValidationContext) validationContext;
+ validatePortNetworkNamingConvention(fileName, namingConventionValidationContext.getHeatOrchestrationTemplate(), globalContext);
+ validateFixedIpsNamingConvention(fileName, namingConventionValidationContext.getHeatOrchestrationTemplate(), 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 validatePortNetworkNamingConvention(String fileName,
+ HeatOrchestrationTemplate heatOrchestrationTemplate,
+ GlobalValidationContext globalContext) {
+ if (MapUtils.isEmpty(heatOrchestrationTemplate.getResources())) {
+ return;
+ }
+ String[] regexList = {".*_net_id", ".*_net_name", ".*_net_fqdn"};
- private void checkNeutronPortFixedIpsName(String fileName,
- Map.Entry<String, Resource> 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;
+ 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)));
}
- Map<String, Object> propertiesMap = resourceEntry.getValue().getProperties();
- Object fixedIps = propertiesMap.get("fixed_ips");
- if (nonNull(fixedIps) && fixedIps instanceof List) {
- List<Object> fixedIpsList = (List<Object>) fixedIps;
- for (Object fixedIpsObject : fixedIpsList) {
- Map.Entry<String, Object> fixedIpsEntry =
- ((Map<String, Object>) fixedIpsObject).entrySet().iterator().next();
-
- validateFixedIpsName(fileName, resourceEntry, globalContext, regexList, fixedIpsEntry);
-
-
- }
- }
- }
-
- private void validateFixedIpsName(String fileName, Map.Entry<String, Resource> resourceEntry,
- GlobalValidationContext globalContext,
- String[] regexList, Map.Entry<String, Object> 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 validateFixedIpsNamingConvention(String fileName,
+ HeatOrchestrationTemplate heatOrchestrationTemplate,
+ GlobalValidationContext globalContext) {
+ if (MapUtils.isEmpty(heatOrchestrationTemplate.getResources())) {
+ return;
}
- } else {
- globalContext.addMessage(
- fileName,
- ErrorLevel.WARNING,
- ErrorMessagesFormatBuilder
- .getErrorWithParameters(
- ERROR_CODE_NNP2, Messages.MISSING_GET_PARAM.getErrorMessage(),
- "network or network_id", resourceId));
+ 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<String, Resource> 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<String, Object> propertiesMap = resourceEntry.getValue().getProperties();
+ Object fixedIps = propertiesMap.get("fixed_ips");
+ if (nonNull(fixedIps) && fixedIps instanceof List) {
+ List<Object> fixedIpsList = (List<Object>) fixedIps;
+ for (Object fixedIpsObject : fixedIpsList) {
+ Map.Entry<String, Object> fixedIpsEntry = ((Map<String, Object>) fixedIpsObject).entrySet().iterator().next();
+ validateFixedIpsName(fileName, resourceEntry, globalContext, regexList, fixedIpsEntry);
+ }
+ }
+ }
+
+ private void validateFixedIpsName(String fileName, Map.Entry<String, Resource> resourceEntry, GlobalValidationContext globalContext,
+ String[] regexList, Map.Entry<String, Object> 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) {
+ 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));
+ }
+ }
}
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 c0a84b5..da861dc 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 @@
@Test
public void testWarningMessageExistWhenConrailV1AndV2ResourcesCollidesInSameHeatFile() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testParseException(){
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testWarningMessageExistWhenConrailV1AndV2ResourcesCollidesInDifferentHeatFiles() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testWarningMessageNotExistWhenConrailV1AndV2ResourcesCollidesInNonHeatFile() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testWarningMessageNotExistWhenOnlyConrailV1Resources() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(validator,
RESOURCE_PATH + "/notcollides/");
validateMessage(messages,
"WARNING: [CTL3]: Contrail 2.x deprecated resource is in use, " +
@@ -104,7 +104,7 @@
@Test
public void testWarningMessageOnResourceWithContrailType() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(validator,
RESOURCE_PATH + "/validatenocontrailresource/");
validateMessage(messages,
"WARNING: [CTL3]: Contrail 2.x deprecated resource is in use, " +
@@ -114,7 +114,7 @@
@Test
public void testInvalidHeatStructure(){
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(validator,
RESOURCE_PATH + "/invalidHeatStructure/");
validateMessage(messages,
"ERROR: [CTL1]: Invalid HEAT format problem - [The file 'first.yaml' " +
@@ -124,7 +124,7 @@
@Test
public void testInvalidHeatStructuredueToParsingError(){
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> 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 a6e3d11..64ddd61 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 @@
@BeforeClass
public static void init() throws IOException {
- Map<String, Object> resourcesMap = ValidationTestUtil.getResourceMap(mockConfigFileName);
+ Map<String, Object> resourcesMap = new ValidationTestUtil().getResourceMap(mockConfigFileName);
Map<String, Object> resourceBaseValidatorMap =
(Map<String, Object>) resourcesMap.get("forbiddenResourceGuideLineValidator");
@@ -51,13 +51,13 @@
@Test
public void testFloatingIpResourceType() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(
+ Map<String, MessageContainer> 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 @@
}
@Test
public void testParseException(){
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(
+ Map<String, MessageContainer> 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 @@
@Test
public void testInvalidResourceType(){
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(
+ Map<String, MessageContainer> 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 5856b3f..df6fa06 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 @@
@Test
void shouldReturnOnlyFilesWithPmDictionaryType() {
// given
- GlobalValidationContext globalContext = ValidationTestUtil.createGlobalContextFromPath(TEST_MANIFEST_PATH);
+ GlobalValidationContext globalContext = new ValidationTestUtil().createGlobalContextFromPath(TEST_MANIFEST_PATH);
// when
Set<String> 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 d687e5e..4492eac 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 @@
@Test
public void testParseException(){
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> 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 ffcedbb..a528985 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 @@
@Test
public void testInvalidHeatFormat() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(validator,
RESOURCE_PATH + "/invalid_heat_format/negative_test/input");
Assert.assertNotNull(messages);
@@ -61,7 +61,7 @@
@Test
public void testDependsOn() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(validator,
RESOURCE_PATH + "/depends_on_points_to_existing_resource/input");
Assert.assertNotNull(messages);
@@ -79,7 +79,7 @@
@Test
public void testResourcesReferencesExistInHeat() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new HeatValidator(),
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(new HeatValidator(),
RESOURCE_PATH + "/resource_references_exist_in_heat/negative_test/input");
Assert.assertNotNull(messages);
@@ -98,7 +98,7 @@
@Test
public void testGetResourceValueIsValid() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new HeatValidator(),
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(new HeatValidator(),
RESOURCE_PATH + "/get_resource_value_valid/negative_test/input");
Assert.assertNotNull(messages);
@@ -121,7 +121,7 @@
@Test
public void testTwoResourcesDoesNotHoldSameId() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new HeatValidator(),
+ Map<String, MessageContainer> 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 @@
@Test
public void testWithWrongFileExtension(){
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new HeatValidator(),
+ Map<String, MessageContainer> 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 @@
@Test
public void testWithMissingManifestContent(){
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new HeatValidator(),
+ Map<String, MessageContainer> 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 @@
@Test
public void testWithInvalidHeatContent(){
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new HeatValidator(),
+ Map<String, MessageContainer> 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 @@
@Test
public void testGeneratedArtifactExistInHeat() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new HeatValidator(),
+ Map<String, MessageContainer> 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 @@
@Test
public void negativeTestGetParamPointToExistingParameter() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new HeatValidator(),
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(new HeatValidator(),
RESOURCE_PATH + "/get_param_points_to_existing_parameter/negative_test/input");
Assert.assertNotNull(messages);
@@ -203,7 +203,7 @@
@Test
public void testGetAttrFromNested() throws IOException {
- Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(new HeatValidator(),
+ Map<String, MessageContainer> messages =new ValidationTestUtil().testValidator(new HeatValidator(),
RESOURCE_PATH + "/get_attr_from_nested/negative_test/input");
Assert.assertNotNull(messages);
@@ -218,7 +218,7 @@
@Test
public void testDefaultValueAlignWithType() throws IOException {
- Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(new HeatValidator(),
+ Map<String, MessageContainer> messages =new ValidationTestUtil().testValidator(new HeatValidator(),
RESOURCE_PATH + "/default_value_align_with_type/negative_test/input");
Assert.assertNotNull(messages);
@@ -234,7 +234,7 @@
@Test
public void testEnvParametersMatchDefinedHeatParameterTypes() throws IOException {
- Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(new HeatValidator(),
+ Map<String, MessageContainer> messages =new ValidationTestUtil().testValidator(new HeatValidator(),
RESOURCE_PATH + "/env_parameters_match_defined_types/negative_test/input");
Assert.assertNotNull(messages);
@@ -249,7 +249,7 @@
@Test
public void testReferencedArtifactsExist() throws IOException {
- Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(new HeatValidator(),
+ Map<String, MessageContainer> messages =new ValidationTestUtil().testValidator(new HeatValidator(),
RESOURCE_PATH + "/referenced_artifacts_exist/negative_test/input");
Assert.assertNotNull(messages);
@@ -264,7 +264,7 @@
@Test
public void testEnvContentIsSubSetOfHeatParameters() throws IOException {
- Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> messages =new ValidationTestUtil().testValidator(validator,
RESOURCE_PATH + "/env_content_is_subset_of_heat/negative_test/input");
Assert.assertNotNull(messages);
@@ -279,7 +279,7 @@
@Test
public void testGetParamPseudoParameters() {
- Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(new HeatValidator(),
+ Map<String, MessageContainer> messages =new ValidationTestUtil().testValidator(new HeatValidator(),
RESOURCE_PATH + "/pseudo_parameters/input");
Assert.assertNotNull(messages);
@@ -288,7 +288,7 @@
}
@Test
public void testNoErrorWhenEmptyValueForParameterInEnv() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> 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 9e860ef..778213d 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 @@
@Test
public void testValidManifest() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(validator,
RESOURCE_PATH + "/validFiles");
Assert.assertNotNull(messages);
Assert.assertNotNull(messages);
@@ -48,25 +48,25 @@
@Test
public void testManifestMissingFileInZip() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new ManifestValidator(),
+ Map<String, MessageContainer> 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<String, MessageContainer> messages = ValidationTestUtil.testValidator(new ManifestValidator(),
+ Map<String, MessageContainer> 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 @@
@Test
public void testMissingFileInManifest() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new ManifestValidator(),
+ Map<String, MessageContainer> 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<String, MessageContainer> messages = ValidationTestUtil.testValidator(new ManifestValidator(),
+ Map<String, MessageContainer> 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<String, MessageContainer> messages = ValidationTestUtil.testValidator(new ManifestValidator(),
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(new ManifestValidator(),
RESOURCE_PATH + "/invalidFileTypeInManifest");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 4);
@@ -103,19 +103,19 @@
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 @@
@Test
public void testMissingFileInManifestAndInZip() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new ManifestValidator(),
+ Map<String, MessageContainer> 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 @@
@Test
public void testEnvInRoot() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(new ManifestValidator(),
+ Map<String, MessageContainer> 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 b510eeb..210bdd3 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 @@
private Map<String, MessageContainer> 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 dde43e7..a0b18b2 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 @@
@Test
public void testBaseHeatExposeNetwork() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testParseException(){
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testInvalidGetResource(){
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(validator,
RESOURCE_PATH + "/" +
"baseHeatDoesNotExposeNetworkInvalidGetResource");
Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(),
@@ -74,12 +74,12 @@
@Test
public void testBaseHeatExposeNetworkAndVolume() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testBaseHeatExposeServerGroup() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testBaseHeatExposeSecurityGroup() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testBaseHeatExposeVolume() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testHeatVolumeExpose() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testResourceIsExposedByCallingGetResourceNotFromOutput() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testMissingBaseHeat() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(validator,
RESOURCE_PATH + "/missingBaseHeat/");
Assert.assertNotNull(messages);
Assert.assertEquals(messages.size(), 1);
@@ -185,7 +185,7 @@
@Test
public void testMultiBaseHeat() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(validator,
+ Map<String, MessageContainer> 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 637510a..77e2f2a 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 @@
public class YamlValidatorTest {
- private static final String RESOURCE_PATH = "/org/openecomp/validation/validators/yaml_validator";
+ private static final String RESOURCE_PATH = "/org/openecomp/validation/validators/yaml_validator";
- public Map<String, MessageContainer> runValidation(String path) {
- YamlValidator validator = new YamlValidator();
- return ValidationTestUtil.testValidator(validator, path);
+ public Map<String, MessageContainer> runValidation(String path) {
+ return new ValidationTestUtil().testValidator(new YamlValidator(), path);
+ }
- }
+ @Test
+ public void testValidYaml() {
+ Map<String, MessageContainer> messages = runValidation(RESOURCE_PATH + "/valid_yaml/input/validHeat.yaml");
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(0, messages.size());
+ }
- @Test
- public void testValidYaml() {
+ @Test
+ public void testInvalidTabYaml() {
- Map<String, MessageContainer> messages = runValidation(
- RESOURCE_PATH + "/valid_yaml/input/validHeat.yaml");
- Assert.assertNotNull(messages);
- Assert.assertEquals(messages.size(), 0);
- }
+ Map<String, MessageContainer> 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 testInvalidTabYaml() {
+ @Test
+ public void testDuplicateKeyInYaml() {
+ Map<String, MessageContainer> 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"));
+ }
- Map<String, MessageContainer> 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 testInvalidYamlStructure() {
+ Map<String, MessageContainer> 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 <block end>, but found '-' in 'reader', " +
+ "line 10, column 7: - shared: true ^");
+ }
- @Test
- public void testDuplicateKeyInYaml() {
-
- Map<String, MessageContainer> 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<String, MessageContainer> 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 <block end>, but found BlockEntry in 'reader', " +
- "line 10, column 7: - shared: true ^");
- }
-
- @Test
- public void testEmptyYaml() {
-
- Map<String, MessageContainer> 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());
- }
+ @Test
+ public void testEmptyYaml() {
+ Map<String, MessageContainer> 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 4304114..707848f 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 @@
private static final String PATH = "/org/openecomp/validation/validators/heat_validator/network_policy_associated_with_attach_policy/";
@Test
public void testNetworkPolicyAssociatedWithAttachPolicy() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator, resourceValidator
, HeatResourcesTypes.CONTRAIL_NETWORK_RULE_RESOURCE_TYPE.getHeatResource(),
PATH + "positive");
@@ -52,7 +52,7 @@
@Test
public void testNonNetworkPolicyResource() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator, resourceValidator
+ Map<String, MessageContainer> 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 b864a2d..d8cecc9 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 @@
@Test
public void testNoLoopsNesting() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, null,
PATH + "no_loops_nesting/negative_test/input");
@@ -74,7 +74,7 @@
@Test
public void testPropertiesMatchNestedParameters() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, null,
PATH + "properties_match_nested_parameters/negative_test/input");
@@ -89,7 +89,7 @@
@Test
public void testWrongValueTypeAssigned() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, null,
PATH + "properties_match_nested_parameters/wrong_value_type_assigned/input");
@@ -107,7 +107,7 @@
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 10c70b6..0e02a1d 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 @@
private static final String PATH = "/org/openecomp/validation/validators/heat_validator/";
@Test
public void testMoreThanOneBindFromNovaToPort() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testPortNotBindToAnyNovaServerHPR1() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
PATH + "no_neutron_port/input");
@@ -66,7 +66,7 @@
@Test
public void testPortNotBindToAnyNovaServerHPR3() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 fabc833..10de813 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 @@
@Test
public void testSecurityGroupBaseFileNoPorts() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testSecurityGroupsCalledByPort() throws IOException {
- Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 e9c70b0..b22dd4d 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 @@
private static final String PATH = "/org/openecomp/validation/validators/heat_validator/";
@Test
public void testPolicyIsAffinityOrAntiAffinity() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testServerGroupCalledByServer() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testNonServerGroup() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 6352332..d56a5ea 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 @@
private static final String PATH = "/org/openecomp/validation/validators/heat_validator/";
@Test
public void testNovaPropertiesHasAssignedValue() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testServerGroupsPointedByServersDefinedCorrectly() throws IOException {
- Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 07cfaf7..b80788a 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 @@
private static final String PATH = "/org/openecomp/validation/validators/heat_validator/";
@Test
public void testResourceGroupWithInvalidIndexVar() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.RESOURCE_GROUP_RESOURCE_TYPE.getHeatResource(),
PATH + "resource_group_invalid_indexvar/negative_test/input");
@@ -89,7 +89,7 @@
@Test
public void testResourceGroupWithInvalidType() {
- Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages =new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.RESOURCE_GROUP_RESOURCE_TYPE.getHeatResource(),
PATH + "resource_group_invalid_type/negative_test/input");
@@ -110,7 +110,7 @@
@Test
public void testResourcesGroupWithNested() {
- Map<String, MessageContainer> messages =ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 9fcef28..4a8e797 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 @@
*/
public class VirtualMachineInterfaceValidatorTest {
- private static final String PATH =
- "/org/openecomp/validation/validators/heat_validator/vlan_resource_validation/";
+ 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<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator,
- HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
- PATH + "vlan_multiple_parent_ports/negative_test/input");
+ @Test
+ public void hasSingleParentPortNegative() {
+ HeatResourceValidator baseValidator = new HeatResourceValidator();
+ VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
+ Map<String, MessageContainer> 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(messages.size(), 1);
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(1, messages.size());
- 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]");
- }
+ 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<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator,
- HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
- PATH + "vlan_multiple_parent_ports/negative_get_resource/input");
+ @Test
+ public void hasSingleParentPortNegativeWithGetResource() {
+ HeatResourceValidator baseValidator = new HeatResourceValidator();
+ VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
+ Map<String, MessageContainer> 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);
- }
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(messages.size(), 0);
+ }
- @Test
- public void hasSingleParentPortPositive() {
- HeatResourceValidator baseValidator = new HeatResourceValidator();
- VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator,
- HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
- PATH + "vlan_multiple_parent_ports/positive_test/input");
+ @Test
+ public void hasSingleParentPortPositive() {
+ HeatResourceValidator baseValidator = new HeatResourceValidator();
+ VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
+ Map<String, MessageContainer> 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(messages.size(), 0);
+ Assert.assertNotNull(messages);
+ Assert.assertEquals(0, messages.size());
+ }
- }
+ @Test
+ public void hasBothPropertiesNegativeMissingVlanTag() {
+ HeatResourceValidator baseValidator = new HeatResourceValidator();
+ VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
+ Map<String, MessageContainer> 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<String, MessageContainer> 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<String, MessageContainer> 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 hasBothPropertiesNegativeMissingVlanTag() {
- HeatResourceValidator baseValidator = new HeatResourceValidator();
- VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator,
- HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource(),
- PATH + "vlan_has_two_properties/negative_tag_missing/input");
+ @Test
+ public void hasBothPropertiesPositive() {
+ HeatResourceValidator baseValidator = new HeatResourceValidator();
+ VirtualMachineInterfaceValidator resourceValidator = new VirtualMachineInterfaceValidator();
+ Map<String, MessageContainer> 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(), 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<String, MessageContainer> 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<String, MessageContainer> 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<String, MessageContainer> 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);
-
-
- }
-
-
-
+ 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 d61d718..dd74f98 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 @@
@Test
public void testContrailServiceInstanceAvailabilityZoneNotAlignedWithNamingConvention() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_INSTANCE.getHeatResource(),
PATH + "notaligned");
Assert.assertNotNull(messages);
@@ -48,7 +48,7 @@
@Test
public void testContrailServiceInstanceAvailabilityZoneAlignedWithNamingConvention() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_INSTANCE.getHeatResource(),
PATH + "aligned");
Assert.assertNotNull(messages);
@@ -56,7 +56,7 @@
}
@Test
public void testContrailServiceInstanceAvailabilityZoneNotAlignedWithNamingConventionMissingParam() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 f9e0765..f04778c 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 @@
@Test
public void testContrailServiceTemplateImageAndFlavorNamesAlignedWithNamingConventionButDifferentVmType() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(),
PATH + "imageandflavordifferentvmtype");
Assert.assertNotNull(messages);
@@ -49,7 +49,7 @@
@Test
public void testContrailServiceTemplateImageAndFlavorNamesNotAlignedWithNamingConvention() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(),
PATH + "/notaligned");
Assert.assertNotNull(messages);
@@ -63,7 +63,7 @@
@Test
public void testContrailServiceTemplateImageAndFlavorNamesAlignedWithNamingConvention() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.CONTRAIL_SERVICE_TEMPLATE.getHeatResource(),
PATH + "aligned");
Assert.assertNotNull(messages);
@@ -72,7 +72,7 @@
@Test
public void testContrailServiceTemplateMissingParam() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 00f95ef..8dad17b 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 @@
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<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testNeutronFixedIpName() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testMissingParam() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
- resourceValidator, HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource(),
+ Map<String, MessageContainer> 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 01750c5..cfa3a86 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 @@
private static final String PATH = "/org/openecomp/validation/validators/guideLineValidator/novaserverValidation/";
@Test
public void testHeatNovaServerMetaDataValidation() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testNovaServerAvailabilityZoneName() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testNovaImageAndFlavorNamesEmptyProperties() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
PATH + "heatNovaServerImageAndFlavor/negativeEmptyProperties");
Assert.assertNotNull(messages);
@@ -86,13 +86,13 @@
@Test
public void testNovaImageAndFlavorNames() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testNovaResourceNetworkUniqueRole() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testNovaServerName() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testVMNameSyncInNova() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
PATH + "input");
@@ -161,7 +161,7 @@
@Test
public void testAvailabilityZoneName() throws IOException {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
PATH + "availability_zone_name/input");
@@ -179,7 +179,7 @@
@Test
public void testHeatNovaServerVnfIDValidation() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testHeatNovaServerVfModuleValidation() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
@Test
public void testMissingParam() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
PATH + "heatNovaNetworkUniqueRoleConvention/missingportNetwork/");
Assert.assertNotNull(messages);
@@ -217,7 +217,7 @@
@Test
public void testNovaResource() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> messages = new ValidationTestUtil().testValidator(baseValidator,
resourceValidator, HeatResourcesTypes.NOVA_SERVER_RESOURCE_TYPE.getHeatResource(),
PATH + "heatNovaNetworkUniqueRoleConvention/invalidresource/");
Assert.assertNotNull(messages);
@@ -227,7 +227,7 @@
@Test
public void testEnvFileContent() {
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 e660fbf..21b5ca6 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 @@
NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator();
VirtualMachineInterfaceGuidelineValidator resourceValidator = new
VirtualMachineInterfaceGuidelineValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator();
VirtualMachineInterfaceGuidelineValidator resourceValidator = new
VirtualMachineInterfaceGuidelineValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator();
VirtualMachineInterfaceGuidelineValidator resourceValidator = new
VirtualMachineInterfaceGuidelineValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator();
VirtualMachineInterfaceGuidelineValidator resourceValidator = new
VirtualMachineInterfaceGuidelineValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator();
VirtualMachineInterfaceGuidelineValidator resourceValidator = new
VirtualMachineInterfaceGuidelineValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator();
VirtualMachineInterfaceGuidelineValidator resourceValidator = new
VirtualMachineInterfaceGuidelineValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator();
VirtualMachineInterfaceGuidelineValidator resourceValidator = new
VirtualMachineInterfaceGuidelineValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator();
VirtualMachineInterfaceGuidelineValidator resourceValidator = new
VirtualMachineInterfaceGuidelineValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 @@
NamingConventionGuideLineValidator baseValidator = new NamingConventionGuideLineValidator();
VirtualMachineInterfaceGuidelineValidator resourceValidator = new
VirtualMachineInterfaceGuidelineValidator();
- Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(baseValidator,
+ Map<String, MessageContainer> 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 68ba5c9..11ed229 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 @@
*/
public class ValidationTestUtil {
- private ValidationTestUtil(){}
+ public ValidationTestUtil(){}
- public static GlobalValidationContext createGlobalContextFromPath(String path) {
+ public GlobalValidationContext createGlobalContextFromPath(String path) {
GlobalValidationContext globalValidationContext = new GlobalValidationContext();
Map<String, byte[]> contentMap = getContentMapByPath(path);
if (contentMap == null) {
@@ -62,7 +62,7 @@
return globalValidationContext;
}
- private static Map<String, byte[]> getContentMapByPath(String path) {
+ private Map<String, byte[]> getContentMapByPath(String path) {
Map<String, byte[]> contentMap = new HashMap<>();
URL url = ValidationTestUtil.class.getResource(path);
File pathFile = new File(url.getFile());
@@ -89,8 +89,7 @@
return contentMap;
}
- public static Map<String, MessageContainer> testValidator(Validator validator, String path) {
-
+ public Map<String, MessageContainer> testValidator(Validator validator, String path) {
GlobalValidationContext globalValidationContext = createGlobalContextFromPath(path);
validator.validate(globalValidationContext);
@@ -100,7 +99,7 @@
}
- public static Map<String, MessageContainer> testValidator(ResourceBaseValidator baseValidator,
+ public Map<String, MessageContainer> testValidator(ResourceBaseValidator baseValidator,
ResourceValidator resourceValidator,
String resourceTypeToValidate, String path) {
@@ -117,7 +116,7 @@
return globalContext.getContextMessageContainers();
}
- private static void validateFiles(ResourceBaseValidator baseValidator,
+ private void validateFiles(ResourceBaseValidator baseValidator,
ResourceValidator resourceValidator,
GlobalValidationContext globalContext,
Map<String, FileData> fileEnvMap,
@@ -144,7 +143,7 @@
}
}
- 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 @@
(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 @@
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<String, Object> getResourceMap(String configFileName) throws IOException {
+ public Map<String, Object> 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 0fd281d..b1bfd9e 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
@@ -3,19 +3,10 @@
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 12ee089..560aa61 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 @@
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 2fc1d16..ea28e7f 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 @@
- 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 2fc1d16..ea28e7f 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 @@
- 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 2fc1d16..ea28e7f 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 @@
- 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 9b0c3ec..ea28e7f 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 @@
- 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 54b6964..4d2ec69 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-validation-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 ba23c8b..a15c767 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 @@
return MapUtils.unmodifiableMap(this.resourceTypeToImpl);
}
-@Override
+ @Override
public void init(Map<String, Object> 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 35a8c00..095df4f 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.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";
+ private String testValidator = "testValidator";
- @Test
- public void testInvalidResourceType(){
- ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator();
- Map<String, MessageContainer> 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 testInvalidResourceType() {
+ ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator();
+ Map<String, MessageContainer> 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<String, MessageContainer> 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 testInvalidHeatStructure() {
+ ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator();
+ Map<String, MessageContainer> 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<String, Object> properties = new HashMap<>();
- resourceBaseValidator.init(properties);
+ @Test
+ public void testInitWithEmptyPropertiesMap() {
+ ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator();
+ Map<String, Object> properties = new HashMap<>();
+ resourceBaseValidator.init(properties);
+ assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl()));
+ }
- assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl()));
- }
+ @Test
+ public void testInitPropertiesMap() {
+ ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator();
+ initProperties(resourceBaseValidator, getValidImplementationConfiguration());
- @Test
- public void testInitPropertiesMap() {
- ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator();
- initProperties(resourceBaseValidator, getValidImplementationConfiguration());
+ Map<String, ImplementationConfiguration> resourceTypeToImpl = resourceBaseValidator.getResourceTypeToImpl();
+ assertTrue(MapUtils.isNotEmpty(resourceTypeToImpl));
+ assertTrue(resourceTypeToImpl.containsKey(testValidator));
+ }
- Map<String, ImplementationConfiguration> resourceTypeToImpl =
- resourceBaseValidator.getResourceTypeToImpl();
- assertTrue(MapUtils.isNotEmpty(resourceTypeToImpl));
- assertTrue(resourceTypeToImpl.containsKey(testValidator));
- }
+ @Test
+ public void testInitPropertiesWithString() {
+ ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator();
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(testValidator, "invalidValue");
+ resourceBaseValidator.init(properties);
+ assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl()));
+ }
- @Test
- public void testInitPropertiesWithString() {
- ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator();
- Map<String, Object> properties = new HashMap<>();
- properties.put(testValidator, "invalidValue");
+ @Test
+ public void testInitPropertiesWithoutImplClass() {
+ ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator();
+ initProperties(resourceBaseValidator, new HashMap<>());
+ assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl()));
+ }
- resourceBaseValidator.init(properties);
+ public Map<String, Object> getValidImplementationConfiguration() {
+ Map<String, Object> implConfiguration = new HashMap<>();
+ implConfiguration.put(ConfigConstants.Impl_Class, "org.openecomp.sdc.validation.impl.validators.ForbiddenResourceGuideLineValidator");
+ implConfiguration.put(ConfigConstants.Enable, true);
- assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl()));
- }
+ return implConfiguration;
+ }
- @Test
- public void testInitPropertiesWithoutImplClass() {
- ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator();
- initProperties(resourceBaseValidator, new HashMap<>());
+ private void initProperties(ResourceBaseValidator resourceBaseValidator, Map<String, Object> implementationConfiguration) {
+ Map<String, Object> properties = Collections.singletonMap(testValidator, implementationConfiguration);
+ resourceBaseValidator.init(properties);
+ }
- assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl()));
- }
+ public GlobalValidationContext createGlobalContextFromPath(String path) {
+ GlobalValidationContext globalValidationContext = new GlobalValidationContext();
+ Map<String, byte[]> contentMap = getContentMapByPath(path);
+ if (contentMap == null) {
+ return null;
+ }
+ contentMap.forEach(globalValidationContext::addFileContext);
- public Map<String, Object> getValidImplementationConfiguration() {
- Map<String, Object> implConfiguration = new HashMap<>();
- implConfiguration.put(
- ConfigConstants.Impl_Class, "org.openecomp.sdc.validation.impl.validators.ForbiddenResourceGuideLineValidator");
- implConfiguration.put(ConfigConstants.Enable, true);
+ return globalValidationContext;
+ }
- return implConfiguration;
- }
+ private Map<String, byte[]> getContentMapByPath(String path) {
+ Map<String, byte[]> 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};
+ }
- private void initProperties(ResourceBaseValidator resourceBaseValidator,
- Map<String, Object> implementationConfiguration) {
- Map<String, Object> properties =
- Collections.singletonMap(testValidator, implementationConfiguration);
+ if (files == null || files.length == 0) {
+ return null;
+ }
- resourceBaseValidator.init(properties);
- }
+ 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<String, MessageContainer> testValidator(Validator validator, String path) {
+ GlobalValidationContext globalValidationContext = createGlobalContextFromPath(path);
+ validator.validate(globalValidationContext);
+
+ assert globalValidationContext != null;
+ return globalValidationContext.getContextMessageContainers();
+ }
+
+ public Map<String, MessageContainer> 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<String, FileData.Type> fileTypeMap = ManifestUtil.getFileTypeMap(manifestContent);
+ Map<String, FileData> fileEnvMap = ManifestUtil.getFileAndItsEnv(manifestContent);
+
+ validateFiles(baseValidator, resourceValidator, globalContext, fileEnvMap, fileTypeMap,
+ resourceTypeToValidate);
+
+ return globalContext.getContextMessageContainers();
+ }
+
+ private void validateFiles(ResourceBaseValidator baseValidator,
+ ResourceValidator resourceValidator,
+ GlobalValidationContext globalContext,
+ Map<String, FileData> fileEnvMap,
+ Map<String, FileData.Type> fileTypeMap,
+ String resourceTypeToValidate) {
+
+ Collection<String> 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<String, Resource> 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 69d26f9..54fffa0 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 @@
<artifactId>openecomp-sdc-vendor-license-api</artifactId>
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-vendor-license-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 b6603df..bb0c581 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-vendor-license-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 ed629ec..ecaea75 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 @@
<version>1.8.1-SNAPSHOT</version>
</parent>
-
<modules>
<module>openecomp-sdc-vendor-software-product-api</module>
<module>openecomp-sdc-vendor-software-product-core</module>
</modules>
-
</project>
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 d948c29..526d27a 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 @@
<artifactId>openecomp-sdc-versioning-api</artifactId>
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-versioning-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 77d4b77..3347fb3 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 @@
<parent>
<groupId>org.openecomp.sdc</groupId>
- <artifactId>openecomp-sdc-lib</artifactId>
+ <artifactId>openecomp-sdc-versioning-lib</artifactId>
<version>1.8.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
</parent>
<dependencies>
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 1292586..1853916 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 @@
<artifactId>onap-tosca-datatype</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.openecomp.sdc.core</groupId>
- <artifactId>openecomp-tosca-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc.core</groupId>
- <artifactId>openecomp-facade-core</artifactId>
- <version>${project.version}</version>
- </dependency>
</dependencies>
<parent>
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 eba914a..9d63529 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
@@ -10,16 +10,6 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.sdc.core</groupId>
- <artifactId>openecomp-tosca-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.openecomp.sdc.core</groupId>
- <artifactId>openecomp-facade-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-translator-core</artifactId>
<version>${project.version}</version>
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 1eb09a8..dfca19b 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.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 @@
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<Object> 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<Object[]> buildTestCase(final Path testCasePath) throws IOException {
final Path inputFilePath = Files.list(testCasePath)
.filter(path -> path.toFile().getName().endsWith("yaml"))
@@ -94,7 +62,7 @@
}
final List<Path> transformationDescriptorList;
try (final Stream<Path> 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 @@
final List<Path> outputList;
try (final Stream<Path> 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 @@
.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();
+ 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, transformationDescriptorFilePath.toString());
- pnfdTransformationEngine.transform();
+ final PnfdTransformationEngine pnfdTransformationEngine = new PnfdNodeTemplateTransformationEngine(
+ serviceTemplateReaderService, serviceTemplate, p[2].toString());
+ pnfdTransformationEngine.transform();
- final String result = yamlUtil.objectToYaml(serviceTemplate);
- final String expectedResult = parseToYaml(outputFilePath);
- assertEquals(expectedResult, result);
+ 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 @@
}
}
- 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 843923a..24a0866 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 @@
<module>openecomp-tosca-converter-core</module>
</modules>
-
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc.core</groupId>
+ <artifactId>openecomp-tosca-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.core</groupId>
+ <artifactId>openecomp-facade-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 5766496..b917838 100644
--- a/pom.xml
+++ b/pom.xml
@@ -78,7 +78,7 @@
<skipYamlJsonValidator>false</skipYamlJsonValidator>
<!-- Yaml for properties -->
- <snakeyaml.version>1.14</snakeyaml.version>
+ <snakeyaml.version>1.26</snakeyaml.version>
<functionaljava.version>4.7</functionaljava.version>
<httpclient.version>4.5.3</httpclient.version>
<httpcore.version>4.4.1</httpcore.version>
diff --git a/utils/DmaapPublisher/pom.xml b/utils/DmaapPublisher/pom.xml
index 73ad303..f0756c5 100644
--- a/utils/DmaapPublisher/pom.xml
+++ b/utils/DmaapPublisher/pom.xml
@@ -50,7 +50,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
- <version>1.18</version>
+ <version>${snakeyaml.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>