Package com.github.fge.jsonschema.core.report

Examples of com.github.fge.jsonschema.core.report.ProcessingReport


                LOGGER.warn("Payload type " + input.getClass().getName() + " is not supported");
                return false;
            }

            message.setPayload(output);
            ProcessingReport report = jsonSchema.validate(data);

            if (LOGGER.isDebugEnabled())
            {
                LOGGER.debug("JSON Schema validation report: " + report.toString());
            }

            return report.isSuccess();
        }
        catch (Exception e)
        {
            LOGGER.error("Unable to validate JSON!", e);
            return false;
View Full Code Here


     * @param event the current {@link MuleEvent}
     */
    public void validate(MuleEvent event) throws MuleException
    {
        Object input = event.getMessage().getPayload();
        ProcessingReport report;
        JsonNode jsonNode = null;

        try
        {
            jsonNode = new DefaultJsonParser(event.getMuleContext()).asJsonNode(input);

            if ((input instanceof Reader) || (input instanceof InputStream))
            {
                event.getMessage().setPayload(jsonNode.toString());
            }

            report = schema.validate(jsonNode);
        }
        catch (Exception e)
        {
            throw new JsonSchemaValidationException("Exception was found while trying to validate json schema",
                                                    jsonNode == null ? StringUtils.EMPTY : jsonNode.toString(),
                                                    e);
        }

        if (!report.isSuccess())
        {
            throw new JsonSchemaValidationException("Json content is not compliant with schema\n" + report.toString(), jsonNode.toString());
        }
    }
View Full Code Here

        final int i)
        throws ProcessingException
    {
        String name;
        JsonNode value;
        ProcessingReport report;

        for (final Map.Entry<String, JsonNode> entry: schemas.entrySet()) {
            name = entry.getKey();
            value = entry.getValue();
            report = SCHEMA.validate(value);
            if (!report.isSuccess()) {
                System.err.println("ERROR: schema " + name + " did not "
                    + "validate (iteration " + i + ')');
                System.exit(1);
            }
        }
View Full Code Here

    @Test(invocationCount = 10, threadPoolSize = 4)
    public void v4ValidatesItselfButNotV3()
        throws ProcessingException
    {
        final ProcessingReport r1 = VALIDATOR.validate(draftv4, draftv4);
        final ProcessingReport r2 = VALIDATOR.validate(draftv4, draftv3);

        assertTrue(r1.isSuccess());
        assertFalse(r2.isSuccess());
    }
View Full Code Here

    @Test(invocationCount = 10, threadPoolSize = 4)
    public void v3ValidatesItself()
        throws ProcessingException
    {
        final ProcessingReport r1 = VALIDATOR.validate(draftv3, draftv3);

        assertTrue(r1.isSuccess());
    }
View Full Code Here

        final JsonSchemaFactory factory = JsonSchemaFactory.newBuilder()
            .setLoadingConfiguration(cfg).freeze();

        final JsonSchema schema = factory.getJsonSchema(fstabSchema);

        ProcessingReport report;

        report = schema.validate(good);
        System.out.println(report);

        report = schema.validate(bad);
View Full Code Here

        final JsonSchemaFactory factory = JsonSchemaFactory.byDefault();

        final JsonSchema schema = factory.getJsonSchema(SCHEMA_URI);

        ProcessingReport report;

        report = schema.validate(good);
        System.out.println(report);

        report = schema.validate(bad);
View Full Code Here

        final JsonSchemaFactory factory = JsonSchemaFactory.byDefault();

        final JsonSchema schema = factory.getJsonSchema(fstabSchema);

        ProcessingReport report;

        report = schema.validate(good);
        System.out.println(report);

        report = schema.validate(bad);
View Full Code Here

        final JsonSchemaFactory factory = JsonSchemaFactory.newBuilder()
            .setValidationConfiguration(cfg).freeze();

        final JsonSchema schema = factory.getJsonSchema(customSchema);

        ProcessingReport report;

        report = schema.validate(good);
        System.out.println(report);

        report = schema.validate(bad);
View Full Code Here

        final SchemaTree tree
            = new CanonicalSchemaTree(SchemaKey.anonymousKey(), schema);
        final JsonTree instance = new SimpleJsonTree(node);
        final FullData data = new FullData(tree, instance);

        final ProcessingReport report = mock(ProcessingReport.class);
        @SuppressWarnings("unchecked")
        final Processor<FullData, FullData> processor =  mock(Processor.class);

        // It is a null node which is ignored by the constructor, so we can
        // do that
View Full Code Here

TOP

Related Classes of com.github.fge.jsonschema.core.report.ProcessingReport

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.