KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > logging > jdk14 > CustomConfigAPITestCase


1 /*
2  * Copyright 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.commons.logging.jdk14;
18
19 import junit.framework.Test;
20
21 import org.apache.commons.logging.PathableTestSuite;
22 import org.apache.commons.logging.PathableClassLoader;
23
24
25 /**
26  * TestCase for Jdk14 logging when the commons-logging-api jar file is in
27  * the parent classpath and commons-logging.jar is in the child.
28  */

29
30 public class CustomConfigAPITestCase extends CustomConfigTestCase {
31
32
33     public CustomConfigAPITestCase(String JavaDoc name) {
34         super(name);
35     }
36
37
38     /**
39      * Return the tests included in this test suite.
40      */

41     public static Test suite() throws Exception JavaDoc {
42         PathableClassLoader parent = new PathableClassLoader(null);
43         parent.useSystemLoader("junit.");
44         // the TestHandler class must be accessable from the System classloader
45
// in order for java.util.logging.LogManager.readConfiguration to
46
// be able to instantiate it. And this test case must see the same
47
// class in order to be able to access its data. Yes this is ugly
48
// but the whole jdk14 API is a ******* mess anyway.
49
parent.useSystemLoader("org.apache.commons.logging.jdk14.TestHandler");
50         parent.addLogicalLib("commons-logging-api");
51
52         PathableClassLoader child = new PathableClassLoader(parent);
53         child.addLogicalLib("testclasses");
54         child.addLogicalLib("commons-logging");
55         
56         Class JavaDoc testClass = child.loadClass(CustomConfigAPITestCase.class.getName());
57         return new PathableTestSuite(testClass, child);
58     }
59 }
60
Popular Tags