KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > om > 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 package org.apache.axis2.om;
17
18 import junit.framework.TestCase;
19
20 import java.io.File JavaDoc;
21
22 /**
23  * Abstract base class for test cases.
24  */

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

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

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