KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > firstpartners > nounit > test > TestData


1 package net.firstpartners.nounit.test;
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 org.jdom.*;
28 import org.jdom.input.*;
29
30 import junit.framework.TestCase;
31
32 import org.gjt.jclasslib.io.*;
33 import org.gjt.jclasslib.structures.*;
34
35 import java.io.*;
36
37 /**
38  * Test Information - System Wide Tests
39  */

40 public class TestData extends TestCase {
41
42     /**
43      * Initialises the Class
44      *
45      */

46     public TestData() {
47         super("");
48     }
49     
50     /**
51      * Required by JUnit
52      *
53      * @param name name of the test
54      */

55     public TestData( String JavaDoc name ) {
56         super( name );
57     }
58
59     /**
60      * Get a handle to the sample class file , as a File
61      * @return sampleFile
62      */

63     public static File getSampleFile()
64         throws IOException {
65       
66         //Get a handle to the sample file
67
File sampleFile = new File(SAMPLE_CLASS_PROXY);
68         return sampleFile;
69     }
70     
71     /**
72      * Get a handle to the sample class file , but as a ClassFile Structure
73      * @return ClassFileReader
74      */

75     public static ClassFile getSampleClassFile()
76         throws InvalidByteCodeException , IOException {
77       
78         //Get a handle to the sample file
79
File sampleFile = getSampleFile();
80         
81         //Now read and return as byte-code
82
return ClassFileReader.readFromFile(sampleFile);
83     }
84  
85     /**
86      * Get a Simple-XML Document , as pointed to by constants above.
87      * Convience Method for testing
88      * @return sourceDocument - XML Jdom Document
89      */

90     public static Document getSimpleXmlDocument ()
91         throws JDOMException , IOException {
92       
93         //Read in the file
94
SAXBuilder builder = new SAXBuilder();
95         Document sourceDocument = builder.build(new File(XML_SIMPLE_OUTPUT));
96         
97         return sourceDocument;
98     }
99     
100     /**
101      * Proxy Class Source - where sample sits
102      */

103     public final static String JavaDoc SAMPLE_CLASS_PROXY =
104         "G:\\NoUnitFiles\\net\\firstpartners\\nounit\\test\\ProxyBean.class";
105
106     /**
107      * Current Full Root of this project - used to sample entire project
108      */

109     public final static String JavaDoc SAMPLE_CLASS_SOURCE_FULL="G:\\NoUnitFiles\\";
110         
111     /**
112      * Current (Sample - sub) Class of this project - used in some partial tests
113      */

114     public final static String JavaDoc SAMPLE_CLASS_SOURCE =
115         "G:\\NoUnitFiles\\net\\firstpartners\\nounit\\utility\\";
116     
117     /**
118      * Sample (simple) XML as produced by 1st pass , before any java processing
119      */

120     public static final String JavaDoc XML_SIMPLE_OUTPUT =
121         "G:\\NoUnitFiles\\xml\\project.xml";
122     
123     /**
124      * Sample (with-calls) XML as produced by 2nd pass , after java processing
125      */

126     public static final String JavaDoc XML_CALLS_OUTPUT =
127         "G:\\NoUnitFiles\\xml\\nounit-calls.xml";
128     
129 }
130
Popular Tags