KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > AbstractTestCase


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

16  
17 package org.apache.axis2;
18
19 import junit.framework.TestCase;
20
21 import java.io.File JavaDoc;
22
23 /**
24  * Abstract base class for test cases.
25  */

26 public abstract class AbstractTestCase
27         extends TestCase {
28     protected String JavaDoc testDir = "test" + File.separator;
29     protected String JavaDoc sampleDir = "samples" + File.separator;
30     protected String JavaDoc outDir = "target" + File.separator + "generated" + File.separator + "samples" + File.separator;
31     protected String JavaDoc tempDir = "target" + File.separator + "generated" + File.separator + "temp";
32     protected String JavaDoc testResourceDir = "test-resources";
33
34
35     /**
36      * Basedir for all file I/O. Important when running tests from
37      * the reactor.
38      */

39     public String JavaDoc basedir = System.getProperty("basedir");
40
41     /**
42      * @param testName
43      */

44     public AbstractTestCase(String JavaDoc testName) {
45         super(testName);
46         if (basedir == null) {
47             basedir = new File JavaDoc(".").getAbsolutePath();
48         }
49         testDir = new File JavaDoc(basedir, testDir).getAbsolutePath();
50         sampleDir = new File JavaDoc(basedir, sampleDir).getAbsolutePath();
51         outDir = new File JavaDoc(basedir, outDir).getAbsolutePath();
52         tempDir = new File JavaDoc(basedir, tempDir).getAbsolutePath();
53     }
54
55
56     public File JavaDoc getTestResourceFile(String JavaDoc relativePath) {
57         return new File JavaDoc(testResourceDir, relativePath);
58     }
59 }
60
61
Popular Tags