Package com.vmware.bdd.utils

Examples of com.vmware.bdd.utils.ValidateResult


   private void validateConfiguration(ClusterCreate cluster,
         boolean skipConfigValidation, List<String> warningMsgList,
         List<String> failedMsgList) {

      // validate blacklist
      ValidateResult blackListResult = validateBlackList(cluster);
      addBlackListWarning(blackListResult, warningMsgList);

      if (!skipConfigValidation) {
         // validate config type
         AppConfigValidationUtils.validateSupportType(
               cluster.getConfiguration(), warningMsgList);
         // validate whitelist
         ValidateResult whiteListResult = validateWhiteList(cluster);
         addWhiteListWarningOrFailure(cluster.getName(), whiteListResult,
               warningMsgList, failedMsgList);
      } else {
         cluster.setValidateConfig(false);
      }
View Full Code Here


    * of all of node groups then. And merge the failed info which have been
    * producted by validation between cluster level and node group level.
    */
   private ValidateResult validateConfiguration(ClusterCreate cluster,
         ValidationType validationType) {
      ValidateResult validateResult = new ValidateResult();
      // validate cluster level Configuration
      ValidateResult vr = null;
      if (cluster.getConfiguration() != null
            && !cluster.getConfiguration().isEmpty()) {
         vr =
               AppConfigValidationUtils.validateConfig(validationType,
                     cluster.getConfiguration());
         if (vr.getType() != ValidateResult.Type.VALID) {
            validateResult.setType(vr.getType());
            if (!vr.getFailureNames().isEmpty()) {
               validateResult.setFailureNames(vr.getFailureNames());
            }
            if (!vr.getFailureValues().isEmpty()) {
               validateResult.setFailureValues(vr.getFailureValues());
            }
            if (!vr.getNoExistFileNames().isEmpty()) {
               validateResult.setNoExistFileNames(vr.getNoExistFileNames());
            }
         }
      }
      List<String> failureNames = new ArrayList<String>();
      Map<String, List<String>> noExistingFileNamesMap =
            new HashMap<String, List<String>>();
      List<String> failureValues = new ArrayList<String>();
      if (!validateResult.getFailureNames().isEmpty()) {
         failureNames.addAll(validateResult.getFailureNames());
      }
      if (!validateResult.getNoExistFileNames().isEmpty()) {
         noExistingFileNamesMap.putAll(validateResult.getNoExistFileNames());
      }
      if (!validateResult.getFailureValues().isEmpty()) {
         failureValues.addAll(validateResult.getFailureValues());
      }

      // validate nodegroup level Configuration
      for (NodeGroupCreate nodeGroup : cluster.getNodeGroups()) {
         if (nodeGroup.getConfiguration() != null
               && !nodeGroup.getConfiguration().isEmpty()) {
            vr =
                  AppConfigValidationUtils.validateConfig(validationType,
                        nodeGroup.getConfiguration());
            if (vr.getType() != ValidateResult.Type.VALID) {
               //invalid value will take higher priority than invalid name as it will throw failure
               if (validateResult.getType() != ValidateResult.Type.WHITE_LIST_INVALID_VALUE) {
                  validateResult.setType(vr.getType());
               }
               // merge failed names between cluster level and node group level.
               for (String failureName : vr.getFailureNames()) {
                  if (!failureNames.contains(failureName)) {
                     failureNames.add(failureName);
                  }
               }

               // merge failed names between cluster level and node group level.
               for (String failureValue : vr.getFailureValues()) {
                  if (!failureValues.contains(failureValue)) {
                     failureValues.add(failureValue);
                  }
               }

               // merge no existing file names between cluster level and node
               // group level
               for (Entry<String, List<String>> noExistingFileNames : vr
                     .getNoExistFileNames().entrySet()) {
                  String configType = noExistingFileNames.getKey();
                  if (noExistingFileNamesMap.containsKey(configType)) {
                     List<String> noExistingFilesTemp =
                           noExistingFileNames.getValue();
View Full Code Here

TOP

Related Classes of com.vmware.bdd.utils.ValidateResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.