Path: blob/master/test/jdk/java/lang/System/LoggerFinder/modules/LoggerInImageTest.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*/2223/*24* @test25* @modules jdk.compiler26* @summary Test cases which run against customized image, check the situation where27* 1. logger providers are in the customized image too,28* 2. clients are in named/unnamed module, image,29* patched system module, or Xbootclasspath30* This test does not require existence of java.logging module,31* but require jdk.compiler module32* @library /test/lib33* @build Base jdk.test.lib.compiler.CompilerUtils34* @run main/othervm LoggerInImageTest35*/3637public class LoggerInImageTest extends Base {3839public static void main(String args[]) throws Throwable {40LoggerInImageTest t = new LoggerInImageTest();41t.setup();42t.test();43}4445private void setup() throws Throwable {46setupAllClient();4748setupNamedLogger();4950setupLoggerImage();51setupFullImage();52}5354private void test() throws Throwable {55if (!checkJMODS()) {56return;57}5859// logger client is in named module m.t.a which is also in customized image60runTest(IMAGE_CLIENT_LOGGER,61"-m", CLIENT_A, "named", LOGGER_A);62// logger client in named module m.t.a63runTest(IMAGE_LOGGER,64"--module-path", DEST_NAMED_CLIENT.toString(),65"-m", CLIENT_A, "named", LOGGER_A);66// logger client is in unnamed module67runTest(IMAGE_LOGGER,68"--class-path", DEST_UNNAMED_CLIENT.toString(),69CLIENT_B, "named", LOGGER_A);70// logger client gets logger through boot class BootUsage71runTest(IMAGE_LOGGER,72"-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),73"--class-path", DEST_BOOT_CLIENT.toString(),74BOOT_CLIENT, "system", LAZY_LOGGER, LOGGER_A);75// logger client gets logger through patched class76// java.base/java.lang.PatchedUsage77runTest(IMAGE_LOGGER,78"--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),79"--class-path", DEST_PATCHED_CLIENT.toString(),80PATCHED_CLIENT, "system", LAZY_LOGGER, LOGGER_A);81}82}838485