KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > firstpartners > nounit > report > CallsReport


1 package net.firstpartners.nounit.report;
2
3 /**
4  * Title: NoUnit - Identify Classes that are not being unit Tested
5  *
6  * Copyright (C) 2001 Paul Browne , FirstPartners.net
7  *
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * @author Paul Browne
24  * @version 0.7
25  */

26
27 import java.io.File JavaDoc;
28 import java.io.FileNotFoundException JavaDoc;
29 import java.io.IOException JavaDoc;
30
31 import javax.xml.transform.TransformerConfigurationException JavaDoc;
32 import javax.xml.transform.TransformerException JavaDoc;
33
34 import net.firstpartners.nounit.report.process.CallChainer;
35 import net.firstpartners.nounit.ui.common.CommandPackage;
36 import net.firstpartners.nounit.ui.common.SystemValues;
37 import net.firstpartners.nounit.utility.NoUnitException;
38
39 import org.jdom.JDOMException;
40
41 /*
42  * Runs Any Report , but updates the XML to gather additional information
43  * <I>before</I> calling the stylesheet transformation<BR>.
44  * This update is done in JDOM ; if you're better at Java than
45  * XSLT you may prefer this approach. We still use XSLT , but
46  * if you're really paranoid , you could do it all in Java<BR>
47  * @see nounit-calls.dtd for the changes we make to the XML.<BR>
48  * After the update to the XML , we call an XSLT to transform the
49  * information into a nice format for the user!!*/

50
51 public class CallsReport
52 extends SimpleReport{
53     
54     
55     //@todo change to parameter
56
public static final String JavaDoc classMustExtend="junit.framework.TestCase";
57     
58     /**
59      * Transform the XML using JDOM , then call - uses Xalan (XML->HTML convertor)
60      * @param inPackage - CommandPackage with required parameters
61      * @exception TransformerException
62      * @exception TransformerConfigurationException
63      * @exception IOException
64      * @exception FileNotFoundException
65      */

66     public void makeReport(CommandPackage inPackage)
67     throws TransformerException JavaDoc, TransformerConfigurationException JavaDoc,
68            IOException JavaDoc, FileNotFoundException JavaDoc , NoUnitException {
69
70         //Get the Input-Output XML File
71
File JavaDoc xmlInOutFile=
72             new File JavaDoc( inPackage.getString(CommandPackage.OUTPUT_DIR),
73                       SystemValues.XML_OUTPUT_NAME );
74         
75         try{ //Process the XML the way we want it
76
CallChainer myProcessor = new CallChainer();
77             myProcessor.addCallChainInformation( xmlInOutFile,
78                                                  xmlInOutFile,
79                                                  classMustExtend);
80         } catch (JDOMException jde) {
81             throw new NoUnitException( jde, "XML-JDOM Exception" );
82         }
83         //Now call the Simple report to do the transformation
84
super.makeReport(inPackage);
85     }
86 }
87
Popular Tags