Examples of ValidateResult


Examples of com.vmware.bdd.apitypes.ValidateResult

   public ValidateResult validateBlueprint(@RequestBody ClusterCreate createSpec) {
      SoftwareManager softwareManager =
            clusterMgr.getClusterConfigMgr().getSoftwareManager(
                  createSpec.getAppManager());
      ClusterBlueprint blueprint = createSpec.toBlueprint();
      ValidateResult result = new ValidateResult();
      boolean validated = false;
      try {
         validated = softwareManager.validateBlueprint(blueprint);
      } catch (ValidationException ve) {
         result.setFailedMsgList(ve.getFailedMsgList());
         result.setWarningMsgList(ve.getWarningMsgList());
      }
      result.setValidated(validated);
      return result;
   }
View Full Code Here

Examples of com.vmware.bdd.apitypes.ValidateResult

       network.setName("dhcp");
       network.setDhcp(true);
       network.setPortGroup("pg1");
       networks[0] = network;

       ValidateResult vr = new ValidateResult();
       vr.setValidated(true);

       ObjectMapper mapper = new ObjectMapper();
       buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/appmanager/Default/defaultdistro", HttpMethod.GET, HttpStatus.OK,
             mapper.writeValueAsString(distros[0]));
       buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/networks", HttpMethod.GET, HttpStatus.OK,
View Full Code Here

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

Examples of com.vmware.bdd.utils.ValidateResult

    * 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

Examples of eu.planets_project.services.validate.ValidateResult

        ServiceReport sr = new ServiceReport(Type.INFO, Status.SUCCESS, message);
        log.info(message);
        if (dob == null) {
            return new ValidateResult.Builder(format, sr).build();
        } else {
            ValidateResult result = new ValidateResult.Builder(format, sr)
                    .ofThisFormat(true).validInRegardToThisFormat(true).build();
            return result;
        }
    }
View Full Code Here

Examples of eu.planets_project.services.validate.ValidateResult

   
    CoreOdfValidator odfValidator = new CoreOdfValidator();
   
    OdfValidatorResult result = odfValidator.validate(inputOdfFile, parameters);
   
    ValidateResult vr = null;
   
    if(result.documentIsValid()) {
      vr = new ValidateResult.Builder(format,
                  new ServiceReport(Type.INFO, Status.SUCCESS, result.getValidationResultAsString()))
                  .ofThisFormat(result.isOdfFile())
View Full Code Here

Examples of eu.planets_project.services.validate.ValidateResult

                    "Unsupported format: " + format);
        } else {
            valid = basicValidateOneBinary(digitalObject, format);
            report = new ServiceReport(Type.INFO, Status.SUCCESS, "OK");
        }
        ValidateResult result = new ValidateResult.Builder(format, report)
                .ofThisFormat(valid).build();
        return result;
    }
View Full Code Here

Examples of eu.planets_project.services.validate.ValidateResult

        Assert.assertTrue("Validation failed for: " + f, b);
    }
   
    @Test
    public void testUnsupported() throws MalformedURLException {
        ValidateResult vr = jhove.validate(new DigitalObject.Builder(Content
                .byReference(new File(TestFile.BMP.getLocation()).toURI()
                        .toURL())).build(), TestFile.BMP.getTypes().iterator()
                .next(), null);
        ServiceReport report = vr.getReport();
        /*
         * If validation was attempted for an unsupported format, the report
         * will be of type ERROR:
         */
        Assert.assertEquals(ServiceReport.Type.ERROR, report.getType());
View Full Code Here

Examples of eu.planets_project.services.validate.ValidateResult

        System.err.println("Report message: " + report.getMessage());
    }
   
    @Test
    public void testInvalid() throws MalformedURLException {
        ValidateResult vr = jhove.validate(new DigitalObject.Builder(Content
                .byReference(new File(TestFile.XML.getLocation()).toURI()
                        .toURL())).build(), TestFile.PDF.getTypes().iterator()
                .next(), null);
        Assert.assertFalse("Invalid should be invalidated; ", vr
                .isValidInRegardToThisFormat()
                && vr.isOfThisFormat());
    }
View Full Code Here

Examples of eu.planets_project.services.validate.ValidateResult

   * {@inheritDoc}
     * @see Validate#validate(eu.planets_project.services.datatypes.DigitalObject, java.net.URI, eu.planets_project.services.datatypes.Parameter)
   */
  public ValidateResult validate(final DigitalObject o, final URI fmt, List<Parameter> paramenters)
  {
    ValidateResult result;
    File tempFile =  DigitalObjectUtils.toFile(o);
    boolean valid = basicValidateOneBinary(tempFile, fmt);

    result = new ValidateResult.Builder(fmt, new ServiceReport(Type.INFO,
                Status.SUCCESS, "OK")).ofThisFormat(valid).build();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.