Examples of ValidationResults


Examples of org.apache.bval.ValidationResults

        MetaBean info = finder.findForClass(BusinessObject.class);
        BusinessObject object = new BusinessObject();
        object.setAddress(new BusinessObjectAddress());
        object.getAddress().setOwner(object);
        BeanValidator<ValidationResults> validator = new BeanValidator<ValidationResults>();
        ValidationResults results = validator.validate(object, info);
        assertTrue(results.hasErrorForReason(Reasons.MANDATORY));
        assertTrue(results.hasError(object, null));
        assertTrue(results.hasError(object.getAddress(), null));

        assertTrue(
              validator.validateProperty(object, info.getProperty("firstName")).hasError(
                    object, "firstName"));
View Full Code Here

Examples of org.apache.bval.ValidationResults

              .findForId("org.apache.bval.example.Address");

        // 1. validate a bean
        BusinessObjectAddress adr = new BusinessObjectAddress();
        BeanValidator<ValidationResults> validator = new BeanValidator();
        ValidationResults results = validator.validate(adr, mb);
        assertEquals(2,
              results.getErrorsByReason().get(Features.Property.MANDATORY).size());

        // 2. validate a map with the same metabean
        validator.setTreatMapsLikeBeans(true);
        results = validator.validate(new HashMap(), mb);
        assertFalse(results.isEmpty());
        assertEquals(2,
              results.getErrorsByReason().get(Features.Property.MANDATORY).size());

        // 3. validate as empty map (jsr303 behavior)
        validator.setTreatMapsLikeBeans(false);
        results = validator.validate(new HashMap(), mb);
        assertTrue(results.isEmpty());
    }
View Full Code Here

Examples of org.apache.bval.ValidationResults

        MetaBean info = finder.findForClass(BusinessObject.class);
        BusinessObject object = new BusinessObject();
        object.setAddress(new BusinessObjectAddress());
        object.getAddress().setOwner(object);
        BeanValidator<ValidationResults> validator = new BeanValidator();
        ValidationResults results = validator.validate(object, info);
        assertTrue(results.hasErrorForReason(Reasons.MANDATORY));
        assertTrue(results.hasError(object, null));
        assertTrue(results.hasError(object.getAddress(), null));

        assertTrue(
              validator.validateProperty(object, info.getProperty("firstName")).hasError(
                    object, "firstName"));
View Full Code Here

Examples of org.fcrepo.client.utility.validate.ValidationResults

                    new ValidatorProcessParameters(args);

            // Create the tools we will need.
            RemoteObjectSource objectSource =
                    openObjectSource(parms.getServiceInfo());
            ValidationResults results =
                    new SimpleValidationResults(parms.getVerbose());

            // Get the list of PIDs.
            Iterator<String> pids = getPidIterator(parms, objectSource);

            // Go through the list, validating.
            ObjectValidator validator = new ObjectValidator(objectSource);
            while (pids.hasNext()) {
                results.record(validator.validate(pids.next()));
            }

            // Display the results.
            results.closeResults();
        } catch (ValidatorProcessUsageException e) {
            System.err.println(e.getMessage());
        }
    }
View Full Code Here

Examples of org.geotools.validation.ValidationResults

      //of that, and I don't want normal transaction stuff messed up. ch
            LOGGER.warning("ValidationProcessor unavailable");
      return;
    }
        final Map failed = new TreeMap();
        ValidationResults results = new ValidationResults() {
                String name;
                String description;
                public void setValidation(Validation validation) {
                    name = validation.getName();
                    description = validation.getDescription();
View Full Code Here

Examples of org.geotools.validation.ValidationResults

                sources.put( typeRef, meta.getFeatureSource());                                               
            }
        }
        LOGGER.finer( "Total of "+sources.size()+" featureSource marshalled for testing" );
        final Map failed = new TreeMap();
        ValidationResults results = new ValidationResults() {
                String name;
                String description;

                public void setValidation(Validation validation) {
                    name = validation.getName();
View Full Code Here

Examples of org.springframework.binding.validation.ValidationResults

    this.delegateFor = delegateFor;
  }

  public void updateValidationResults(ValidationResults newValidationResults) {
    Assert.required(newValidationResults, "newValidationResults");
    ValidationResults oldValidationResults = validationResults;
    validationResults = newValidationResults;
    if (oldValidationResults.getMessageCount() == 0 && validationResults.getMessageCount() == 0) {
      return;
    }
    fireChangedEvents();
    for (Iterator i = propertyValidationListeners.keySet().iterator(); i.hasNext();) {
      String propertyName = (String) i.next();
      if (oldValidationResults.getMessageCount(propertyName) > 0
          || validationResults.getMessageCount(propertyName) > 0) {
        fireValidationResultsChanged(propertyName);
      }
    }
  }
View Full Code Here

Examples of org.springframework.binding.validation.ValidationResults

  }

  // TODO: test
  public void addMessage(ValidationMessage validationMessage) {
    if (!validationResults.getMessages().contains(validationMessage)) {
      ValidationResults oldValidationResults = validationResults;
      List newMessages = new ArrayList(oldValidationResults.getMessages());
      newMessages.add(validationMessage);
      validationResults = new DefaultValidationResults(newMessages);
      fireChangedEvents();
      fireValidationResultsChanged(validationMessage.getProperty());
    }
View Full Code Here

Examples of org.springframework.binding.validation.ValidationResults

  }

  // TODO: test
  public void removeMessage(ValidationMessage validationMessage) {
    if (validationResults.getMessages().contains(validationMessage)) {
      ValidationResults oldValidationResults = validationResults;
      List newMessages = new ArrayList(oldValidationResults.getMessages());
      newMessages.remove(validationMessage);
      validationResults = new DefaultValidationResults(newMessages);
      fireChangedEvents();
      fireValidationResultsChanged(validationMessage.getProperty());
    }
View Full Code Here

Examples of org.springframework.binding.validation.ValidationResults

    }
  }

  // TODO: test
  public void replaceMessage(ValidationMessage messageToReplace, ValidationMessage replacementMessage) {
    ValidationResults oldValidationResults = validationResults;
    List newMessages = new ArrayList(oldValidationResults.getMessages());
    final boolean containsMessageToReplace = validationResults.getMessages().contains(messageToReplace);
    if (containsMessageToReplace) {
      newMessages.remove(messageToReplace);
    }
    newMessages.add(replacementMessage);
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.