diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src')
8 files changed, 277 insertions, 127 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/CommonMethods.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/CommonMethods.java index 343636bd15..81a82c6298 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/CommonMethods.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/CommonMethods.java @@ -21,6 +21,7 @@ package org.openecomp.core.utilities; import org.apache.commons.codec.binary.Base64; +import org.apache.commons.collections4.MapUtils; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -36,8 +37,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.UUID; @@ -45,14 +48,12 @@ import java.util.UUID; * This class provides auxiliary static methods. */ public class CommonMethods { - //private static final Logger logger = LoggerFactory.getLogger(CommonMethods.class); - - private static final char[] hexArray = "0123456789ABCDEF".toCharArray(); private static final char[] CHARS = new char[]{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + private static final char[] hexArray = "0123456789ABCDEF".toCharArray(); /** * Private default constructor to prevent instantiation of the class objects. @@ -73,8 +74,8 @@ public class CommonMethods { ObjectOutputStream ds = new ObjectOutputStream(byteArray); ds.writeObject(object); ds.close(); - } catch (IOException e0) { - throw new RuntimeException(e0); + } catch (IOException exception) { + throw new RuntimeException(exception); } return byteArray.toByteArray(); @@ -93,8 +94,8 @@ public class CommonMethods { ObjectInputStream stream = new ObjectInputStream(new ByteArrayInputStream(bytes)); obj = (Serializable) stream.readObject(); stream.close(); - } catch (IOException | ClassNotFoundException e0) { - throw new RuntimeException(e0); + } catch (IOException | ClassNotFoundException exception) { + throw new RuntimeException(exception); } return obj; @@ -185,8 +186,8 @@ public class CommonMethods { /** * Converts the array with Long elements to the array with long (primitive type). * - * @param array input array with Long elements. - * @return array with the same elements converted to the long type (primitive). + * @param array input array with Long elements + * @return array with the same elements converted to the long type (primitive) */ public static long[] toPrimitive(Long[] array) { if (array == null) { @@ -255,12 +256,12 @@ public class CommonMethods { * empty. * * @param <T> the type parameter - * @param left Elements of this array will be copied to positions from 0 to - * <tt>left.length - 1</tt> in the target array. - * @param right Elements of this array will be copied to positions from - * <tt>left.length</tt> to <tt>left.length + right.length</tt> - * @return A newly allocate Java array that accommodates elements of source (left/right) - arraysor one of source arrays if another is empty, <tt>null</tt> - otherwise. + * @param left Elements of this array will be copied to positions from 0 to <tt>left.length - + * 1</tt> in the target array. + * @param right Elements of this array will be copied to positions from <tt>left.length</tt> to + * <tt>left.length + right.length</tt> + * @return A newly allocate Java array that accommodates elements of source (left/right) arrays + orone of source arrays if another is empty, <tt>null</tt> - otherwise. */ @SuppressWarnings("unchecked") public static <T> T[] concat(T[] left, T[] right) { @@ -288,25 +289,25 @@ public class CommonMethods { * * @param <B> the type parameter * @param <D> the type parameter - * @param b0 An object instance to be casted to the specified Java type. + * @param b1 An object instance to be casted to the specified Java type. * @param cls Target Java type. * @return Object instance safely casted to the requested Java type. - * @throws ClassCastException In case which is the given object is not instance of the - * specified Java type. + * @throws ClassCastException In case which is the given object is not instance of the specified + * Java type. */ @SuppressWarnings("unchecked") - public static <B, D> D cast(B b0, Class<D> cls) { - D d0 = null; - if (b0 != null) { - if (!cls.isInstance(b0)) { + public static <B, D> D cast(B b1, Class<D> cls) { + D d1 = null; + if (b1 != null) { + if (!cls.isInstance(b1)) { throw new ClassCastException(String - .format("Failed to cast from '%s' to '%s'", b0.getClass().getName(), cls.getName())); + .format("Failed to cast from '%s' to '%s'", b1.getClass().getName(), cls.getName())); } else { - d0 = (D) b0; + d1 = (D) b1; } } - return d0; + return d1; } // cast /** @@ -349,8 +350,8 @@ public class CommonMethods { Class<? extends T> impl = (Class<? extends T>) temp; return newInstance(impl); - } catch (ClassNotFoundException e0) { - throw new IllegalArgumentException(e0); + } catch (ClassNotFoundException exception) { + throw new IllegalArgumentException(exception); } } @@ -364,10 +365,10 @@ public class CommonMethods { public static <T> T newInstance(Class<T> cls) { try { return cls.newInstance(); - } catch (InstantiationException e0) { - throw new RuntimeException(e0); - } catch (IllegalAccessException e0) { - throw new RuntimeException(e0); + } catch (InstantiationException exception) { + throw new RuntimeException(exception); + } catch (IllegalAccessException exception) { + throw new RuntimeException(exception); } } @@ -388,15 +389,15 @@ public class CommonMethods { /** * Gets stack trace. * - * @param t0 the t 0 + * @param throwable the throwable * @return the stack trace */ - public static String getStackTrace(Throwable t0) { - if (null == t0) { + public static String getStackTrace(Throwable throwable) { + if (null == throwable) { return ""; } StringWriter sw = new StringWriter(); - t0.printStackTrace(new PrintWriter(sw)); + throwable.printStackTrace(new PrintWriter(sw)); return sw.toString(); } @@ -416,8 +417,8 @@ public class CommonMethods { String str = sw.toString(); try { sw.close(); - } catch (IOException e0) { - System.err.println(e0); + } catch (IOException exception) { + System.err.println(exception); } return str; @@ -530,10 +531,10 @@ public class CommonMethods { public static String bytesToHex(byte[] bytes) { char[] hexChars = new char[bytes.length * 2]; for (int j = 0; j < bytes.length; j++) { - int v0 = bytes[j] & 0xFF; - int x0 = j << 1; - hexChars[x0] = hexArray[v0 >>> 4]; - hexChars[x0 + 1] = hexArray[v0 & 0x0F]; + int var = bytes[j] & 0xFF; + int x1 = j << 1; + hexChars[x1] = hexArray[var >>> 4]; + hexChars[x1 + 1] = hexArray[var & 0x0F]; } return new String(hexChars); } @@ -543,13 +544,106 @@ public class CommonMethods { * * @param <T> the class of the objects in the set * @param element the single element to be contained in the returned Set - * @return an immutable set containing only the specified object.The returned set is serializable. + * @return an immutable set containing only the specified object. The returned set is + serializable. */ public static <T> Set<T> toSingleElementSet(T element) { return Collections.singleton(element); } + /** + * Merge lists of map list. + * + * @param <T> the type parameter + * @param <S> the type parameter + * @param target the target + * @param source the source + * @return the list + */ + public static <T, S> List<Map<T, S>> mergeListsOfMap(List<Map<T, S>> target, + List<Map<T, S>> source) { + List<Map<T, S>> retList = new ArrayList<>(); + if (Objects.nonNull(target)) { + retList.addAll(target); + } + + if (Objects.nonNull(source)) { + for (Map<T, S> sourceMap : source) { + for (Map.Entry<T, S> entry : sourceMap.entrySet()) { + mergeEntryInList(entry.getKey(), entry.getValue(), retList); + } + } + } + return retList; + } + + /** + * Merge lists list. + * + * @param <T> the type parameter + * @param target the target + * @param source the source + * @return the list + */ + public static <T> List<T> mergeLists(List<T> target, List<T> source) { + List<T> retList = new ArrayList<>(); + + if (Objects.nonNull(source)) { + retList.addAll(source); + } + if (Objects.nonNull(target)) { + retList.addAll(target); + } + + return retList; + } + + /** + * Merge entry in list. + * + * @param <T> the type parameter + * @param <S> the type parameter + * @param key the key + * @param value the value + * @param target the target + */ + public static <T, S> void mergeEntryInList(T key, S value, List<Map<T, S>> target) { + boolean found = false; + for (Map<T, S> map : target) { + if (map.containsKey(key)) { + map.put(key, value); + found = true; + } + } + + if (!found) { + Map<T, S> newMap = new HashMap<>(); + newMap.put(key, value); + target.add(newMap); + } + } + + + /** + * Merge maps map. + * + * @param <T> the type parameter + * @param <S> the type parameter + * @param target the target + * @param source the source + * @return the map + */ + public static <T, S> Map<T, S> mergeMaps(Map<T, S> target, Map<T, S> source) { + Map<T, S> retMap = new HashMap<>(); + if (MapUtils.isNotEmpty(source)) { + retMap.putAll(source); + } + if (MapUtils.isNotEmpty(target)) { + retMap.putAll(target); + } + return retMap; + } } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileContentHandler.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileContentHandler.java index 67a79875d4..c828505932 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileContentHandler.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileContentHandler.java @@ -29,6 +29,7 @@ import java.util.Map; import java.util.Set; public class FileContentHandler { + private Map<String, byte[]> files = new HashMap<>(); /** @@ -57,6 +58,10 @@ public class FileContentHandler { files.put(fileName, FileUtils.toByteArray(is)); } + public Map<String, byte[]> getFiles() { + return files; + } + public void setFiles(FileContentHandler extFiles) { extFiles.getFileList().stream() .forEach(fileName -> this.addFile(fileName, extFiles.getFileContent(fileName))); diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java index 72fa9ac7b8..664ccb68c6 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java @@ -20,14 +20,14 @@ package org.openecomp.core.utilities.file; +import org.apache.commons.collections4.CollectionUtils; import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.core.utilities.yaml.YamlUtil; +import org.openecomp.sdc.logging.types.LoggerConstants; +import org.openecomp.sdc.logging.types.LoggerErrorDescription; +import org.slf4j.MDC; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; +import java.io.*; import java.net.URL; import java.util.ArrayList; import java.util.Enumeration; @@ -59,6 +59,23 @@ public class FileUtils { } /** + * Gets file input stream. + * + * @param urlFile the url file + * @return the file input stream + */ + public static InputStream getFileInputStream(URL urlFile) { + InputStream is; + try { + assert urlFile != null; + is = urlFile.openStream(); + } catch (IOException exception) { + throw new RuntimeException(exception); + } + return is; + } + + /** * Gets file input streams. * * @param fileName the file name @@ -134,9 +151,9 @@ public class FileUtils { * @return the input stream */ public static InputStream loadFileToInputStream(String fileName) { - URL urlFile = FileUtils.class.getClassLoader().getResource(fileName); + URL urlFile = Thread.currentThread().getContextClassLoader().getResource(fileName); try { - Enumeration<URL> en = FileUtils.class.getClassLoader().getResources(fileName); + Enumeration<URL> en = Thread.currentThread().getContextClassLoader().getResources(fileName); while (en.hasMoreElements()) { urlFile = en.nextElement(); } @@ -248,6 +265,7 @@ public class FileUtils { return mapFileContent; } + /** * The enum File extension. */ diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonSchemaDataGenerator.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonSchemaDataGenerator.java index 8968eeb323..84e4f6d7c9 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonSchemaDataGenerator.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonSchemaDataGenerator.java @@ -22,22 +22,17 @@ package org.openecomp.core.utilities.json; import org.json.JSONException; import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import java.util.HashMap; import java.util.Map; -/** - * The type Json schema data generator. - */ public class JsonSchemaDataGenerator { private static final String ROOT = "root"; - private static final Logger logger = LoggerFactory.getLogger(JsonSchemaDataGenerator.class); - /** - * The Include defaults. - */ + private static final Logger logger = + (Logger) LoggerFactory.getLogger(JsonSchemaDataGenerator.class); boolean includeDefaults = true; private JSONObject root; private Map<String, Object> referencesData; @@ -54,11 +49,6 @@ public class JsonSchemaDataGenerator { root = new JSONObject(jsonSchema); } - /** - * Sets include defaults. - * - * @param includeDefaults the include defaults - */ public void setIncludeDefaults(boolean includeDefaults) { this.includeDefaults = includeDefaults; } @@ -66,15 +56,16 @@ public class JsonSchemaDataGenerator { /** * Generates json data that conform to the schema according to turned on flags. * - * @return json that conform to the schema. + * @return json that conform to the schema */ public String generateData() { referencesData = new HashMap<>(); JSONObject data = new JSONObject(); generateData(ROOT, root, - data); // "root" is dummy name to represent the top level object (which, as apposed to - // inner objects, doesn't have a name in the schema) + data); + // "root" is dummy name to represent the top level object + // (which, as apposed to inner objects, doesn't have a name in the schema) return data.has(ROOT) ? data.get(ROOT).toString() : data.toString(); } @@ -161,12 +152,12 @@ public class JsonSchemaDataGenerator { default: break; } - } catch (JSONException e0) { + } catch (JSONException exception) { Object defaultValue = property.get(JsonSchemaKeyword.DEFAULT); logger.error(String.format( "Invalid schema: '%s' property type is '%s' but it has a default value which is not: %s.", - propertyName, propertyType, defaultValue), e0); - throw e0; + propertyName, propertyType, defaultValue), exception); + throw exception; } } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java index 6ae3677a8d..87c75fce62 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java @@ -20,14 +20,13 @@ package org.openecomp.core.utilities.json; - import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonIOException; import com.google.gson.JsonParser; import com.google.gson.JsonSyntaxException; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; import org.everit.json.schema.EnumSchema; import org.everit.json.schema.Schema; import org.everit.json.schema.ValidationException; @@ -82,17 +81,17 @@ public class JsonUtil { * @return the t */ public static <T> T json2Object(String json, Class<T> classOfT) { - T type; + T typ; try { try (Reader br = new StringReader(json)) { - type = new Gson().fromJson(br, classOfT); - } catch (IOException e0) { - throw e0; + typ = new Gson().fromJson(br, classOfT); + } catch (IOException exception) { + throw exception; } - } catch (JsonIOException | JsonSyntaxException | IOException e0) { - throw new RuntimeException(e0); + } catch (JsonIOException | JsonSyntaxException | IOException exception) { + throw new RuntimeException(exception); } - return type; + return typ; } /** @@ -109,8 +108,8 @@ public class JsonUtil { try (Reader br = new BufferedReader(new InputStreamReader(is))) { type = new Gson().fromJson(br, classOfT); } - } catch (JsonIOException | JsonSyntaxException | IOException e0) { - throw new RuntimeException(e0); + } catch (JsonIOException | JsonSyntaxException | IOException exception) { + throw new RuntimeException(exception); } finally { if (is != null) { try { @@ -153,16 +152,16 @@ public class JsonUtil { .collect(Collectors.toList()); } - private static String mapValidationExceptionToMessage(ValidationException e0) { - if (e0.getViolatedSchema() instanceof EnumSchema) { - return mapEnumViolationToMessage(e0); + private static String mapValidationExceptionToMessage(ValidationException exception) { + if (exception.getViolatedSchema() instanceof EnumSchema) { + return mapEnumViolationToMessage(exception); } - return e0.getMessage(); + return exception.getMessage(); } - private static String mapEnumViolationToMessage(ValidationException e1) { - Set<Object> possibleValues = ((EnumSchema) e1.getViolatedSchema()).getPossibleValues(); - return e1.getMessage().replaceFirst("enum value", possibleValues.size() == 1 + private static String mapEnumViolationToMessage(ValidationException exception) { + Set<Object> possibleValues = ((EnumSchema) exception.getViolatedSchema()).getPossibleValues(); + return exception.getMessage().replaceFirst("enum value", possibleValues.size() == 1 ? String.format("value. %s is the only possible value for this field", possibleValues.iterator().next()) : String.format("value. Possible values: %s", CommonMethods diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/yaml/YamlUtil.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/yaml/YamlUtil.java index 56261f08de..d38bf484e4 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/yaml/YamlUtil.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/yaml/YamlUtil.java @@ -20,9 +20,9 @@ package org.openecomp.core.utilities.yaml; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.core.utilities.CommonMethods; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.TypeDescription; import org.yaml.snakeyaml.Yaml; @@ -45,19 +45,20 @@ import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; + /** * The type Yaml util. */ public class YamlUtil { - private static Logger logger = LoggerFactory.getLogger(YamlUtil.class); + private static Logger logger = (Logger) LoggerFactory.getLogger(YamlUtil.class); /** * Yaml to object t. * * @param <T> the type parameter * @param yamlContent the yaml content - * @param typClass the typ class + * @param typClass the t class * @return the t */ public <T> T yamlToObject(String yamlContent, Class<T> typClass) { @@ -76,7 +77,7 @@ public class YamlUtil { * * @param <T> the type parameter * @param yamlContent the yaml content - * @param typClass the typ class + * @param typClass the t class * @return the t */ public <T> T yamlToObject(InputStream yamlContent, Class<T> typClass) { @@ -102,7 +103,7 @@ public class YamlUtil { yamlContent.close(); } } catch (IOException ignore) { - //nothing to dd + //do nothing } } } @@ -111,8 +112,8 @@ public class YamlUtil { /** * Gets constructor. * - * @param <T> the type parameter - * @param typClass the typ class + * @param <T> the type parameter + * @param typClass the t class * @return the constructor */ public <T> Constructor getConstructor(Class<T> typClass) { @@ -128,6 +129,7 @@ public class YamlUtil { return new MyPropertyUtils(); } + /** * Yaml to map map. * @@ -145,7 +147,7 @@ public class YamlUtil { * Object to yaml string. * * @param <T> the type parameter - * @param obj the obj + * @param obj the obj * @return the string */ public <T> String objectToYaml(Object obj) { @@ -192,6 +194,16 @@ public class YamlUtil { 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) { @@ -205,16 +217,6 @@ public class YamlUtil { : defaultNode; } } - - @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); - } } @@ -222,6 +224,14 @@ public class YamlUtil { * 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<Property>(getPropertiesMap(type, + BeanAccess.FIELD).values()); + } + @Override public Property getProperty(Class<?> type, String name) throws IntrospectionException { if (name.equals("default")) { @@ -230,14 +240,6 @@ public class YamlUtil { return super.getProperty(type, name); } - //Unsorted properties - @Override - protected Set<Property> createPropertySet(Class<? extends Object> type, BeanAccess beanAccess) - throws IntrospectionException { - return new LinkedHashSet<Property>(getPropertiesMap(type, - BeanAccess.FIELD).values()); - } - } /** @@ -255,16 +257,6 @@ public class YamlUtil { } @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()); - } - } - - @Override protected Map<Object, Object> createDefaultMap() { final Map<Object, Object> delegate = super.createDefaultMap(); return new AbstractMap<Object, Object>() { @@ -282,6 +274,17 @@ public class YamlUtil { } }; } + + @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/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonSchemaDataGeneratorTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonSchemaDataGeneratorTest.java index 83c87737d2..ba34d07034 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonSchemaDataGeneratorTest.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonSchemaDataGeneratorTest.java @@ -1,8 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.core.utilities.json; -import org.openecomp.core.utilities.file.FileUtils; import org.json.JSONException; import org.json.JSONObject; +import org.openecomp.core.utilities.file.FileUtils; import org.testng.Assert; import org.testng.annotations.Test; @@ -47,4 +67,4 @@ public class JsonSchemaDataGeneratorTest { JSONObject dataJson = new JSONObject(data); Assert.assertTrue(expectedData.similar(dataJson)); } -}
\ No newline at end of file +} diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java index e232f72f38..6b8805797a 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/test/java/org/openecomp/core/utilities/json/JsonUtilTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 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.openecomp.core.utilities.json; @@ -37,4 +57,4 @@ public class JsonUtilTest { Assert.assertEquals(validationErrors.get(2), "#/phoneNumber/0/code: expected type: Number, found: String"); } -}
\ No newline at end of file +} |