Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../img/srcFileCovDistChart9.png 30% of files have more coverage
14   109   8   2,33
2   42   0,57   6
6     1,33  
1    
 
  QedeqTestCase       Line # 36 14 8 90,9% 0.90909094
 
  (133)
 
1    /* $Id: QedeqTestCase.java,v 1.1 2008/07/26 07:56:13 m31 Exp $
2    *
3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
4    *
5    * Copyright 2000-2008, Michael Meyling <mime@qedeq.org>.
6    *
7    * "Hilbert II" is free software; you can redistribute
8    * it and/or modify it under the terms of the GNU 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 program 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
15    * GNU General Public License for more details.
16    */
17   
18    package org.qedeq.base.test;
19   
20    import java.io.File;
21    import java.net.URL;
22   
23    import junit.framework.TestCase;
24   
25    import org.apache.log4j.Level;
26    import org.apache.log4j.Logger;
27    import org.apache.log4j.helpers.Loader;
28    import org.apache.log4j.xml.DOMConfigurator;
29   
30    /**
31    * Basis class for all tests.
32    *
33    * @version $Revision: 1.1 $
34    * @author Michael Meyling
35    */
 
36    public abstract class QedeqTestCase extends TestCase {
37   
 
38  62 toggle static {
39    // init Log4J watchdog
40  62 try {
41  62 URL url = Loader.getResource("config/log4j.xml");
42  62 if (url != null) {
43    // set properties and watch file every 5 seconds
44  62 DOMConfigurator.configureAndWatch(url.getPath(), 5000);
45    } else {
46  0 Logger.getRootLogger().setLevel(Level.ERROR);
47    }
48    } catch (Exception e) {
49    // we ignore this
50    }
51    }
52   
53    /** Destination directory for generated output files. */
54    private final File outdir;
55   
56    /** Source directory for input files. */
57    private final File indir;
58   
59    /**
60    * Constructor.
61    *
62    * @param name Test case name.
63    */
 
64  114 toggle public QedeqTestCase(final String name) {
65  114 super(name);
66  114 outdir = new File(System.getProperty("qedeq.test.outdir", "../../../qedeq_gen"));
67  114 indir = new File(System.getProperty("qedeq.test.indir", "data"));
68    }
69   
70    /**
71    * Constructor.
72    */
 
73  296 toggle public QedeqTestCase() {
74  296 super();
75  296 outdir = new File(System.getProperty("qedeq.test.outdir", "../../../qedeq_gen"));
76  296 indir = new File(System.getProperty("qedeq.test.indir", "data"));
77    }
78   
79    /**
80    * Get output directory for test output. Might be set initially by setting the system property
81    * <code>qedeq.test.outdir</code>.
82    *
83    * @return Directory for test output.
84    */
 
85  57 toggle public File getOutdir() {
86  57 return outdir;
87    }
88   
89    /**
90    * Get input directory for test input data. Might be set initially by setting the system
91    * property <code>qedeq.test.indir</code>.
92    *
93    * @return Directory for test input.
94    */
 
95  172 toggle public File getIndir() {
96  172 return indir;
97    }
98   
99    /**
100    * Get test input data file. Get file relative to {@link #getIndir()}.
101    *
102    * @param fileName Relative file path.
103    * @return Test data file.
104    */
 
105  63 toggle public File getFile(final String fileName) {
106  63 return new File(getIndir(), fileName);
107    }
108   
109    }