Package javax.xml.validation

Examples of javax.xml.validation.Validator.validate()


    }

    public void testWfSchemaV25() throws Exception {
        SchemaService wss = Services.get().get(SchemaService.class);
        Validator validator = wss.getSchema(SchemaName.WORKFLOW).newValidator();
        validator.validate(new StreamSource(new StringReader(APP_V25)));
    }

    public void testExtSchema() throws Exception {
        Services.get().destroy();
        setSystemProperty(SchemaService.WF_CONF_EXT_SCHEMAS, "wf-ext-schema.xsd");
View Full Code Here


        Services.get().destroy();
        setSystemProperty(SchemaService.WF_CONF_EXT_SCHEMAS, "wf-ext-schema.xsd");
        new Services().init();
        SchemaService wss = Services.get().get(SchemaService.class);
        Validator validator = wss.getSchema(SchemaName.WORKFLOW).newValidator();
        validator.validate(new StreamSource(new StringReader(APP2)));
    }

    public void testWfSLASchema() throws Exception {
        SchemaService wss = Services.get().get(SchemaService.class);
        Validator validator = wss.getSchema(SchemaName.WORKFLOW).newValidator();
View Full Code Here

    }

    public void testWfSLASchema() throws Exception {
        SchemaService wss = Services.get().get(SchemaService.class);
        Validator validator = wss.getSchema(SchemaName.WORKFLOW).newValidator();
        validator.validate(new StreamSource(new StringReader(WF_SLA_APP)));
    }

    public void testWfSLASchemaNW() throws Exception {
        SchemaService wss = Services.get().get(SchemaService.class);
        Validator validator = wss.getSchema(SchemaName.WORKFLOW).newValidator();
View Full Code Here

    public void testWfSLASchemaNW() throws Exception {
        SchemaService wss = Services.get().get(SchemaService.class);
        Validator validator = wss.getSchema(SchemaName.WORKFLOW).newValidator();
        try {
            validator.validate(new StreamSource(new StringReader(WF_SLA_APP_NW)));
            fail("Schema service check does not work");
        }
        catch (Exception ex) {
            // Expected
        }
View Full Code Here

                + "<controls> <timeout>10</timeout> <concurrency>2</concurrency> <execution>LIFO</execution> </controls> <datasets> <dataset name='a' frequency='${coord:days(7)}' initial-instance='2009-02-01T01:00Z' timezone='UTC'> <uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template> </dataset> <dataset name='local_a' frequency='${coord:days(7)}' initial-instance='2009-02-01T01:00Z' timezone='UTC'> <uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template> </dataset> </datasets> <input-events> <data-in name='A' dataset='a'> <instance>${coord:latest(0)}</instance> </data-in>  </input-events> <output-events> <data-out name='LOCAL_A' dataset='local_a'> <instance>${coord:current(-1)}</instance> </data-out> </output-events> <action> <workflow> <app-path>hdfs:///tmp/workflows/</app-path> <configuration> <property> <name>inputA</name> <value>${coord:dataIn('A')}</value> </property> <property> <name>inputB</name> <value>${coord:dataOut('LOCAL_A')}</value> </property></configuration> </workflow>  "
                + "</action> </coordinator-app>";

        Element e = XmlUtils.parseXml(COORD_APP1);
        //System.out.println("XML :"+ XmlUtils.prettyPrint(e));
        validator.validate(new StreamSource(new StringReader(COORD_APP1)));
    }

    public void testCoordSchema2() throws Exception {
        SchemaService wss = Services.get().get(SchemaService.class);
        Validator validator = wss.getSchema(SchemaName.COORDINATOR).newValidator();
View Full Code Here

                + "<controls> <timeout>10</timeout> <concurrency>2</concurrency> <execution>LIFO</execution>  <throttle>3</throttle></controls> <datasets> <dataset name='a' frequency='${coord:days(7)}' initial-instance='2009-02-01T01:00Z' timezone='UTC'> <uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template> </dataset> <dataset name='local_a' frequency='${coord:days(7)}' initial-instance='2009-02-01T01:00Z' timezone='UTC'> <uri-template>file:///tmp/coord/workflows/${YEAR}/${DAY}</uri-template> </dataset> </datasets> <input-events> <data-in name='A' dataset='a'> <instance>${coord:latest(0)}</instance> </data-in>  </input-events> <output-events> <data-out name='LOCAL_A' dataset='local_a'> <instance>${coord:current(-1)}</instance> </data-out> </output-events> <action> <workflow> <app-path>hdfs:///tmp/workflows/</app-path> <configuration> <property> <name>inputA</name> <value>${coord:dataIn('A')}</value> </property> <property> <name>inputB</name> <value>${coord:dataOut('LOCAL_A')}</value> </property></configuration> </workflow>  "
                + "</action> </coordinator-app>";

        Element e = XmlUtils.parseXml(COORD_APP1);
        //System.out.println("XML :"+ XmlUtils.prettyPrint(e));
        validator.validate(new StreamSource(new StringReader(COORD_APP1)));
    }

    public void testCoordSLASchema() throws Exception {
        SchemaService wss = Services.get().get(SchemaService.class);
        Validator validator = wss.getSchema(SchemaName.COORDINATOR)
View Full Code Here

                + " <sla:qa-contact>abc@yahoo.com</sla:qa-contact> <sla:se-contact>abc@yahoo.com</sla:se-contact>"
                + "</sla:info>" + "</action> </coordinator-app>";

        Element e = XmlUtils.parseXml(COORD_APP1);
        // System.out.println("XML :"+ XmlUtils.prettyPrint(e));
        validator.validate(new StreamSource(new StringReader(COORD_APP1)));
    }

    public void testBundleSchema() throws Exception {
        SchemaService wss = Services.get().get(SchemaService.class);
        Validator validator = wss.getSchema(SchemaName.BUNDLE).newValidator();
View Full Code Here

                + "<configuration> "
                + "<property> <name>START_TIME</name> <value>2009-02-01T00:00Z</value> </property> </configuration> "
                + "</coordinator></bundle-app>";
        Element e = XmlUtils.parseXml(BUNDLE_APP);
        // System.out.println("XML :"+ XmlUtils.prettyPrint(e));
        validator.validate(new StreamSource(new StringReader(BUNDLE_APP)));
    }

}
View Full Code Here

            IOUtils.copyCharStream(reader, writer);
            String strDef = writer.toString();

            if (schema != null) {
                Validator validator = schema.newValidator();
                validator.validate(new StreamSource(new StringReader(strDef)));
            }

            Element wfDefElement = XmlUtils.parseXml(strDef);
            LiteWorkflowApp app = parse(strDef, wfDefElement);
            Map<String, VisitStatus> traversed = new HashMap<String, VisitStatus>();
View Full Code Here

     */
    private void validateXml(String xmlContent) throws CoordinatorJobException {
        javax.xml.validation.Schema schema = Services.get().get(SchemaService.class).getSchema(SchemaName.COORDINATOR);
        Validator validator = schema.newValidator();
        try {
            validator.validate(new StreamSource(new StringReader(xmlContent)));
        }
        catch (SAXException ex) {
            LOG.warn("SAXException :", ex);
            throw new CoordinatorJobException(ErrorCode.E0701, ex.getMessage(), ex);
        }
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.