diff options
author | Abhai Singh <Abhai.Singh@amdocs.com> | 2017-11-20 18:27:50 +0530 |
---|---|---|
committer | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2017-11-20 16:17:18 +0000 |
commit | 66ed5840294585b55bc632944f19b859d389b3d2 (patch) | |
tree | 1e870df0ce3985b3287d053abf620ebee99e18f6 /openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src | |
parent | 746d3c490eaf8c92ca6125be97371720f4c8f7c9 (diff) |
Adding error codes to HEAT Validator
Added error code to SharedResourceGuideLineValidator
Issue-Id :SDC-572
Change-Id: I20c014a1aeb488788bc1faeb05a89ff920258275
Signed-off-by: Abhai Singh <Abhai.Singh@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src')
-rw-r--r-- | openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java | 43 |
1 files changed, 3 insertions, 40 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java index 217ff857f6..d9e0351578 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java @@ -2,7 +2,6 @@ package org.openecomp.sdc.validation.util; import org.apache.commons.collections4.CollectionUtils; -import org.openecomp.core.utilities.CommonMethods; import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder; import org.openecomp.core.validation.types.GlobalValidationContext; @@ -16,7 +15,6 @@ import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.heat.datatypes.model.ResourceReferenceFunctions; import org.openecomp.sdc.heat.services.HeatStructureUtil; -import org.openecomp.sdc.heat.services.manifest.ManifestUtil; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; @@ -229,8 +227,9 @@ public class ValidationUtil { } } catch (Exception exception) { globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder - .getErrorWithParameters(Messages.INVALID_HEAT_FORMAT_REASON.getErrorMessage(), - getParserExceptionReason(exception)), + .getErrorWithParameters(globalContext.getMessageCode(), + Messages.INVALID_HEAT_FORMAT_REASON.getErrorMessage() + , getParserExceptionReason(exception)), LoggerTragetServiceName.VALIDATE_HEAT_FORMAT, LoggerErrorDescription.INVALID_HEAT_FORMAT); mdcDataDebugMessage.debugExitMessage("file", fileName); @@ -240,41 +239,5 @@ public class ValidationUtil { return heatOrchestrationTemplate; } - public static Set<String> validateManifest(ManifestContent manifestContent, - GlobalValidationContext globalContext) { - - mdcDataDebugMessage.debugEntryMessage("file", SdcCommon.MANIFEST_NAME); - - Set<String> baseFiles = ManifestUtil.getBaseFiles(manifestContent); - if (baseFiles == null || baseFiles.size() == 0) { - globalContext.addMessage( - SdcCommon.MANIFEST_NAME, - ErrorLevel.WARNING, - ErrorMessagesFormatBuilder - .getErrorWithParameters(Messages.MISSIN_BASE_HEAT_FILE.getErrorMessage()), - LoggerTragetServiceName.VALIDATE_BASE_FILE, - LoggerErrorDescription.MISSING_BASE_HEAT); - } else if (baseFiles.size() > 1) { - String baseFileList = getElementListAsString(baseFiles); - globalContext.addMessage( - SdcCommon.MANIFEST_NAME, - ErrorLevel.WARNING, - ErrorMessagesFormatBuilder - .getErrorWithParameters(Messages.MULTI_BASE_HEAT_FILE.getErrorMessage(), - baseFileList), - LoggerTragetServiceName.VALIDATE_BASE_FILE, - LoggerErrorDescription.MULTI_BASE_HEAT); - } - - mdcDataDebugMessage.debugExitMessage("file", SdcCommon.MANIFEST_NAME); - return baseFiles; - } - - private static String getElementListAsString(Set<String> elementCollection) { - - return "[" - + CommonMethods.collectionToCommaSeparatedString(elementCollection) - + "]"; - } } |