Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: jbreport/test/ParseTest.java


1   /*
2    * $Id: ParseTest.java,v 1.1.1.1 2000/08/31 13:14:44 grantfin Exp $
3    *
4    * jbReport - A reporting library for Java
5    * Copyright (C) 2000 Grant Finnemore <grantfin@users.sourceforge.net>
6    *
7    * This library is free software; you can redistribute it and/or
8    * modify it under the terms of the GNU Lesser General Public
9    * License as published by the Free Software Foundation; either
10   * version 2 of the License, or (at your option) any later version.
11   *
12   * This library is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this library; if not, write to the Free Software
19   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20   */
21  package jbreport.test;
22  
23  import java.io.InputStream;
24  import java.util.Iterator;
25  import junit.framework.TestCase;
26  
27  import jbreport.ReportException;
28  import jbreport.ReportFacade;
29  import jbreport.Repository;
30  import jbreport.core.ReportVisitor;
31  import jbreport.core.Traversable;
32  import jbreport.util.MemoryTrack;
33  import jbreport.util.XMLOutputReportVisitor;
34  
35  /**
36   * This will test the parsing of a basic report definition file.
37   *
38   * @author Grant Finnemore
39   * @version $Revision: 1.1.1.1 $
40   */
41  public 
42  class ParseTest extends TestCase {
43  
44     public ParseTest(String name) {
45        super(name);
46     }
47  
48     public void setUp() throws ReportException {
49        InputStream is = getClass().getResourceAsStream("Datasource.xml");
50        ReportFacade.initialize(is);
51        is = getClass().getResourceAsStream("Misc.xml");
52        ReportFacade.initialize(is);
53        is = getClass().getResourceAsStream("Styles.xml");
54        ReportFacade.initialize(is);
55        is = getClass().getResourceAsStream("ParseTest.xml");
56        ReportFacade.initialize(is);
57     }
58  
59     protected void tearDown() {
60        MemoryTrack mt = MemoryTrack.getInstance();
61        System.out.println("ParseTest> " 
62                           + MemoryTrack.bytesToKB(mt.getMaxUsage()));
63     }
64  
65     public void testPreOrderTraverse() throws ReportException {
66        Repository repository = ReportFacade.fetchRepository("ParseTest");
67        ReportVisitor visitor = new XMLOutputReportVisitor();
68        ((Traversable)repository).preOrderTraverse(visitor);
69     }
70  
71  }