01: package net.firstpartners.nounit.report;
02:
03: /**
04: * Title: NoUnit - Identify Classes that are not being unit Tested
05: *
06: * Copyright (C) 2001 Paul Browne , FirstPartners.net
07: *
08: *
09: * 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;
28: import java.io.FileNotFoundException;
29: import java.io.IOException;
30:
31: import javax.xml.transform.TransformerConfigurationException;
32: import javax.xml.transform.TransformerException;
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 extends SimpleReport {
52:
53: //@todo change to parameter
54: public static final String classMustExtend = "junit.framework.TestCase";
55:
56: /**
57: * Transform the XML using JDOM , then call - uses Xalan (XML->HTML convertor)
58: * @param inPackage - CommandPackage with required parameters
59: * @exception TransformerException
60: * @exception TransformerConfigurationException
61: * @exception IOException
62: * @exception FileNotFoundException
63: */
64: public void makeReport(CommandPackage inPackage)
65: throws TransformerException,
66: TransformerConfigurationException, IOException,
67: FileNotFoundException, NoUnitException {
68:
69: //Get the Input-Output XML File
70: File xmlInOutFile = new File(inPackage
71: .getString(CommandPackage.OUTPUT_DIR),
72: SystemValues.XML_OUTPUT_NAME);
73:
74: try { //Process the XML the way we want it
75: CallChainer myProcessor = new CallChainer();
76: myProcessor.addCallChainInformation(xmlInOutFile,
77: xmlInOutFile, classMustExtend);
78: } catch (JDOMException jde) {
79: throw new NoUnitException(jde, "XML-JDOM Exception");
80: }
81: //Now call the Simple report to do the transformation
82: super.makeReport(inPackage);
83: }
84: }
|