1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package org.apache.commons.logging.jdk14; 19 20 21 import junit.framework.Test; 22 23 import org.apache.commons.logging.PathableTestSuite; 24 import org.apache.commons.logging.PathableClassLoader; 25 26 27 /** 28 * TestCase for Jdk14 logging when the commons-logging jar file is in 29 * the parent classpath. 30 */ 31 32 public class CustomConfigFullTestCase extends CustomConfigTestCase { 33 34 35 public CustomConfigFullTestCase(String name) { 36 super(name); 37 } 38 39 40 /** 41 * Return the tests included in this test suite. 42 */ 43 public static Test suite() throws Exception { 44 PathableClassLoader parent = new PathableClassLoader(null); 45 parent.useExplicitLoader("junit.", Test.class.getClassLoader()); 46 47 // the TestHandler class must be accessable from the System classloader 48 // in order for java.util.logging.LogManager.readConfiguration to 49 // be able to instantiate it. And this test case must see the same 50 // class in order to be able to access its data. Yes this is ugly 51 // but the whole jdk14 API is a ******* mess anyway. 52 ClassLoader scl = ClassLoader.getSystemClassLoader(); 53 loadTestHandler(HANDLER_NAME, scl); 54 parent.useExplicitLoader(HANDLER_NAME, scl); 55 parent.addLogicalLib("commons-logging"); 56 57 PathableClassLoader child = new PathableClassLoader(parent); 58 child.addLogicalLib("testclasses"); 59 60 Class testClass = child.loadClass(CustomConfigFullTestCase.class.getName()); 61 return new PathableTestSuite(testClass, child); 62 } 63 }