Path: blob/master/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForJDKTest.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 named 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 NamedLoggerForJDKTest37*/3839public class NamedLoggerForJDKTest extends Base {4041public static void main(String args[]) throws Throwable {42NamedLoggerForJDKTest t = new NamedLoggerForJDKTest();43t.setup();44t.test();45}4647private void setup() throws Throwable {48setupAllClient();4950setupNamedLogger();51}5253private void test() throws Throwable {54// logger client is in named module m.t.a55runTest(JDK_IMAGE,56"--module-path", DEST_NAMED_LOGGER.toString()57+ File.pathSeparator + DEST_NAMED_CLIENT.toString(),58"-m", CLIENT_A, "named", LOGGER_A);59// logger client is in unnamed module60runTest(JDK_IMAGE,61"--module-path", DEST_NAMED_LOGGER.toString(),62"--class-path", DEST_UNNAMED_CLIENT.toString(),63CLIENT_B, "named", LOGGER_A);64// logger client gets logger through boot class BootUsage65runTest(JDK_IMAGE,66"--module-path", DEST_NAMED_LOGGER.toString(),67"-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),68"--class-path", DEST_BOOT_CLIENT.toString(),69BOOT_CLIENT, "system", LAZY_LOGGER, LOGGER_A);70// logger client gets logger through patched class71// java.base/java.lang.PatchedUsage72runTest(JDK_IMAGE,73"--module-path", DEST_NAMED_LOGGER.toString(),74"--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),75"--class-path", DEST_PATCHED_CLIENT.toString(),76PATCHED_CLIENT, "system", LAZY_LOGGER, LOGGER_A);77}78}798081