Package org.infinispan.schematic.SchemaLibrary

Examples of org.infinispan.schematic.SchemaLibrary.Results


     */
    public Problems validate() {
        if (problems == null) {
            SimpleProblems problems = new SimpleProblems();
            warnUseOfDeprecatedFields(problems);
            Results results = SCHEMA_LIBRARY.validate(doc, JSON_SCHEMA_URI);
            for (Problem problem : results) {
                switch (problem.getType()) {
                    case ERROR:
                        problems.addError(JcrI18n.configurationError, problem.getPath(), problem.getReason());
                        break;
View Full Code Here


    }

    protected static Document transform( Document doc,
                                         String schemaUri,
                                         int numExpectedMismatchedValues ) {
        Results results = schemas.validate(doc, schemaUri);
        if (print) System.out.println(results);
        if (numExpectedMismatchedValues > 0) {
            assertThat("expected mismatch errors, but found none", results.hasOnlyTypeMismatchErrors(), is(true));
            assertThat("expected different number of mismatches", results.errorCount(), is(numExpectedMismatchedValues));
        } else {
            assertThat("expected no mismatch errors", results.hasOnlyTypeMismatchErrors(), is(false));
            assertThat("expected to find problems", results.hasProblems(), is(false));
        }
        Document output = schemas.convertValues(doc, results);
        if (numExpectedMismatchedValues > 0) {
            assertThat(output, is(not(sameInstance(doc))));
            // Now double check that the output is valid ...
            Results newResults = schemas.validate(output, schemaUri);
            assertThat(newResults.hasErrors(), is(false));
            if (print) {
                System.out.println("After converting: " + output);
                System.out.println(newResults);
            }
        } else {
View Full Code Here

TOP

Related Classes of org.infinispan.schematic.SchemaLibrary.Results

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.