author | alanb |
Fri, 07 Apr 2017 08:05:54 +0000 | |
changeset 44545 | 83b611b88ac8 |
parent 42338 | a60f280f803c |
permissions | -rw-r--r-- |
34428
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
1 |
/* |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
4 |
* |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
8 |
* |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
13 |
* accompanied this code). |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
14 |
* |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
18 |
* |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
21 |
* questions. |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
22 |
*/ |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
23 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
24 |
import java.io.PrintStream; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
25 |
import java.lang.System.Logger; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
26 |
import java.lang.System.Logger.Level; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
27 |
import java.util.ArrayList; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
28 |
import java.util.concurrent.atomic.AtomicBoolean; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
29 |
import java.util.Enumeration; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
30 |
import java.util.List; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
31 |
import java.util.ResourceBundle; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
32 |
import java.util.Set; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
33 |
import jdk.internal.logger.BootstrapLogger; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
34 |
import jdk.internal.logger.LazyLoggers; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
35 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
36 |
/* |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
37 |
* @test |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
38 |
* @bug 8144460 8144214 |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
39 |
* @summary Cover the logXX and LogEvent.valueOf APIs of BootstrapLogger |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
40 |
* and logXX APIs of SimpleConsoleLogger. |
42338
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
37672
diff
changeset
|
41 |
* @modules java.base/jdk.internal.logger:+open |
35315 | 42 |
* java.base/sun.util.logging |
34428
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
43 |
* @build BootstrapLoggerUtils LogStream |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
44 |
* @run main/othervm BootstrapLoggerAPIsTest |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
45 |
*/ |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
46 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
47 |
public class BootstrapLoggerAPIsTest { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
48 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
49 |
private static final LogStream ERR = new LogStream(); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
50 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
51 |
public static void main(String[] args) throws Exception { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
52 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
53 |
final ContentManager MGR = new ContentManager(); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
54 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
55 |
// private reflection hook that allows us to simulate a non booted VM |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
56 |
final AtomicBoolean VM_BOOTED = new AtomicBoolean(false); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
57 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
58 |
BootstrapLoggerUtils.setBootedHook(() -> VM_BOOTED.get()); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
59 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
60 |
// We replace System.err to check the messages that have been logged |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
61 |
// by the JUL ConsoleHandler and default SimpleConsoleLogger |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
62 |
// implementaion |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
63 |
System.setErr(new PrintStream(ERR)); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
64 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
65 |
VM_BOOTED.getAndSet(false); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
66 |
if (BootstrapLogger.isBooted()) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
67 |
throw new RuntimeException("VM should not be booted!"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
68 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
69 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
70 |
final Logger LOGGER = |
37672
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
35315
diff
changeset
|
71 |
LazyLoggers.getLogger("foo.bar", Thread.class.getModule()); |
34428
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
72 |
final sun.util.logging.PlatformLogger.Level PLATFORM_LEVEL = |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
73 |
sun.util.logging.PlatformLogger.Level.SEVERE; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
74 |
final MyResources BUNDLE = new MyResources(); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
75 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
76 |
/* |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
77 |
* Test logXX APIs for interface java.lang.System.Logger. Log content |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
78 |
* before VM is booted should be retained. Log content after VM was |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
79 |
* booted should be flushed instantly. VM is not booted in first round |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
80 |
* of loop, VM is booted in second round of loop. |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
81 |
*/ |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
82 |
for (int i = 0; i < 2; i++) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
83 |
boolean booted = BootstrapLogger.isBooted(); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
84 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
85 |
// make sure there is no [remaining] content in the LogStream. |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
86 |
MGR.failLog("xyz", "throwable #", "MyClass_#", "MyMethod_#"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
87 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
88 |
/* |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
89 |
* test logXX APIs for interface java.lang.System.Logger. |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
90 |
*/ |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
91 |
// void log(java.lang.System$Logger$Level,java.util.ResourceBundle, |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
92 |
// java.lang.String,java.lang.Throwable) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
93 |
LOGGER.log(Level.ERROR, BUNDLE, "abc #0", new RuntimeException("throwable #0")); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
94 |
MGR.checkLog(booted, "xyz #0", "throwable #0"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
95 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
96 |
// void log(java.lang.System$Logger$Level,java.util.ResourceBundle, |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
97 |
// java.lang.String,java.lang.Object[]) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
98 |
LOGGER.log(Level.ERROR, BUNDLE, "abc #1"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
99 |
MGR.checkLog(booted, "xyz #1"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
100 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
101 |
// void log(java.lang.System$Logger$Level,java.lang.String,java.lang.Object[]) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
102 |
LOGGER.log(Level.ERROR, BUNDLE, "abc {0}", "#2"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
103 |
MGR.checkLog(booted, "xyz #2"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
104 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
105 |
// void log(java.lang.System$Logger$Level,java.lang.String,java.lang.Throwable) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
106 |
LOGGER.log(Level.ERROR, "xyz #3", new RuntimeException("throwable #3")); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
107 |
MGR.checkLog(booted, "xyz #3", "throwable #3"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
108 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
109 |
// void log(java.lang.System$Logger$Level,java.util.function.Supplier) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
110 |
LOGGER.log(Level.ERROR, () -> "xyz #4"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
111 |
MGR.checkLog(booted, "xyz #4"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
112 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
113 |
// void log(java.lang.System$Logger$Level,java.lang.Object) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
114 |
LOGGER.log(Level.ERROR, new MyObject("xyz #5")); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
115 |
MGR.checkLog(booted, "xyz #5"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
116 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
117 |
// void log(java.lang.System$Logger$Level,java.util.function.Supplier, |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
118 |
// java.lang.Throwable) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
119 |
LOGGER.log(Level.ERROR, () -> "xyz #6", new RuntimeException("throwable #6")); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
120 |
MGR.checkLog(booted, "xyz #6", "throwable #6"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
121 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
122 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
123 |
/* |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
124 |
* test logXX APIs for interface |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
125 |
* sun.util.logging.PlatformLogger.Bridge. |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
126 |
*/ |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
127 |
sun.util.logging.PlatformLogger.Bridge bridge = |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
128 |
(sun.util.logging.PlatformLogger.Bridge) LOGGER; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
129 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
130 |
// void log(sun.util.logging.PlatformLogger$Level,java.lang.String) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
131 |
bridge.log(PLATFORM_LEVEL, "xyz #7"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
132 |
MGR.checkLog(booted, "xyz #7"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
133 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
134 |
// void log(sun.util.logging.PlatformLogger$Level,java.lang.String,java.lang.Throwable) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
135 |
bridge.log(PLATFORM_LEVEL, "xyz #8", new RuntimeException("throwable #8")); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
136 |
MGR.checkLog(booted, "xyz #8", "throwable #8"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
137 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
138 |
// void log(sun.util.logging.PlatformLogger$Level,java.lang.String,java.lang.Object[]) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
139 |
bridge.log(PLATFORM_LEVEL, "xyz {0}", "#9"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
140 |
MGR.checkLog(booted, "xyz #9"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
141 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
142 |
// void log(sun.util.logging.PlatformLogger$Level,java.util.function.Supplier) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
143 |
bridge.log(PLATFORM_LEVEL, () -> "xyz #10"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
144 |
MGR.checkLog(booted, "xyz #10"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
145 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
146 |
// void log(sun.util.logging.PlatformLogger$Level, |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
147 |
// java.lang.Throwable,java.util.function.Supplier) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
148 |
bridge.log(PLATFORM_LEVEL, new RuntimeException("throwable #11"), () -> "xyz #11"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
149 |
MGR.checkLog(booted, "xyz #11", "throwable #11"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
150 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
151 |
// void logp(sun.util.logging.PlatformLogger$Level,java.lang.String, |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
152 |
// java.lang.String,java.lang.String) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
153 |
bridge.logp(PLATFORM_LEVEL, "MyClass_#12", "MyMethod_#12", "xyz #12"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
154 |
MGR.checkLog(booted, "xyz #12", "MyClass_#12", "MyMethod_#12"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
155 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
156 |
// void logp(sun.util.logging.PlatformLogger$Level,java.lang.String, |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
157 |
// java.lang.String,java.util.function.Supplier) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
158 |
bridge.logp(PLATFORM_LEVEL, "MyClass_#13", "MyMethod_#13", () -> "xyz #13"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
159 |
MGR.checkLog(booted, "xyz #13", "MyClass_#13", "MyMethod_#13"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
160 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
161 |
// void logp(sun.util.logging.PlatformLogger$Level,java.lang.String, |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
162 |
// java.lang.String,java.lang.String,java.lang.Object[]) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
163 |
bridge.logp(PLATFORM_LEVEL, "MyClass_#14", "MyMethod_#14", "xyz {0}", "#14"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
164 |
MGR.checkLog(booted, "xyz #14", "MyClass_#14", "MyMethod_#14"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
165 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
166 |
// void logp(sun.util.logging.PlatformLogger$Level,java.lang.String, |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
167 |
// java.lang.String,java.lang.String,java.lang.Throwable) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
168 |
bridge.logp(PLATFORM_LEVEL, "MyClass_#15", "MyMethod_#15", |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
169 |
"xyz #15", new RuntimeException("throwable #15")); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
170 |
MGR.checkLog(booted, "xyz #15", "throwable #15", "MyClass_#15", "MyMethod_#15"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
171 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
172 |
// void logp(sun.util.logging.PlatformLogger$Level,java.lang.String, |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
173 |
// java.lang.String,java.lang.Throwable,java.util.function.Supplier) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
174 |
bridge.logp(PLATFORM_LEVEL, "MyClass_#16", "MyMethod_#16", |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
175 |
new RuntimeException("throwable #16"), () -> "xyz #16"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
176 |
MGR.checkLog(booted, "xyz #16", "throwable #16", "MyClass_#16", "MyMethod_#16"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
177 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
178 |
// void logrb(sun.util.logging.PlatformLogger$Level,java.lang.String,java.lang.String, |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
179 |
// java.util.ResourceBundle,java.lang.String,java.lang.Object[]) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
180 |
bridge.logrb(PLATFORM_LEVEL, "MyClass_#17", "MyMethod_#17", |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
181 |
BUNDLE, "abc {0}", "#17"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
182 |
MGR.checkLog(booted, "xyz #17", "MyClass_#17", "MyMethod_#17"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
183 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
184 |
// void logrb(sun.util.logging.PlatformLogger$Level,java.lang.String,java.lang.String, |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
185 |
// java.util.ResourceBundle,java.lang.String,java.lang.Throwable) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
186 |
bridge.logrb(PLATFORM_LEVEL, "MyClass_#18", "MyMethod_#18", |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
187 |
BUNDLE, "abc #18", new RuntimeException("throwable #18")); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
188 |
MGR.checkLog(booted, "xyz #18", "throwable #18", "MyClass_#18", "MyMethod_#18"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
189 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
190 |
// void logrb(sun.util.logging.PlatformLogger$Level,java.util.ResourceBundle, |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
191 |
// java.lang.String,java.lang.Object[]) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
192 |
bridge.logrb(PLATFORM_LEVEL, BUNDLE, "abc {0}", "#19"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
193 |
MGR.checkLog(booted, "xyz #19"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
194 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
195 |
// void logrb(sun.util.logging.PlatformLogger$Level,java.util.ResourceBundle, |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
196 |
// java.lang.String,java.lang.Throwable) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
197 |
bridge.logrb(PLATFORM_LEVEL, BUNDLE, "abc #20", |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
198 |
new RuntimeException("throwable #20")); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
199 |
MGR.checkLog(booted, "xyz #20", "throwable #20"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
200 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
201 |
/* |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
202 |
* retained log content should be flushed after VM is booted. |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
203 |
*/ |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
204 |
if (!booted) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
205 |
VM_BOOTED.getAndSet(true); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
206 |
// trigger the flush, make sure to call LOGGER.log(...) |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
207 |
// after VM_BOOTED.getAndSet(true) and before MGR.assertCachedLog() |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
208 |
LOGGER.log(Level.ERROR, "VM was just booted! This log should flush the cached logs."); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
209 |
MGR.assertCachedLog(); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
210 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
211 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
212 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
213 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
214 |
private static class ContentManager { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
215 |
final List<String[]> cached = new ArrayList<String[]>(); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
216 |
String[] last; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
217 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
218 |
public void cache() { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
219 |
cached.add(last); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
220 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
221 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
222 |
public ContentManager failLog(String... nonexistent) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
223 |
last = nonexistent; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
224 |
for (String c : nonexistent) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
225 |
if (ERR.drain().contains(c)) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
226 |
throw new RuntimeException("Content \"" + nonexistent |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
227 |
+ "\" should not exist in the log!"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
228 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
229 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
230 |
return this; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
231 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
232 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
233 |
public void assertLog(String... logs) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
234 |
String log = ERR.drain(); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
235 |
for (String str : logs) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
236 |
if (!log.contains(str)) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
237 |
throw new RuntimeException("Content \"" + str + "\" does not exist in the log!"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
238 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
239 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
240 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
241 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
242 |
public void checkLog(boolean booted, String... logs) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
243 |
if (!booted) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
244 |
failLog(logs).cache(); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
245 |
} else { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
246 |
assertLog(logs); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
247 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
248 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
249 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
250 |
public void assertCachedLog() { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
251 |
String log = ERR.drain(); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
252 |
for (String[] arr : cached) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
253 |
for (String c : arr) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
254 |
if (!log.contains(c)) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
255 |
throw new RuntimeException("Content \"" + c + "\" does not exist in the log!"); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
256 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
257 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
258 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
259 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
260 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
261 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
262 |
private static class MyObject { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
263 |
String str; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
264 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
265 |
public MyObject(String str) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
266 |
this.str = str; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
267 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
268 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
269 |
public String toString() { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
270 |
return str; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
271 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
272 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
273 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
274 |
private static class MyResources extends ResourceBundle { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
275 |
public Object handleGetObject(String key) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
276 |
if (key.contains("abc #") || key.contains("abc {")) { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
277 |
return key.replaceAll("abc ", "xyz "); |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
278 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
279 |
return null; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
280 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
281 |
|
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
282 |
public Enumeration<String> getKeys() { |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
283 |
return null; |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
284 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
285 |
} |
39f1caf048c3
8144460: Improve the code coverage for BootstrapLogger and SimpleConsoleLogger APIs and verify bug fix JDK-8144214
mli
parents:
diff
changeset
|
286 |
} |