Path: blob/master/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForJDKTest.java
41154 views
/*1* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223import java.io.File;2425/*26* @test27* @modules jdk.compiler28* @summary Test cases which run against the JDK image, check the situation where29* 1. logger providers are in unnamed module,30* 2. clients are in named/unnamed module,31* patched system module, or Xbootclasspath32* This test does not require existence of java.logging module,33* but require jdk.compiler module34* @library /test/lib35* @build Base jdk.test.lib.compiler.CompilerUtils36* @run main/othervm UnnamedLoggerForJDKTest37*/3839public class UnnamedLoggerForJDKTest extends Base {4041public static void main(String args[]) throws Throwable {42UnnamedLoggerForJDKTest t = new UnnamedLoggerForJDKTest();43t.setup();44t.test();45}4647private void setup() throws Throwable {48setupAllClient();4950setupUnnamedLogger();51}5253private void test() throws Throwable {54// logger client is in named module m.t.a55runTest(JDK_IMAGE,56"--class-path", DEST_UNNAMED_LOGGER.toString(),57"--module-path", DEST_NAMED_CLIENT.toString(),58"-m", CLIENT_A, "unnamed", LOGGER_B);59// logger client is also in unnamed module60runTest(JDK_IMAGE,61"--class-path", DEST_UNNAMED_LOGGER.toString()62+ File.pathSeparator + DEST_UNNAMED_CLIENT.toString(),63CLIENT_B, "unnamed", LOGGER_B);64// logger client gets logger through boot class BootUsage65runTest(JDK_IMAGE,66"--class-path", DEST_UNNAMED_LOGGER.toString()67+ File.pathSeparator + DEST_BOOT_CLIENT.toString(),68"-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),69BOOT_CLIENT, "system", LAZY_LOGGER, LOGGER_B);70// logger client gets logger through patched class71// java.base/java.lang.PatchedUsage72runTest(JDK_IMAGE,73"--class-path", DEST_UNNAMED_LOGGER.toString()74+ File.pathSeparator + DEST_PATCHED_CLIENT.toString(),75"--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),76PATCHED_CLIENT, "system", LAZY_LOGGER, LOGGER_B);77}78}798081