diff options
author | 2017-12-22 11:03:21 +0530 | |
---|---|---|
committer | 2017-12-24 14:43:46 +0000 | |
commit | 1cf48f3c80c97813b0f18174e35ff100204c5887 (patch) | |
tree | 5b575de6fbe1139d658784f02a02ea730431bdd6 /openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org | |
parent | bc7d6b9adf24397f459e4090ac55d7de1b4f1eb5 (diff) |
Fixed sonar issues - NovaServerResourceValidator
Fixed all sonar issues
Change-Id: I4ee3a6fdc33a3874ce36d32296ab508ee7089468
Issue-ID: SDC-343
Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org')
-rw-r--r-- | openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java index 33d20d5714..7d8ab251b9 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/heatresource/NovaServerResourceValidator.java @@ -1,3 +1,19 @@ +/* + * Copyright © 2016-2017 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. + */ + package org.openecomp.sdc.validation.impl.validators.heatresource; import org.apache.commons.collections4.MapUtils; @@ -20,21 +36,19 @@ import org.openecomp.sdc.validation.type.HeatResourceValidationContext; import java.util.Map; -/** - * Created by TALIO on 2/22/2017. - */ public class NovaServerResourceValidator implements ResourceValidator { - private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); + private static final MdcDataDebugMessage MDC_DATA_DEBUG_MESSAGE = new MdcDataDebugMessage(); private static final ErrorMessageCode ERROR_CODE_HNS1 = new ErrorMessageCode("HNS1"); private static final ErrorMessageCode ERROR_CODE_HNS2 = new ErrorMessageCode("HNS2"); + @Override public void validate(String fileName, Map.Entry<String, Resource> resourceEntry, GlobalValidationContext globalContext, ValidationContext validationContext) { HeatResourceValidationContext heatResourceValidationContext = (HeatResourceValidationContext) validationContext; - validateNovaServerResourceType - (fileName, resourceEntry, heatResourceValidationContext, globalContext); + validateNovaServerResourceType (fileName, + resourceEntry, heatResourceValidationContext, globalContext ); } private static void validateNovaServerResourceType(String fileName, @@ -42,14 +56,13 @@ public class NovaServerResourceValidator implements ResourceValidator { HeatResourceValidationContext heatResourceValidationContext, GlobalValidationContext globalContext) { - mdcDataDebugMessage.debugEntryMessage("file", fileName); + MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("file", fileName); validateAssignedValueForImageOrFlavorFromNova(fileName, resourceEntry, globalContext); - validateAllServerGroupsPointedByServerExistAndDefined - (fileName, resourceEntry, - heatResourceValidationContext.getHeatOrchestrationTemplate(), globalContext); + validateAllServerGroupsPointedByServerExistAndDefined (fileName, + resourceEntry, heatResourceValidationContext.getHeatOrchestrationTemplate(), globalContext ); - mdcDataDebugMessage.debugExitMessage("file", fileName); + MDC_DATA_DEBUG_MESSAGE.debugExitMessage("file", fileName); } @@ -59,7 +72,7 @@ public class NovaServerResourceValidator implements ResourceValidator { GlobalValidationContext globalContext) { - mdcDataDebugMessage.debugEntryMessage("file", fileName); + MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("file", fileName); Resource resource = resourceEntry.getValue(); Map<String, Object> propertiesMap = resource.getProperties(); @@ -72,7 +85,7 @@ public class NovaServerResourceValidator implements ResourceValidator { LoggerErrorDescription.MISSING_NOVA_PROPERTIES); } - mdcDataDebugMessage.debugExitMessage("file", fileName); + MDC_DATA_DEBUG_MESSAGE.debugExitMessage("file", fileName); } @SuppressWarnings("unchecked") @@ -81,7 +94,7 @@ public class NovaServerResourceValidator implements ResourceValidator { HeatOrchestrationTemplate heatOrchestrationTemplate, GlobalValidationContext globalContext) { - mdcDataDebugMessage.debugEntryMessage("file", fileName); + MDC_DATA_DEBUG_MESSAGE.debugEntryMessage("file", fileName); Map<String, Resource> resourcesMap = heatOrchestrationTemplate.getResources(); Map<String, Object> resourceProperties = resourceEntry.getValue().getProperties(); @@ -93,6 +106,14 @@ public class NovaServerResourceValidator implements ResourceValidator { return; } + validateServerGroupValue(fileName, resourceEntry, globalContext, resourcesMap, schedulerHintsMap); + + MDC_DATA_DEBUG_MESSAGE.debugExitMessage("file", fileName); + } + + private static void validateServerGroupValue(String fileName, Map.Entry<String, + Resource> resourceEntry, GlobalValidationContext globalContext, + Map<String, Resource> resourcesMap, Map<String, Object> schedulerHintsMap) { if (schedulerHintsMap != null) { for (Object serverGroupValue : schedulerHintsMap.values()) { if (!(serverGroupValue instanceof Map)) { @@ -115,8 +136,6 @@ public class NovaServerResourceValidator implements ResourceValidator { } } } - - mdcDataDebugMessage.debugExitMessage("file", fileName); } } |