Package org.switchyard.validate

Examples of org.switchyard.validate.ValidationResult


    }

    @Test(expected=SwitchYardException.class)
    public void test_invalid_schemafile() throws IOException, SAXException {
        Validator validator = getValidator("sw-config-invalid-schemafile.xml");
        ValidationResult result = validator.validate(new DefaultMessage().setContent("<order type='A' />"));
    }
View Full Code Here


    @Test
    public void test_valid_xml() throws IOException, SAXException {
        Validator validator = getValidator("sw-config-xmlv-01.xml");
        String source = "<person name='foo' age='50' />";
        ValidationResult result = validator.validate(new DefaultMessage().setContent(source));
        if (!result.isValid()) {
            Assert.fail(result.getDetail());
        }
        source = "<person2 firstName='タロウ' lastName='ヤマダ' age='50' />";
        result = validator.validate(new DefaultMessage().setContent(source));
        if (!result.isValid()) {
            Assert.fail(result.getDetail());
        }
        Assert.assertNull(result.getDetail());
    }
View Full Code Here

    @Test
    public void test_invalid_xml() throws IOException, SAXException {
        Validator validator = getValidator("sw-config-xmlv-01.xml");
        String source = "<person name='foo'/>";
        ValidationResult result = validator.validate(new DefaultMessage().setContent(source));
        Assert.assertFalse(result.isValid());
        LOGGER.info(result.getDetail());
        Assert.assertTrue(result.getDetail().startsWith("1 validation error(s)"));
    }
View Full Code Here

    @Test
    public void test_namespaceaware_valid_xml() throws Exception {
        Validator validator = getValidator("sw-config-xmlv-namespace.xml");
        String source = "<import:person.2 xmlns:import=\"switchyard-validate-test:import:1.0\" firstName='foo' lastName='bar' name='foo bar' age='50' />";
        ValidationResult result = validator.validate(new DefaultMessage().setContent(source));
        if (!result.isValid()) {
            Assert.fail(result.getDetail());
        }
        Assert.assertNull(result.getDetail());
    }
View Full Code Here

    @Test
    public void test_namespaceaware_catalog_valid_xml() throws Exception {
        Validator validator = getValidator("sw-config-xmlv-namespace-catalog.xml");
        String source = "<import:person.2 xmlns:import=\"switchyard-validate-test:import:1.0\" firstName='foo' lastName='bar' name='foo bar' age='50' />";
        ValidationResult result = validator.validate(new DefaultMessage().setContent(source));
        if (!result.isValid()) {
            Assert.fail(result.getDetail());
        }
        Assert.assertNull(result.getDetail());
    }
View Full Code Here

    @Test
    public void test_dtd_valid_xml() throws Exception {
        Validator validator = getValidator("sw-config-xmlv-dtd.xml");
        String source = "<!DOCTYPE person SYSTEM \"src/test/resources/org/switchyard/validate/internal/xml/person.dtd\"> <person name='foo' age='50' />";
        ValidationResult result = validator.validate(new DefaultMessage().setContent(source));
        if (!result.isValid()) {
            Assert.fail(result.getDetail());
        }
        Assert.assertNull(result.getDetail());
    }
View Full Code Here

                + "<nn:memo xmlns:nn=\"urn:switchyard-quickstart:dtd-example:0.1.0\">"
                + "<nn:to>Garfield</nn:to>"
                + "<nn:from>Odie</nn:from>"
                + "<nn:body>I love lasagna!</nn:body>"
                + "</nn:memo>";
        ValidationResult result = validator.validate(new DefaultMessage().setContent(source));
        if (!result.isValid()) {
            Assert.fail(result.getDetail());
        }
        Assert.assertNull(result.getDetail());
    }
View Full Code Here

                + "<nn:memo xmlns:nn=\"urn:switchyard-quickstart:dtd-example:0.1.0\">"
                + "<nn:to>Garfield</nn:to>"
                + "<nn:from>Odie</nn:from>"
                + "<nn:body>I love lasagna!</nn:body>"
                + "</nn:memo>";
        ValidationResult result = validator.validate(new DefaultMessage().setContent(source));
        if (!result.isValid()) {
            Assert.fail(result.getDetail());
        }
        Assert.assertNull(result.getDetail());
    }
View Full Code Here

                + "<nn:memo xmlns:nn=\"urn:switchyard-quickstart:dtd-example:0.1.0\">"
                + "<nn:to>Garfield</nn:to>"
                + "<nn:from>Odie</nn:from>"
                + "<nn:body>I love lasagna!</nn:body>"
                + "</nn:memo>";
        ValidationResult result = validator.validate(new DefaultMessage().setContent(source));
        if (result.isValid()) {
            Assert.fail(result.getDetail());
        }
    }
View Full Code Here

                + "<nn:body>I love lasagna!</nn:body>"
                + "</nn:memo>";

        boolean flag = false;
        try {
            ValidationResult result = validator.validate(new DefaultMessage().setContent(source));
        } catch (Exception fnfe) {
            flag = true;
        }
        if (!flag) {
            Assert.fail("Somehow found DTD that we should not have.");
View Full Code Here

TOP

Related Classes of org.switchyard.validate.ValidationResult

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.