Examples of ValidationProcessor


Examples of com.github.fge.jsonschema.processors.validation.ValidationProcessor

        loader = new SchemaLoader(loadingCfg);
        final Processor<SchemaContext, ValidatorList> processor
            = buildProcessor();
        validator = new JsonValidator(loader,
            new ValidationProcessor(validationCfg, processor), reportProvider);
        syntaxValidator = new SyntaxValidator(validationCfg);
    }
View Full Code Here

Examples of com.sun.xml.internal.ws.api.policy.ValidationProcessor

     * @param policyMap
     *      PolicyMap that needs to be validated.
     */
    private void validateServerPolicyMap(PolicyMap policyMap) {
        try {
            final ValidationProcessor validationProcessor = ValidationProcessor.getInstance();

            for (Policy policy : policyMap) {

                // TODO:  here is a good place to check if the actual policy has only one alternative...

                for (AssertionSet assertionSet : policy) {
                    for (PolicyAssertion assertion : assertionSet) {
                        Fitness validationResult = validationProcessor.validateServerSide(assertion);
                        if (validationResult != Fitness.SUPPORTED) {
                            throw new PolicyException(PolicyMessages.WSP_1015_SERVER_SIDE_ASSERTION_VALIDATION_FAILED(
                                    assertion.getName(),
                                    validationResult));
                        }
View Full Code Here

Examples of com.sun.xml.ws.api.policy.ValidationProcessor

     * @param policyMap
     *      PolicyMap that needs to be validated.
     */
    private void validateServerPolicyMap(PolicyMap policyMap) {
        try {
            final ValidationProcessor validationProcessor = ValidationProcessor.getInstance();

            for (Policy policy : policyMap) {

                // TODO:  here is a good place to check if the actual policy has only one alternative...

                for (AssertionSet assertionSet : policy) {
                    for (PolicyAssertion assertion : assertionSet) {
                        Fitness validationResult = validationProcessor.validateServerSide(assertion);
                        if (validationResult != Fitness.SUPPORTED) {
                            throw new PolicyException(PolicyMessages.WSP_1015_SERVER_SIDE_ASSERTION_VALIDATION_FAILED(
                                    assertion.getName(),
                                    validationResult));
                        }
View Full Code Here

Examples of com.sun.xml.ws.api.policy.ValidationProcessor

     * @param policyMap
     *      PolicyMap that needs to be validated.
     */
    private void validateServerPolicyMap(PolicyMap policyMap) {
        try {
            final ValidationProcessor validationProcessor = ValidationProcessor.getInstance();

            for (Policy policy : policyMap) {

                // TODO:  here is a good place to check if the actual policy has only one alternative...

                for (AssertionSet assertionSet : policy) {
                    for (PolicyAssertion assertion : assertionSet) {
                        Fitness validationResult = validationProcessor.validateServerSide(assertion);
                        if (validationResult != Fitness.SUPPORTED) {
                            throw new PolicyException(PolicyMessages.WSP_1015_SERVER_SIDE_ASSERTION_VALIDATION_FAILED(
                                    assertion.getName(),
                                    validationResult));
                        }
View Full Code Here

Examples of com.sun.xml.ws.api.policy.ValidationProcessor

     * @param policyMap
     *      PolicyMap that needs to be validated.
     */
    private static void validateServerPolicyMap(PolicyMap policyMap) {
        try {
            final ValidationProcessor validationProcessor = ValidationProcessor.getInstance();

            for (Policy policy : policyMap) {

                // TODO:  here is a good place to check if the actual policy has only one alternative...

                for (AssertionSet assertionSet : policy) {
                    for (PolicyAssertion assertion : assertionSet) {
                        Fitness validationResult = validationProcessor.validateServerSide(assertion);
                        if (validationResult != Fitness.SUPPORTED) {
                            throw new PolicyException(LocalizationMessages.WSP_5017_SERVER_SIDE_ASSERTION_VALIDATION_FAILED(
                                    assertion.getName(),
                                    validationResult));
                        }
View Full Code Here

Examples of eu.maydu.gwt.validation.client.ValidationProcessor

 
  public void testRemoveValidators() {
    DummyValidator val = new DummyValidator();
    DummyValidator val2 = new DummyValidator();
   
    ValidationProcessor proc = new DefaultValidationProcessor(null);
   
    proc.addValidators("test", val);
    proc.addValidators("test2", val2);
   
    assertEquals("Two validators were added!", 2, proc.getValidatorCount());
   
    proc.validate();
   
    assertEquals("1 validation invocation occured!", 1, val.validationInvocationCount);
    assertEquals("1 validation invocation occured!", 1, val2.validationInvocationCount);
    assertEquals("0 action invocation occured!", 0, val.actionInvocationCount);
    assertEquals("0 action invocation occured!", 0, val2.actionInvocationCount);
    assertEquals("0 actionReset invocations occured!", 0, val.resetActionCount);
    assertEquals("0 actionReset invocations occured!", 0, val2.resetActionCount);
   
    proc.removeValidators("test2");
   
    proc.validate();
   
    assertEquals("2 validation invocation occured!", 2, val.validationInvocationCount);
    assertEquals("1 validation invocation occured!", 1, val2.validationInvocationCount);
    assertEquals("0 action invocation occured!", 0, val.actionInvocationCount);
    assertEquals("0 action invocation occured!", 0, val2.actionInvocationCount);
    assertEquals("1 actionReset invocations occured!", 1, val.resetActionCount);
    assertEquals("0 actionReset invocations occured!", 0, val2.resetActionCount);
   
    assertEquals("Only one validator is left!", 1, proc.getValidatorCount())
   
    proc.removeAllValidators();
    val.clearStats();
    val2.clearStats();
   
    proc.addValidators("test", val);
    proc.addValidators("test2", val2);
   
    assertEquals("Two validators were added!", 2, proc.getValidatorCount());
   
    proc.validate();
   
    assertEquals("1 validation invocation occured!", 1, val.validationInvocationCount);
    assertEquals("1 validation invocation occured!", 1, val2.validationInvocationCount);
    assertEquals("0 action invocation occured!", 0, val.actionInvocationCount);
    assertEquals("0 action invocation occured!", 0, val2.actionInvocationCount);
    assertEquals("0 actionReset invocations occured!", 0, val.resetActionCount);
    assertEquals("0 actionReset invocations occured!", 0, val2.resetActionCount);
   
    proc.removeValidators("test2");
   
    proc.validate();
   
    assertEquals("2 validation invocation occured!", 2, val.validationInvocationCount);
    assertEquals("1 validation invocation occured!", 1, val2.validationInvocationCount);
    assertEquals("0 action invocation occured!", 0, val.actionInvocationCount);
    assertEquals("0 action invocation occured!", 0, val2.actionInvocationCount);
    assertEquals("1 actionReset invocations occured!", 1, val.resetActionCount);
    assertEquals("0 actionReset invocations occured!", 0, val2.resetActionCount);
   
    assertEquals("Only one validator is left!", 1, proc.getValidatorCount());
  }
View Full Code Here

Examples of eu.maydu.gwt.validation.client.ValidationProcessor

 
  public void testRemoveAllValidators() {
    DummyValidator val = new DummyValidator();
    DummyValidator val2 = new DummyValidator();
   
    ValidationProcessor proc = new DefaultValidationProcessor(null);
   
    proc.addValidators("test", val);
    proc.addValidators("test2", val2);
   
    assertEquals("Two validators were added!", 2, proc.getValidatorCount());
   
    proc.removeAllValidators();
   
    assertEquals("No validator is left!", 0, proc.getValidatorCount());   
  }
View Full Code Here

Examples of org.geotools.validation.ValidationProcessor

    store.addFeatures( riverFeatures );
   
    //
    // SETUP
    //
    ValidationProcessor processor = new ValidationProcessor();

    // normally you load definition from file
    // Here we are doing it by hand   
    IsValidGeometryValidation geom = new IsValidGeometryValidation();
    geom.setName( "IsValidGeometry");
    geom.setDescription("IsValid geomtry check");
    geom.setTypeRef("*"); // works on any feature type
    processor.addValidation( geom );

    //
    // TESTING
    //
   
    // Create a ValidationResults callback object to receive
    // any warnings or errors
    //
    // Normally you implement this as a callback to your application;
    // here we will use a default implementation here that adds results to a list
    DefaultFeatureResults results = new DefaultFeatureResults();

    // test a featureCollection
    processor.runFeatureTests( "dataStoreId", roadFeatures, results);

    // and check the results
    System.out.println("Found "+ results.error.size() + " failires" );
    // validationExample end
}
View Full Code Here

Examples of org.geotools.validation.ValidationProcessor

    // validationExample2 start

    // set up a validation processor using two directories of
    // configuraiton files
    ValidationProcessor processor = new ValidationProcessor();
    processor.load( pluginDirectory, testSuiteDirectory );

    // normally you load definition from file
    // it will load all the files in the provided directories
    processor.load( pluginDirectory, testSuiteDirectory );

    DefaultFeatureResults results = new DefaultFeatureResults();

        // To run integrity tests (that compare several featureSources we need
    // to make a Map of FeatureSources.
    // the *key* is called the "typeRef" and will be used by test suites
    // to refer to look up a featureSource as needed
    Map<String,SimpleFeatureSource> map = new HashMap<String,SimpleFeatureSource>();
   
    // register in map so validation processor can find it
    map.put( "LAKES:lakes",  lakesFeatureSource );
    map.put( "STREAMS:streams", streamsFeatureSource );
    // optional shortlist of layers to check (these are usually the layers your
    // user modified)
    Set<Name> check = new HashSet<Name>();
    check.add( new NameImpl("LAKES:lakes"));
   
    processor.runIntegrityTests( check, map, null, results);

    // and check the results
    System.out.println("Found "+ results.error.size() + " failires" );
    // validationExample2 end
}
View Full Code Here

Examples of org.geotools.validation.ValidationProcessor

        FeatureCollection collection)
        throws IOException, WfsTransactionException {
       
        LOGGER.finer("FeatureValidation called on "+dsid+":"+type.getTypeName() );
       
        ValidationProcessor validation = request.getValidationProcessor();
    if (validation == null){
      //This is a bit hackish, as the validation processor should not
      //be null, but confDemo gives us a null processor right now, some
      //thing to do with no test element in the xml files in validation.
      //But I'm taking no validation process to mean that we can't do
      //any validation.  Hopefully this doesn't mess people up?
      //could mess up some validation stuff, but not everyone makes use
      //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();
                }               
                public void error(Feature feature, String message) {
                    LOGGER.warning(name + ": " + message + " (" + description
                        + ")");
                    failed.put(feature.getID(),
                        name + ": " + message + " " + "(" + description + ")");
                }
                public void warning(Feature feature, String message) {
                    LOGGER.warning(name + ": " + message + " (" + description
                        + ")");
                }
            };

        try {
      // HACK: turned the collection into a feature reader for the validation processor
      FeatureReader fr = DataUtilities.reader(collection);
            validation.runFeatureTests(dsid, type, fr, results);
        } catch (Exception badIdea) {
            // ValidationResults should of handled stuff will redesign :-)
            throw new DataSourceException("Validation Failed", badIdea);
        }
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.