KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > turbine > test > BaseTestCase


1 package org.apache.turbine.test;
2
3 /*
4  * Copyright 2001-2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License")
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 import java.io.File JavaDoc;
20 import java.io.FileInputStream JavaDoc;
21 import java.io.FileNotFoundException JavaDoc;
22 import java.util.Properties JavaDoc;
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,v 1.3.2.3 2004/08/14 20:57:59 henning Exp $
37  */

38 public abstract class BaseTestCase
39         extends TestCase
40 {
41     private static File JavaDoc log4jFile = new File JavaDoc("conf/test/Log4j.properties");
42
43     public BaseTestCase(String JavaDoc name)
44             throws Exception JavaDoc
45     {
46         super(name);
47
48         try
49         {
50             Properties JavaDoc p = new Properties JavaDoc();
51             p.load(new FileInputStream JavaDoc(log4jFile));
52             p.setProperty(Turbine.APPLICATION_ROOT_KEY, new File JavaDoc(".").getAbsolutePath());
53             PropertyConfigurator.configure(p);
54         }
55         catch (FileNotFoundException JavaDoc fnf)
56         {
57             System.err.println("Could not open Log4J configuration file "
58                     + log4jFile);
59         }
60     }
61 }
62
63
Popular Tags