1 /*
2 Bloof - visualize the evolution of your software project
3 Copyright ( C ) 2003 Lukasz Pekacki <lukasz@pekacki.de>
4 http://bloof.sf.net/
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along with
15 this program; if not, write to the Free Software Foundation, Inc.,
16 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 $RCSfile: MainTestSuite.java,v $
19 Created on $Date: 2003/09/13 12:22:45 $
20 */
21 package net.sf.bloof.test;
22
23 import java.io.IOException;
24 import java.util.logging.Level;
25 import java.util.logging.LogManager;
26 import java.util.logging.Logger;
27
28 import net.sf.bloof.Bloof;
29 import net.sf.bloof.util.logging.LogFormatter;
30
31 import junit.framework.Test;
32 import junit.framework.TestSuite;
33 import junit.textui.TestRunner;
34
35 /***
36 * Main JUnit Test suite containing all tests for Bloof.
37 * @author Lukasz Pekacki <pekacki@users.sourceforge.net>
38 * @version $Id: MainTestSuite.java,v 1.13 2003/09/13 12:22:45 pekacki Exp $
39 */
40 public class MainTestSuite {
41 /*** local database path for the test cases */
42 public static final String TEST_DB_PATH = Bloof.LOCAL_BLOOF_DIR+"/bloofdb";
43 /*** local database user for the test cases */
44 public static final String TEST_DB_USER = "bloof";
45 /*** local database password for the test cases */
46 public static final String TEST_DB_PASS = "bloof";
47 /*** fine tuning */
48 private static boolean sRunOnLukaszComputer = false,
49 sIsOnline = false,
50 sIsPostgresOnline = false,
51 sCheckDatabase = false;
52
53 /***
54 * Method suite.
55 * @return Test suite
56 */
57 public static Test suite() {
58 Logger.getLogger("net.sf.bloof").setLevel(Level.OFF);
59 TestSuite suite = new TestSuite("Tests for net.sf.bloof");
60 //$JUnit-BEGIN$
61 suite.addTest(net.sf.bloof.test.metrics.AllTests.suite());
62 suite.addTest(net.sf.bloof.test.util.intl.AllTests.suite());
63 suite.addTest(net.sf.bloof.test.util.AllTests.suite());
64 suite.addTest(net.sf.bloof.test.cvsplugin.AllTests.suite());
65 if (sCheckDatabase) {
66 suite.addTest(net.sf.bloof.test.db.AllTests.suite());
67 }
68 //$JUnit-END$
69 return suite;
70 }
71
72 /***
73 * Runs all Bloof unit tests with the text TestRunner
74 * @param aArgs Ignored.
75 */
76 public static void main(String[] aArgs) {
77 if (aArgs != null) {
78 String s = aArgs[0];
79 if (s.equals("lukasz_machine")) {
80 sRunOnLukaszComputer = true;
81 }
82 };
83 initLogManager();
84 TestRunner.run(suite());
85 }
86 /***
87 * Returns true if the test is run on Lukasz computer
88 * @return boolean
89 */
90 public static boolean isRunOnLukaszComputer() {
91 return sRunOnLukaszComputer;
92 }
93
94 /***
95 * Returns the isOnline.
96 * @return boolean
97 */
98 public static boolean isOnline() {
99 return sIsOnline;
100 }
101
102 /***
103 * Returns the isPostgresOnline.
104 * @return boolean
105 */
106 public static boolean isPostgresOnline() {
107 return sIsPostgresOnline;
108 }
109
110 /***
111 * Method initLogManager
112 * initializes the logging API
113 */
114 public static void initLogManager() {
115 try {
116 sLm.readConfiguration(LogFormatter.class.getResourceAsStream(sLoggingProperties));
117 } catch (IOException e) {
118 System.err.println("ERROR: Logging could not be initialized!");
119 }
120 }
121 private static LogManager sLm = LogManager.getLogManager();
122
123 /***
124 * debug logging
125 */
126 public static final String LOGGING_CONFIG_DEBUG = "logging-debug.properties";
127 /***
128 * default logging
129 */
130 public static final String LOGGING_CONFIG_SILENT = "logging-silent.properties";
131
132 /***
133 * verbose logging
134 */
135 public static final String LOGGING_CONFIG_VERBOSE = "logging-verbose.properties";
136 private static String sLoggingProperties = LOGGING_CONFIG_SILENT;
137
138 }
This page was automatically generated by Maven