Examples of MLConfiguration


Examples of org.geotools.ml.MLConfiguration

*
* @source $URL$
*/
public class ParserTest extends TestCase {
    public void testParse() throws Exception {
        Parser parser = new Parser(new MLConfiguration());
        List mails = (List) parser.parse(MLSchemaLocationResolver.class.getResourceAsStream(
                    "mails.xml"));

        assertEquals(2, mails.size());

View Full Code Here

Examples of org.geotools.ml.MLConfiguration

        mail = (Mail) mails.get(1);
        assertEquals(1, mail.getId().intValue());
    }

    public void testParseValid() throws Exception {
        Parser parser = new Parser(new MLConfiguration());
        parser.setValidating(true);
        parser.parse(MLSchemaLocationResolver.class.getResourceAsStream("mails.xml"));

        assertEquals(0, parser.getValidationErrors().size());
    }
View Full Code Here

Examples of org.geotools.ml.MLConfiguration

        assertEquals(0, parser.getValidationErrors().size());
    }
   
    public void testParseNull() throws Exception {
        Parser parser = new Parser(new MLConfiguration());
        parser.setValidating(true);
        List mails = (List) parser.parse(MLSchemaLocationResolver.class.getResourceAsStream("null-mail.xml"));

        assertEquals(0, parser.getValidationErrors().size());
        assertEquals(1, mails.size());
View Full Code Here

Examples of org.geotools.ml.MLConfiguration

        assertNull(mail.getBody());
    }


    public void testParseInValid() throws Exception {
        Parser parser = new Parser(new MLConfiguration());
        parser.setValidating(true);
        parser.parse(MLSchemaLocationResolver.class.getResourceAsStream("mails-invalid.xml"));

        assertFalse(0 == parser.getValidationErrors().size());
       
View Full Code Here

Examples of org.geotools.ml.MLConfiguration

        catch( SAXException e ) {
        }
    }
   
    public void testValidate() throws Exception {
        Parser parser = new Parser(new MLConfiguration());
        parser.validate(MLSchemaLocationResolver.class.getResourceAsStream("mails-invalid.xml"));

        assertFalse(0 == parser.getValidationErrors().size());
       
        //test immeediate failure case
View Full Code Here

Examples of org.geotools.ml.MLConfiguration

        catch( SAXException e ) {
        }
    }
   
    public void testParserDelegate() throws Exception {
        MLConfiguration config = new MLConfiguration();
       
        MyParserDelegate delegate = new MyParserDelegate();
        assertFalse( delegate.foo );
        assertFalse( delegate.bar );
       
        config.getContext().registerComponentInstancedelegate );
      
        Parser parser = new Parser(config);
        Object o = parser.parse( ParserTest.class.getResourceAsStream( "parserDelegate.xml") );
   
        assertTrue( delegate.foo );
View Full Code Here

Examples of org.geotools.ml.MLConfiguration

    /**
     * Test Parser with an XML document containing an external entity:
     * <!ENTITY c SYSTEM "file:///this/file/does/not/exist">
     */
    public void testParseWithEntityResolver() throws Exception {
        Parser parser = new Parser(new MLConfiguration());
       
        try {
            parser.parse(MLSchemaLocationResolver.class.getResourceAsStream("mails-external-entities.xml"));
            fail("parsing should throw an exception since referenced file does not exist");
        } catch (FileNotFoundException e) {
View Full Code Here

Examples of org.geotools.ml.MLConfiguration

import junit.framework.TestCase;

public class PullParserTest extends TestCase {

    public void testParse() throws Exception {
        PullParser parser = new PullParser(new MLConfiguration(),
            ML.class.getResourceAsStream("mails.xml"), new QName(ML.NAMESPACE, "mail"));
       
        Mail m = (Mail) parser.parse();
        assertNotNull(m);
        assertEquals(0, m.getId().intValue());
View Full Code Here

Examples of org.geotools.ml.MLConfiguration

public class EncoderTest extends TestCase {

    public void testIndent() throws Exception {
        Mail ml = new Mail(BigInteger.valueOf(10), "hi", new Envelope("me@me.org", "you@you.org",
            Calendar.getInstance(), "hey", null), null);
        Encoder e = new Encoder(new MLConfiguration());
        //e.setIndenting(true);
        //e.setIndentSize(4);

        System.out.println(e.encodeAsString(ml, new QName(ML.NAMESPACE, "mails")));
    }
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.