01: package org.apache.turbine.test;
02:
03: /*
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "License"); you may not use this file except in compliance
10: * with the License. You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing,
15: * software distributed under the License is distributed on an
16: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17: * KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations
19: * under the License.
20: */
21:
22: import java.io.File;
23: import java.io.FileInputStream;
24: import java.io.FileNotFoundException;
25: import java.util.Properties;
26:
27: import junit.framework.TestCase;
28:
29: import org.apache.log4j.PropertyConfigurator;
30:
31: import org.apache.turbine.Turbine;
32:
33: /**
34: * Base functionality to be extended by all Apache Turbine test cases. Test
35: * case implementations are used to automate testing via JUnit.
36: *
37: * @author <a href="mailto:celkins@scardini.com">Christopher Elkins</a>
38: * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
39: * @version $Id: BaseTestCase.java 534527 2007-05-02 16:10:59Z tv $
40: */
41: public abstract class BaseTestCase extends TestCase {
42: private static File log4jFile = new File(
43: "conf/test/Log4j.properties");
44:
45: public BaseTestCase(String name) throws Exception {
46: super (name);
47:
48: try {
49: Properties p = new Properties();
50: p.load(new FileInputStream(log4jFile));
51: p.setProperty(Turbine.APPLICATION_ROOT_KEY, new File(".")
52: .getAbsolutePath());
53: PropertyConfigurator.configure(p);
54: } catch (FileNotFoundException fnf) {
55: System.err
56: .println("Could not open Log4J configuration file "
57: + log4jFile);
58: }
59: }
60: }
|