Package ch.pollet.jzic.parser

Examples of ch.pollet.jzic.parser.RuleParser


        Tokenizer t;
        Rule r;
        DateTime dt;

        Database db = new Database();
        RuleParser rp = new RuleParser(db);

        //-- Test 1
        line = "Rule1 2009 2010 - Sep lastSun 2:00w 1:30 -";
        t = new Tokenizer(line, "\t ", null, 0);
        rp.parse(t);

        dt = new DateTime();
        dt.setYear(2009);
        dt.setMonth(9);
        dt.setDay(27);
        dt.setHour(2);
        dt.setMinute(0);
        dt.setSecond(0);
        dt.setType(DateTime.Type.WALL);

        assertTrue(db.getRules().containsKey("Rule1"));
        assertEquals(1, db.getRules().get("Rule1").size());
        r = db.getRules().get("Rule1").get(0);
        assertEquals(2009, r.getFromYear());
        assertEquals(2010, r.getToYear());
        assertEquals(null, r.getType());
        r.getAt().setYear(2009);
        assertEquals(dt, r.getAt());
        assertEquals(5400, r.getOffset());
        assertEquals("", r.getFormat());

        //-- Test 2
        line = "Rule2 2009 2010 - Sep 1 2:00w 1:30:30 S";
        t = new Tokenizer(line, "\t ", null, 0);
        rp.parse(t);

        dt = new DateTime();
        dt.setYear(2009);
        dt.setMonth(9);
        dt.setDay(1);
View Full Code Here

TOP

Related Classes of ch.pollet.jzic.parser.RuleParser

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.