KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

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