001    package org.hackystat.tickertape.tickerlingua;
002    
003    import static org.junit.Assert.assertEquals;
004    import java.util.List;
005    import org.junit.Test;
006    
007    /**
008     * Provides simple test cases for the TickerLingua XML configuration language.
009     * Uses the xml/tickerlingua.example.xml file in the current directory. 
010     * @author Philip Johnson
011     *
012     */
013    public class TestTickerLingua {
014      
015      /**
016       * Ensure that the example file can be read in and validated. 
017       * @throws Exception If problems occur. 
018       */
019      @Test
020      public void testTickerLingua() throws Exception {
021        String exampleFile = System.getProperty("user.dir") + "/xml/tickerlingua.example.xml";
022        // will throw an exception if can't read in the file. 
023        TickerLingua tickerLingua = new TickerLingua(exampleFile);
024        assertEquals("Checking service definitions",  1, tickerLingua.getServices().size());
025        assertEquals("Checking user definitions",  2, tickerLingua.getUsers().size());
026        assertEquals("Checking project definitions",  2, tickerLingua.getProjects().size());
027        List<Tickertape> tickertapes = tickerLingua.getTickertapes();
028        assertEquals("Checking tickertape defs", 7, tickertapes.size());
029      }
030    }