01: /*
02: * Copyright 2005 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: * TestCase for Jdk14 logging when the commons-logging jar file is in
26: * the parent classpath.
27: */
28:
29: public class CustomConfigFullTestCase extends CustomConfigTestCase {
30:
31: public CustomConfigFullTestCase(String name) {
32: super (name);
33: }
34:
35: /**
36: * Return the tests included in this test suite.
37: */
38: public static Test suite() throws Exception {
39: PathableClassLoader parent = new PathableClassLoader(null);
40: parent.useSystemLoader("junit.");
41: // the TestHandler class must be accessable from the System classloader
42: // in order for java.util.logging.LogManager.readConfiguration to
43: // be able to instantiate it. And this test case must see the same
44: // class in order to be able to access its data. Yes this is ugly
45: // but the whole jdk14 API is a ******* mess anyway.
46: parent
47: .useSystemLoader("org.apache.commons.logging.jdk14.TestHandler");
48: parent.addLogicalLib("commons-logging");
49:
50: PathableClassLoader child = new PathableClassLoader(parent);
51: child.addLogicalLib("testclasses");
52:
53: Class testClass = child
54: .loadClass(CustomConfigFullTestCase.class.getName());
55: return new PathableTestSuite(testClass, child);
56: }
57: }
|