1 package org.apache.turbine.test;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import java.io.File;
20 import java.io.FileInputStream;
21 import java.io.FileNotFoundException;
22 import java.util.Properties;
23
24 import junit.framework.TestCase;
25
26 import org.apache.log4j.PropertyConfigurator;
27
28 import org.apache.turbine.Turbine;
29
30 /***
31 * Base functionality to be extended by all Apache Turbine test cases. Test
32 * case implementations are used to automate testing via JUnit.
33 *
34 * @author <a href="mailto:celkins@scardini.com">Christopher Elkins</a>
35 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
36 * @version $Id: BaseTestCase.java 264148 2005-08-29 14:21:04Z henning $
37 */
38 public abstract class BaseTestCase
39 extends TestCase
40 {
41 private static File log4jFile = new File("conf/test/Log4j.properties");
42
43 public BaseTestCase(String name)
44 throws Exception
45 {
46 super(name);
47
48 try
49 {
50 Properties p = new Properties();
51 p.load(new FileInputStream(log4jFile));
52 p.setProperty(Turbine.APPLICATION_ROOT_KEY, new File(".").getAbsolutePath());
53 PropertyConfigurator.configure(p);
54 }
55 catch (FileNotFoundException fnf)
56 {
57 System.err.println("Could not open Log4J configuration file "
58 + log4jFile);
59 }
60 }
61 }
62