From 3e54d3de51fa86255ca5059c59fd68aea0f59488 Mon Sep 17 00:00:00 2001 From: talio Date: Thu, 16 Nov 2017 10:05:26 +0200 Subject: nova server validator fixed validation of nova server name value inside env file Issue - Id : SDC-670 Change-Id: If407a2c1f601b4b724c50c1994fd056b569588ac Signed-off-by: talio --- .../NovaServerNamingConventionGuideLineValidator.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src') diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java index 299eabf4e5..0a7ff879fd 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/namingconvention/NovaServerNamingConventionGuideLineValidator.java @@ -389,7 +389,7 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal if (nonNull(novaNameGetParam)) { novaName = checkNovaNameGetParamValueMap(fileName, novaNameGetParam, resourceEntry, globalContext); - checkIfNovaNameParameterInEnvIsStringOrList(fileName, envFileName, resourceEntry, novaName, + checkIfNovaNameParameterInEnvIsStringOrList(fileName, envFileName, novaName, resourceEntry, globalContext); } else { globalContext.addMessage( @@ -457,7 +457,7 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal if (getParamValue instanceof List) { List getParamNameList = (List) getParamValue; String[] regexName = new String[]{".*_names"}; - return isNovaNameAsListLegal(fileName, getParamNameList, regexName, resourceEntry, + return isNovaNameAsListLegal(fileName, regexName, getParamNameList, resourceEntry, globalContext); } else if (getParamValue instanceof String) { String[] regexName = new String[]{".*_name_(\\d+)"}; @@ -468,9 +468,10 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal return null; } - private void checkIfNovaNameParameterInEnvIsStringOrList(String fileName, String envFileName, - Map.Entry resourceEntry, + private void checkIfNovaNameParameterInEnvIsStringOrList(String fileName, + String envFileName, String novaServerName, + Map.Entry resourceEntry, GlobalValidationContext globalContext) { if (nonNull(envFileName)) { Environment environment = ValidationUtil.validateEnvContent(envFileName, globalContext); @@ -495,8 +496,9 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal } } - private String isNovaNameAsListLegal(String fileName, List getParamNameList, + private String isNovaNameAsListLegal(String fileName, String[] regexName, + List getParamNameList, Map.Entry resourceEntry, GlobalValidationContext globalContext) { @@ -516,7 +518,9 @@ public class NovaServerNamingConventionGuideLineValidator implements ResourceVal return (String) getParamNameList.get(0); } - private String isNovaNameAsStringLegal(String fileName, String novaName, String[] regexName, + private String isNovaNameAsStringLegal(String fileName, + String novaName, + String[] regexName, Map.Entry resourceEntry, GlobalValidationContext globalContext) { if (!ValidationUtil.evalPattern(novaName, regexName)) { -- cgit 1.2.3-korg