ResourceBundleSearchTest.java revision 6358
6330N/A * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 6330N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6330N/A * This code is free software; you can redistribute it and/or modify it 6330N/A * under the terms of the GNU General Public License version 2 only, as 6330N/A * published by the Free Software Foundation. 6330N/A * This code is distributed in the hope that it will be useful, but WITHOUT 6330N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 6330N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 6330N/A * version 2 for more details (a copy is included in the LICENSE file that 6330N/A * You should have received a copy of the GNU General Public License version 6330N/A * 2 along with this work; if not, write to the Free Software Foundation, 6330N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 6330N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 6330N/A * or visit www.oracle.com if you need additional information or have any 6330N/A * @summary Remove the stack search for a resource bundle Logger to use 6330N/A * @build ResourceBundleSearchTest IndirectlyLoadABundle LoadItUp 6330N/A * @run main ResourceBundleSearchTest 6330N/A // ensure we are using en as the default Locale so we can find the resource 6330N/A // Find out where we are running from so we can setup the URLClassLoader URL 6330N/A // Test 1 - can we find a Logger bundle from doing a stack search? 6330N/A // Test 2 - can we find a Logger bundle off of the Thread context class 6330N/A // loader? We should be able to. 6330N/A // Test 3 - Can we find a Logger bundle from the classpath? We should be 6330N/A // We check to see if the bundle is on the classpath or not so that this 6330N/A // the resource bundles are not on the classpath. Running standalone 6330N/A "testGetBundleFromSystemClassLoader");
6330N/A "testGetBundleFromSystemClassLoader");
6330N/A // We only care about the messages if they were errors 6330N/A +
" was supposed to return true but did NOT!");
6330N/A +
" was supposed to return false but did NOT!");
6330N/A // This should fail. This was the old functionality to search up the 6330N/A // This should succeed. We should be able to get the bundle from the 6330N/A // thread context class loader 6330N/A * @param String bundleClass 6330N/A * @param ClassLoader to use for search 6330N/A * @return true iff bundleClass is on system classpath 6330N/A // we need a new logger name every time we attempt to find a bundle via 6330N/A // the Logger.getLogger call, so we'll simply tack on an integer which 6330N/A // we increment each time this is called 6330N/A // this should succeed if the bundle is on the system classpath. 6330N/A msgs.
add(
"INFO: testGetBundleFromSystemClassLoader() did not find bundle " 6330N/A msgs.
add(
"INFO: testGetBundleFromSystemClassLoader() found the bundle " 6330N/A // this should succeed if the bundle is on the system classpath.