aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
authormojahidi <mojahidul.islam@amdocs.com>2018-05-15 12:40:30 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-05-15 08:03:47 +0000
commit3582690ce5ca69b6d12c5568314c1f9e4ecdfbf5 (patch)
tree0930f2a3789add0f62dc292d48a950e593563f1d /openecomp-be
parentbbf42bf31ff4b82eee7e4ac4087f2c8d738e9283 (diff)
Handle logger.debug(, exception) in HeatTree
Removed logger.debug(, exception) from code Change-Id: Ib51a6e9ae2a1aa18803e736ff8f5835e31d2ac62 Issue-ID: SDC-836 Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java28
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java39
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java32
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java16
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java4
5 files changed, 45 insertions, 74 deletions
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java
index f0bb253a4b..5753fa2a27 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java
@@ -1,22 +1,18 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2018 European Support Limited
+ *
* 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.sdc.heat.datatypes;
@@ -34,9 +30,11 @@ public class HeatBoolean {
private static Set<Object> heatFalse;
private static Set<Object> heatTrue;
+ private static final Logger LOG = LoggerFactory.getLogger(HeatBoolean.class.getName());
- private final static Logger log = (Logger) LoggerFactory.getLogger(HeatBoolean.class.getName());
-
+ private HeatBoolean() {
+ //Utility classes, which are a collection of static members, are not meant to be instantiated
+ }
static {
@@ -69,7 +67,7 @@ public class HeatBoolean {
public static Boolean eval(Object value) {
if (value instanceof String) {
- value = (String) ((String) value).toLowerCase();
+ value = ((String) value).toLowerCase();
}
if (heatFalse.contains(value)) {
return false;
@@ -91,10 +89,10 @@ public class HeatBoolean {
*/
public static boolean isValueBoolean(Object value) {
try {
- Boolean answer = eval(value);
+ eval(value);
return true;
} catch (CoreException ce) {
- log.debug("",ce);
+ LOG.error("Failed to evaluate value as boolean: {}", value, ce);
return false;
}
}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java
index 2b368a9f82..cf1bb99ab6 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java
@@ -1,22 +1,18 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2018 European Support Limited
+ *
* 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.sdc.heat.services.tree;
@@ -46,7 +42,7 @@ import java.util.Set;
public class HeatTreeManager {
- private static Logger logger = (Logger) LoggerFactory.getLogger(HeatTreeManager.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(HeatTreeManager.class);
private FileContentHandler heatContentMap = new FileContentHandler();
@@ -80,7 +76,7 @@ public class HeatTreeManager {
*/
public void createTree() {
if (manifest == null) {
- logger.error("Missing manifest file in the zip.");
+ LOGGER.error("Missing manifest file in the zip.");
return;
}
ManifestContent manifestData =
@@ -98,11 +94,11 @@ public class HeatTreeManager {
candidateOrphanArtifacts.entrySet().stream()
.forEach(entry -> tree.addArtifactToArtifactList(entry.getValue()));
nestedFiles
- .values().stream().filter(heatStructureTree -> tree.getHeat().contains(heatStructureTree))
- .forEach(heatStructureTree -> tree.getHeat().remove(heatStructureTree));
+ .values().stream().filter(tree.getHeat()::contains)
+ .forEach(tree.getHeat()::remove);
- heatContentMap.getFileList().stream().filter(fileName -> isNotInManifestFiles(fileName))
- .forEach(fileName -> addTreeOther(fileName));
+ heatContentMap.getFileList().stream().filter(this::isNotInManifestFiles)
+ .forEach(this::addTreeOther);
}
private boolean isNotInManifestFiles(String fileName) {
@@ -133,8 +129,8 @@ public class HeatTreeManager {
Set<String> artifactSet = HeatTreeManagerUtil.getArtifactFiles(fileName, hot, globalContext);
addHeatArtifactFiles(fileHeatStructureTree, artifactSet);
- } catch (Exception ignore) { /* invalid yaml no need to process reference */
- logger.debug("",ignore);
+ } catch (Exception ignore) {
+ LOGGER.debug("Invalid YAML received. No need to process content reference - ignoring", ignore);
}
}
@@ -176,10 +172,9 @@ public class HeatTreeManager {
*/
public void addErrors(Map<String, List<ErrorMessage>> validationErrors) {
- validationErrors.entrySet().stream().filter(entry -> {
+ validationErrors.entrySet().stream().filter(entry ->{
return fileTreeRef.get(entry.getKey()) != null;
- }).forEach(entry -> entry.getValue().stream().forEach(error ->
- fileTreeRef.get(entry.getKey()).addErrorToErrorsList(error)));
+ }).forEach(entry -> entry.getValue().stream().forEach(fileTreeRef.get(entry.getKey())::addErrorToErrorsList));
validationErrors.entrySet().stream().filter(entry -> {
return artifactRef.get(entry.getKey()) != null;
@@ -236,7 +231,6 @@ public class HeatTreeManager {
if (type == null) {
parentHeatStructureTree.addOtherToOtherList(childHeatStructureTree);
} else if (FileData.Type.HEAT_NET.equals(type)) {
- //parentHeatStructureTree.addNetworkToNetworkList(childHeatStructureTree);
networkFileToParent.put(childHeatStructureTree, parentHeatStructureTree);
if (fileData.getData() != null) {
scanTree(fileName, fileData.getData());
@@ -244,7 +238,6 @@ public class HeatTreeManager {
handleHeatContentReference(childHeatStructureTree, null);
} else if (FileData.Type.HEAT_VOL.equals(type)) {
- //parentHeatStructureTree.addVolumeFileToVolumeList(childHeatStructureTree);
volumeFileToParent.put(childHeatStructureTree, parentHeatStructureTree);
if (fileData.getData() != null) {
scanTree(fileName, fileData.getData());
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java
index d5e3f0bb41..ffd6107e08 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/test/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImplTest.java
@@ -1,29 +1,23 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2018 European Support Limited
+ *
* 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.sdc.enrichment.impl;
import org.openecomp.core.enrichment.factory.EnrichmentManagerFactory;
import org.openecomp.core.utilities.file.FileUtils;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.onap.sdc.tosca.datatypes.model.ServiceTemplate;
import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil;
@@ -35,7 +29,6 @@ import org.testng.annotations.Test;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -53,10 +46,6 @@ import static org.junit.Assert.assertEquals;
public class EnrichmentManagerImplTest {
- private final static Logger log = (Logger) LoggerFactory.getLogger
- (EnrichmentManagerImplTest.class.getName());
-
-
private static ToscaServiceModel loadToscaServiceModel(String serviceTemplatesPath,
String globalServiceTemplatesPath,
String entryDefinitionServiceTemplate)
@@ -103,15 +92,6 @@ public class EnrichmentManagerImplTest {
ServiceTemplate serviceTemplateFromYaml =
toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
serviceTemplates.put(file.getName(), serviceTemplateFromYaml);
- try {
- yamlFile.close();
- } catch (IOException ignore) {
- log.debug("",ignore);
- }
- } catch (FileNotFoundException e) {
- throw e;
- } catch (IOException e) {
- throw e;
}
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java
index 0f4dbf4d1c..c17b3e8393 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ForbiddenResourceGuideLineValidator.java
@@ -1,5 +1,5 @@
/*
- * Copyright © 2016-2017 European Support Limited
+ * Copyright © 2018 European Support Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -12,10 +12,15 @@
* 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.
- */
+*/
package org.openecomp.sdc.validation.impl.validators;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
import org.apache.commons.collections4.MapUtils;
import org.openecomp.core.validation.ErrorMessageCode;
import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder;
@@ -32,11 +37,6 @@ import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.validation.Validator;
import org.openecomp.sdc.validation.util.ValidationUtil;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-
public class ForbiddenResourceGuideLineValidator implements Validator {
private static Set<String> forbiddenResources = new HashSet<>();
private static final ErrorMessageCode ERROR_CODE_FRG_1 = new ErrorMessageCode("FRG1");
@@ -75,7 +75,7 @@ public class ForbiddenResourceGuideLineValidator implements Validator {
try {
manifestContent = ValidationUtil.validateManifest(globalContext);
} catch (Exception exception) {
- LOGGER.debug("",exception);
+ LOGGER.error("Failed to validate manifest file", exception);
return;
}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java
index 6a2a0a9528..961fd848aa 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java
@@ -316,7 +316,7 @@ public class HeatValidator implements Validator {
throw new Exception("The file '" + resourceType + "' has no content");
}
} catch (Exception exception) {
- LOGGER.debug("",exception);
+ LOGGER.error("Invalid yaml file", exception);
return;
}
nestedOutputMap = nestedHeatOrchestrationTemplate.getOutputs();
@@ -481,7 +481,7 @@ public class HeatValidator implements Validator {
try {
manifestContent = ValidationUtil.validateManifest(globalContext);
} catch (Exception exception) {
- LOGGER.debug("",exception);
+ LOGGER.error("Failed to validate manifest file", exception);
return;
}
Map<String, FileData.Type> fileTypeMap = ManifestUtil.getFileTypeMap(manifestContent);