author | dfuchs |
Wed, 27 Apr 2016 18:04:16 +0200 | |
changeset 37672 | 03684934dc09 |
parent 33875 | c1c71107d45f |
permissions | -rw-r--r-- |
33875
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
1 |
/* |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
4 |
* |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
8 |
* |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
13 |
* accompanied this code). |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
14 |
* |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
18 |
* |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
21 |
* questions. |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
22 |
*/ |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
23 |
import java.security.AccessControlException; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
24 |
import java.security.CodeSource; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
25 |
import java.security.Permission; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
26 |
import java.security.PermissionCollection; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
27 |
import java.security.Permissions; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
28 |
import java.security.Policy; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
29 |
import java.security.ProtectionDomain; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
30 |
import java.util.Collections; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
31 |
import java.util.Enumeration; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
32 |
import java.util.HashMap; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
33 |
import java.util.Map; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
34 |
import java.util.ResourceBundle; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
35 |
import java.util.stream.Stream; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
36 |
import java.util.concurrent.ConcurrentHashMap; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
37 |
import java.util.concurrent.atomic.AtomicBoolean; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
38 |
import java.util.concurrent.atomic.AtomicLong; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
39 |
import java.util.function.Supplier; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
40 |
import java.lang.System.LoggerFinder; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
41 |
import java.lang.System.Logger; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
42 |
import java.lang.System.Logger.Level; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
43 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
44 |
/** |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
45 |
* @test |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
46 |
* @bug 8140364 |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
47 |
* @summary Tests a naive implementation of LoggerFinder, and in particular |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
48 |
* the default body of System.Logger methods. |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
49 |
* @build AccessSystemLogger BaseLoggerFinderTest CustomSystemClassLoader BaseLoggerFinder TestLoggerFinder |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
50 |
* @run driver AccessSystemLogger |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
51 |
* @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerFinderTest NOSECURITY |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
52 |
* @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerFinderTest NOPERMISSIONS |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
53 |
* @run main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerFinderTest WITHPERMISSIONS |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
54 |
* @author danielfuchs |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
55 |
*/ |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
56 |
public class BaseLoggerFinderTest { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
57 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
58 |
static final RuntimePermission LOGGERFINDER_PERMISSION = |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
59 |
new RuntimePermission("loggerFinder"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
60 |
final static boolean VERBOSE = false; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
61 |
static final ThreadLocal<AtomicBoolean> allowControl = new ThreadLocal<AtomicBoolean>() { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
62 |
@Override |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
63 |
protected AtomicBoolean initialValue() { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
64 |
return new AtomicBoolean(false); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
65 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
66 |
}; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
67 |
static final ThreadLocal<AtomicBoolean> allowAccess = new ThreadLocal<AtomicBoolean>() { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
68 |
@Override |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
69 |
protected AtomicBoolean initialValue() { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
70 |
return new AtomicBoolean(false); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
71 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
72 |
}; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
73 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
74 |
final static AccessSystemLogger accessSystemLogger = new AccessSystemLogger(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
75 |
static final Class<?> providerClass; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
76 |
static { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
77 |
try { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
78 |
providerClass = ClassLoader.getSystemClassLoader().loadClass("BaseLoggerFinder"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
79 |
} catch (ClassNotFoundException ex) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
80 |
throw new ExceptionInInitializerError(ex); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
81 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
82 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
83 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
84 |
public static class MyBundle extends ResourceBundle { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
85 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
86 |
final ConcurrentHashMap<String,String> map = new ConcurrentHashMap<>(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
87 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
88 |
@Override |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
89 |
protected Object handleGetObject(String key) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
90 |
if (key.contains(" (translated)")) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
91 |
throw new RuntimeException("Unexpected key: " + key); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
92 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
93 |
return map.computeIfAbsent(key, k -> k + " (translated)"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
94 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
95 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
96 |
@Override |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
97 |
public Enumeration<String> getKeys() { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
98 |
return Collections.enumeration(map.keySet()); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
99 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
100 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
101 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
102 |
public static class MyLoggerBundle extends MyBundle { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
103 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
104 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
105 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
106 |
static enum TestCases {NOSECURITY, NOPERMISSIONS, WITHPERMISSIONS}; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
107 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
108 |
static void setSecurityManager() { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
109 |
if (System.getSecurityManager() == null) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
110 |
Policy.setPolicy(new SimplePolicy(allowControl, allowAccess)); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
111 |
System.setSecurityManager(new SecurityManager()); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
112 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
113 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
114 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
115 |
public static void main(String[] args) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
116 |
if (args.length == 0) |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
117 |
args = new String[] { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
118 |
//"NOSECURITY", |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
119 |
"NOPERMISSIONS", |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
120 |
"WITHPERMISSIONS" |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
121 |
}; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
122 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
123 |
System.out.println("Using provider class: " + providerClass + "[" + providerClass.getClassLoader() + "]"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
124 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
125 |
Stream.of(args).map(TestCases::valueOf).forEach((testCase) -> { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
126 |
TestLoggerFinder provider; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
127 |
switch (testCase) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
128 |
case NOSECURITY: |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
129 |
System.out.println("\n*** Without Security Manager\n"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
130 |
provider = TestLoggerFinder.class.cast(LoggerFinder.getLoggerFinder()); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
131 |
test(provider, true); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
132 |
System.out.println("Tetscase count: " + TestLoggerFinder.sequencer.get()); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
133 |
break; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
134 |
case NOPERMISSIONS: |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
135 |
System.out.println("\n*** With Security Manager, without permissions\n"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
136 |
setSecurityManager(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
137 |
try { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
138 |
provider = TestLoggerFinder.class.cast(LoggerFinder.getLoggerFinder()); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
139 |
throw new RuntimeException("Expected exception not raised"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
140 |
} catch (AccessControlException x) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
141 |
if (!LOGGERFINDER_PERMISSION.equals(x.getPermission())) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
142 |
throw new RuntimeException("Unexpected permission check", x); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
143 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
144 |
final boolean control = allowControl.get().get(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
145 |
try { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
146 |
allowControl.get().set(true); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
147 |
provider = TestLoggerFinder.class.cast(LoggerFinder.getLoggerFinder()); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
148 |
} finally { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
149 |
allowControl.get().set(control); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
150 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
151 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
152 |
test(provider, false); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
153 |
System.out.println("Tetscase count: " + TestLoggerFinder.sequencer.get()); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
154 |
break; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
155 |
case WITHPERMISSIONS: |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
156 |
System.out.println("\n*** With Security Manager, with control permission\n"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
157 |
setSecurityManager(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
158 |
final boolean control = allowControl.get().get(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
159 |
try { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
160 |
allowControl.get().set(true); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
161 |
provider = TestLoggerFinder.class.cast(LoggerFinder.getLoggerFinder()); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
162 |
test(provider, true); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
163 |
} finally { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
164 |
allowControl.get().set(control); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
165 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
166 |
break; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
167 |
default: |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
168 |
throw new RuntimeException("Unknown test case: " + testCase); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
169 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
170 |
}); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
171 |
System.out.println("\nPASSED: Tested " + TestLoggerFinder.sequencer.get() + " cases."); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
172 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
173 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
174 |
public static void test(TestLoggerFinder provider, boolean hasRequiredPermissions) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
175 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
176 |
ResourceBundle loggerBundle = ResourceBundle.getBundle(MyLoggerBundle.class.getName()); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
177 |
final Map<Logger, String> loggerDescMap = new HashMap<>(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
178 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
179 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
180 |
// 1. Test loggers returned by LoggerFinder, both for system callers |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
181 |
// and not system callers. |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
182 |
TestLoggerFinder.LoggerImpl appLogger1 = null; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
183 |
try { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
184 |
appLogger1 = |
37672
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
33875
diff
changeset
|
185 |
TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", BaseLoggerFinderTest.class.getModule())); |
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
33875
diff
changeset
|
186 |
loggerDescMap.put(appLogger1, "provider.getLogger(\"foo\", BaseLoggerFinderTest.class.getModule())"); |
33875
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
187 |
if (!hasRequiredPermissions) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
188 |
throw new RuntimeException("Managed to obtain a logger without permission"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
189 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
190 |
} catch (AccessControlException acx) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
191 |
if (hasRequiredPermissions) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
192 |
throw new RuntimeException("Unexpected security exception: ", acx); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
193 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
194 |
if (!acx.getPermission().equals(LOGGERFINDER_PERMISSION)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
195 |
throw new RuntimeException("Unexpected permission in exception: " + acx, acx); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
196 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
197 |
System.out.println("Got expected exception for logger: " + acx); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
198 |
final boolean old = allowControl.get().get(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
199 |
allowControl.get().set(true); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
200 |
try { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
201 |
appLogger1 = |
37672
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
33875
diff
changeset
|
202 |
TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", BaseLoggerFinderTest.class.getModule())); |
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
33875
diff
changeset
|
203 |
loggerDescMap.put(appLogger1, "provider.getLogger(\"foo\", BaseLoggerFinderTest.class.getModule())"); |
33875
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
204 |
} finally { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
205 |
allowControl.get().set(old); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
206 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
207 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
208 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
209 |
TestLoggerFinder.LoggerImpl sysLogger1 = null; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
210 |
try { |
37672
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
33875
diff
changeset
|
211 |
sysLogger1 = TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", Thread.class.getModule())); |
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
33875
diff
changeset
|
212 |
loggerDescMap.put(sysLogger1, "provider.getLogger(\"foo\", Thread.class.getModule())"); |
33875
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
213 |
if (!hasRequiredPermissions) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
214 |
throw new RuntimeException("Managed to obtain a system logger without permission"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
215 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
216 |
} catch (AccessControlException acx) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
217 |
if (hasRequiredPermissions) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
218 |
throw new RuntimeException("Unexpected security exception: ", acx); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
219 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
220 |
if (!acx.getPermission().equals(LOGGERFINDER_PERMISSION)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
221 |
throw new RuntimeException("Unexpected permission in exception: " + acx, acx); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
222 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
223 |
System.out.println("Got expected exception for system logger: " + acx); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
224 |
final boolean old = allowControl.get().get(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
225 |
allowControl.get().set(true); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
226 |
try { |
37672
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
33875
diff
changeset
|
227 |
sysLogger1 = TestLoggerFinder.LoggerImpl.class.cast(provider.getLogger("foo", Thread.class.getModule())); |
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
33875
diff
changeset
|
228 |
loggerDescMap.put(sysLogger1, "provider.getLogger(\"foo\", Thread.class.getModule())"); |
33875
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
229 |
} finally { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
230 |
allowControl.get().set(old); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
231 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
232 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
233 |
if (appLogger1 == sysLogger1) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
234 |
throw new RuntimeException("identical loggers"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
235 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
236 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
237 |
if (provider.system.contains(appLogger1)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
238 |
throw new RuntimeException("app logger in system map"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
239 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
240 |
if (!provider.user.contains(appLogger1)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
241 |
throw new RuntimeException("app logger not in appplication map"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
242 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
243 |
if (provider.user.contains(sysLogger1)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
244 |
throw new RuntimeException("sys logger in appplication map"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
245 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
246 |
if (!provider.system.contains(sysLogger1)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
247 |
throw new RuntimeException("sys logger not in system map"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
248 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
249 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
250 |
testLogger(provider, loggerDescMap, "foo", null, appLogger1, appLogger1); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
251 |
testLogger(provider, loggerDescMap, "foo", null, sysLogger1, sysLogger1); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
252 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
253 |
// 2. Test localized loggers returned LoggerFinder, both for system |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
254 |
// callers and non system callers |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
255 |
Logger appLogger2 = null; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
256 |
try { |
37672
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
33875
diff
changeset
|
257 |
appLogger2 = provider.getLocalizedLogger("foo", loggerBundle, BaseLoggerFinderTest.class.getModule()); |
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
33875
diff
changeset
|
258 |
loggerDescMap.put(appLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, BaseLoggerFinderTest.class.getModule())"); |
33875
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
259 |
if (!hasRequiredPermissions) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
260 |
throw new RuntimeException("Managed to obtain a logger without permission"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
261 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
262 |
} catch (AccessControlException acx) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
263 |
if (hasRequiredPermissions) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
264 |
throw new RuntimeException("Unexpected security exception: ", acx); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
265 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
266 |
if (!acx.getPermission().equals(LOGGERFINDER_PERMISSION)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
267 |
throw new RuntimeException("Unexpected permission in exception: " + acx, acx); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
268 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
269 |
System.out.println("Got expected exception for logger: " + acx); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
270 |
final boolean old = allowControl.get().get(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
271 |
allowControl.get().set(true); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
272 |
try { |
37672
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
33875
diff
changeset
|
273 |
appLogger2 = provider.getLocalizedLogger("foo", loggerBundle, BaseLoggerFinderTest.class.getModule()); |
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
33875
diff
changeset
|
274 |
loggerDescMap.put(appLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, BaseLoggerFinderTest.class.getModule())"); |
33875
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
275 |
} finally { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
276 |
allowControl.get().set(old); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
277 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
278 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
279 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
280 |
Logger sysLogger2 = null; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
281 |
try { |
37672
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
33875
diff
changeset
|
282 |
sysLogger2 = provider.getLocalizedLogger("foo", loggerBundle, Thread.class.getModule()); |
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
33875
diff
changeset
|
283 |
loggerDescMap.put(sysLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, Thread.class.getModule())"); |
33875
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
284 |
if (!hasRequiredPermissions) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
285 |
throw new RuntimeException("Managed to obtain a system logger without permission"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
286 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
287 |
} catch (AccessControlException acx) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
288 |
if (hasRequiredPermissions) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
289 |
throw new RuntimeException("Unexpected security exception: ", acx); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
290 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
291 |
if (!acx.getPermission().equals(LOGGERFINDER_PERMISSION)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
292 |
throw new RuntimeException("Unexpected permission in exception: " + acx, acx); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
293 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
294 |
System.out.println("Got expected exception for localized system logger: " + acx); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
295 |
final boolean old = allowControl.get().get(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
296 |
allowControl.get().set(true); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
297 |
try { |
37672
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
33875
diff
changeset
|
298 |
sysLogger2 = provider.getLocalizedLogger("foo", loggerBundle, Thread.class.getModule()); |
03684934dc09
8148568: LoggerFinder.getLogger and LoggerFinder.getLocalizedLogger should take a Module argument instead of a Class.
dfuchs
parents:
33875
diff
changeset
|
299 |
loggerDescMap.put(sysLogger2, "provider.getLocalizedLogger(\"foo\", loggerBundle, Thread.class.getModule()))"); |
33875
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
300 |
} finally { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
301 |
allowControl.get().set(old); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
302 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
303 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
304 |
if (appLogger2 == sysLogger2) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
305 |
throw new RuntimeException("identical loggers"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
306 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
307 |
if (appLogger2 == appLogger1) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
308 |
throw new RuntimeException("identical loggers"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
309 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
310 |
if (sysLogger2 == sysLogger1) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
311 |
throw new RuntimeException("identical loggers"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
312 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
313 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
314 |
if (provider.system.contains(appLogger2)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
315 |
throw new RuntimeException("localized app logger in system map"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
316 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
317 |
if (provider.user.contains(appLogger2)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
318 |
throw new RuntimeException("localized app logger in appplication map"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
319 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
320 |
if (provider.user.contains(sysLogger2)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
321 |
throw new RuntimeException("localized sys logger in appplication map"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
322 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
323 |
if (provider.system.contains(sysLogger2)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
324 |
throw new RuntimeException("localized sys logger not in system map"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
325 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
326 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
327 |
testLogger(provider, loggerDescMap, "foo", loggerBundle, appLogger2, appLogger1); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
328 |
testLogger(provider, loggerDescMap, "foo", loggerBundle, sysLogger2, sysLogger1); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
329 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
330 |
// 3 Test loggers returned by: |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
331 |
// 3.1: System.getLogger("foo") |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
332 |
Logger appLogger3 = System.getLogger("foo"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
333 |
loggerDescMap.put(appLogger3, "System.getLogger(\"foo\")"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
334 |
testLogger(provider, loggerDescMap, "foo", null, appLogger3, appLogger1); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
335 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
336 |
// 3.2: System.getLogger("foo") |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
337 |
// Emulate what System.getLogger() does when the caller is a |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
338 |
// platform classes |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
339 |
Logger sysLogger3 = accessSystemLogger.getLogger("foo"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
340 |
loggerDescMap.put(sysLogger3, "AccessSystemLogger.getLogger(\"foo\")"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
341 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
342 |
if (appLogger3 == sysLogger3) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
343 |
throw new RuntimeException("identical loggers"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
344 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
345 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
346 |
testLogger(provider, loggerDescMap, "foo", null, sysLogger3, sysLogger1); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
347 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
348 |
// 4. Test loggers returned by: |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
349 |
// 4.1 System.getLogger("foo", loggerBundle) |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
350 |
Logger appLogger4 = |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
351 |
System.getLogger("foo", loggerBundle); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
352 |
loggerDescMap.put(appLogger4, "System.getLogger(\"foo\", loggerBundle)"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
353 |
if (appLogger4 == appLogger1) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
354 |
throw new RuntimeException("identical loggers"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
355 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
356 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
357 |
testLogger(provider, loggerDescMap, "foo", loggerBundle, appLogger4, appLogger1); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
358 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
359 |
// 4.2: System.getLogger("foo", loggerBundle) |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
360 |
// Emulate what System.getLogger() does when the caller is a |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
361 |
// platform classes |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
362 |
Logger sysLogger4 = accessSystemLogger.getLogger("foo", loggerBundle); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
363 |
loggerDescMap.put(sysLogger4, "AccessSystemLogger.getLogger(\"foo\", loggerBundle)"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
364 |
if (appLogger4 == sysLogger4) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
365 |
throw new RuntimeException("identical loggers"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
366 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
367 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
368 |
testLogger(provider, loggerDescMap, "foo", loggerBundle, sysLogger4, sysLogger1); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
369 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
370 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
371 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
372 |
public static class Foo { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
373 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
374 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
375 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
376 |
static void verbose(String msg) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
377 |
if (VERBOSE) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
378 |
System.out.println(msg); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
379 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
380 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
381 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
382 |
// Calls the 8 methods defined on Logger and verify the |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
383 |
// parameters received by the underlying TestProvider.LoggerImpl |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
384 |
// logger. |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
385 |
private static void testLogger(TestLoggerFinder provider, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
386 |
Map<Logger, String> loggerDescMap, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
387 |
String name, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
388 |
ResourceBundle loggerBundle, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
389 |
Logger logger, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
390 |
TestLoggerFinder.LoggerImpl sink) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
391 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
392 |
System.out.println("Testing " + loggerDescMap.get(logger) + " [" + logger +"]"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
393 |
AtomicLong sequencer = TestLoggerFinder.sequencer; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
394 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
395 |
Foo foo = new Foo(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
396 |
String fooMsg = foo.toString(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
397 |
for (Level loggerLevel : Level.values()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
398 |
sink.level = loggerLevel; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
399 |
for (Level messageLevel : Level.values()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
400 |
String desc = "logger.log(messageLevel, foo): loggerLevel=" |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
401 |
+ loggerLevel+", messageLevel="+messageLevel; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
402 |
TestLoggerFinder.LogEvent expected = |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
403 |
TestLoggerFinder.LogEvent.of( |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
404 |
sequencer.get(), |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
405 |
messageLevel.compareTo(loggerLevel) >= 0, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
406 |
name, messageLevel, (ResourceBundle)null, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
407 |
fooMsg, null, (Throwable)null, (Object[])null); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
408 |
logger.log(messageLevel, foo); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
409 |
if (loggerLevel == Level.OFF || messageLevel.compareTo(loggerLevel) < 0) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
410 |
if (provider.eventQueue.poll() != null) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
411 |
throw new RuntimeException("unexpected event in queue for " + desc); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
412 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
413 |
} else { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
414 |
TestLoggerFinder.LogEvent actual = provider.eventQueue.poll(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
415 |
if (!expected.equals(actual)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
416 |
throw new RuntimeException("mismatch for " + desc |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
417 |
+ "\n\texpected=" + expected |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
418 |
+ "\n\t actual=" + actual); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
419 |
} else { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
420 |
verbose("Got expected results for " |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
421 |
+ desc + "\n\t" + expected); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
422 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
423 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
424 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
425 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
426 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
427 |
String msg = "blah"; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
428 |
for (Level loggerLevel : Level.values()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
429 |
sink.level = loggerLevel; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
430 |
for (Level messageLevel : Level.values()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
431 |
String desc = "logger.log(messageLevel, \"blah\"): loggerLevel=" |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
432 |
+ loggerLevel+", messageLevel="+messageLevel; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
433 |
TestLoggerFinder.LogEvent expected = |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
434 |
TestLoggerFinder.LogEvent.of( |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
435 |
sequencer.get(), |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
436 |
messageLevel.compareTo(loggerLevel) >= 0 && loggerLevel != Level.OFF, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
437 |
name, messageLevel, loggerBundle, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
438 |
msg, null, (Throwable)null, (Object[])null); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
439 |
logger.log(messageLevel, msg); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
440 |
TestLoggerFinder.LogEvent actual = provider.eventQueue.poll(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
441 |
if (!expected.equals(actual)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
442 |
throw new RuntimeException("mismatch for " + desc |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
443 |
+ "\n\texpected=" + expected |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
444 |
+ "\n\t actual=" + actual); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
445 |
} else { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
446 |
verbose("Got expected results for " |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
447 |
+ desc + "\n\t" + expected); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
448 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
449 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
450 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
451 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
452 |
Supplier<String> fooSupplier = new Supplier<String>() { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
453 |
@Override |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
454 |
public String get() { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
455 |
return this.toString(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
456 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
457 |
}; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
458 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
459 |
for (Level loggerLevel : Level.values()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
460 |
sink.level = loggerLevel; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
461 |
for (Level messageLevel : Level.values()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
462 |
String desc = "logger.log(messageLevel, fooSupplier): loggerLevel=" |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
463 |
+ loggerLevel+", messageLevel="+messageLevel; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
464 |
TestLoggerFinder.LogEvent expected = |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
465 |
TestLoggerFinder.LogEvent.of( |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
466 |
sequencer.get(), |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
467 |
messageLevel.compareTo(loggerLevel) >= 0, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
468 |
name, messageLevel, (ResourceBundle)null, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
469 |
fooSupplier.get(), null, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
470 |
(Throwable)null, (Object[])null); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
471 |
logger.log(messageLevel, fooSupplier); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
472 |
if (loggerLevel == Level.OFF || messageLevel.compareTo(loggerLevel) < 0) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
473 |
if (provider.eventQueue.poll() != null) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
474 |
throw new RuntimeException("unexpected event in queue for " + desc); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
475 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
476 |
} else { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
477 |
TestLoggerFinder.LogEvent actual = provider.eventQueue.poll(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
478 |
if (!expected.equals(actual)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
479 |
throw new RuntimeException("mismatch for " + desc |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
480 |
+ "\n\texpected=" + expected |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
481 |
+ "\n\t actual=" + actual); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
482 |
} else { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
483 |
verbose("Got expected results for " |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
484 |
+ desc + "\n\t" + expected); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
485 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
486 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
487 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
488 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
489 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
490 |
String format = "two params [{1} {2}]"; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
491 |
Object arg1 = foo; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
492 |
Object arg2 = msg; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
493 |
for (Level loggerLevel : Level.values()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
494 |
sink.level = loggerLevel; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
495 |
for (Level messageLevel : Level.values()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
496 |
String desc = "logger.log(messageLevel, format, params...): loggerLevel=" |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
497 |
+ loggerLevel+", messageLevel="+messageLevel; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
498 |
TestLoggerFinder.LogEvent expected = |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
499 |
TestLoggerFinder.LogEvent.of( |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
500 |
sequencer.get(), |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
501 |
messageLevel.compareTo(loggerLevel) >= 0 && loggerLevel != Level.OFF, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
502 |
name, messageLevel, loggerBundle, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
503 |
format, null, (Throwable)null, new Object[] {foo, msg}); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
504 |
logger.log(messageLevel, format, foo, msg); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
505 |
TestLoggerFinder.LogEvent actual = provider.eventQueue.poll(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
506 |
if (!expected.equals(actual)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
507 |
throw new RuntimeException("mismatch for " + desc |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
508 |
+ "\n\texpected=" + expected |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
509 |
+ "\n\t actual=" + actual); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
510 |
} else { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
511 |
verbose("Got expected results for " |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
512 |
+ desc + "\n\t" + expected); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
513 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
514 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
515 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
516 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
517 |
Throwable thrown = new Exception("OK: log me!"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
518 |
for (Level loggerLevel : Level.values()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
519 |
sink.level = loggerLevel; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
520 |
for (Level messageLevel : Level.values()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
521 |
String desc = "logger.log(messageLevel, \"blah\", thrown): loggerLevel=" |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
522 |
+ loggerLevel+", messageLevel="+messageLevel; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
523 |
TestLoggerFinder.LogEvent expected = |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
524 |
TestLoggerFinder.LogEvent.of( |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
525 |
sequencer.get(), |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
526 |
messageLevel.compareTo(loggerLevel) >= 0 && loggerLevel != Level.OFF, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
527 |
name, messageLevel, loggerBundle, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
528 |
msg, null, thrown, (Object[]) null); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
529 |
logger.log(messageLevel, msg, thrown); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
530 |
TestLoggerFinder.LogEvent actual = provider.eventQueue.poll(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
531 |
if (!expected.equals(actual)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
532 |
throw new RuntimeException("mismatch for " + desc |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
533 |
+ "\n\texpected=" + expected |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
534 |
+ "\n\t actual=" + actual); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
535 |
} else { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
536 |
verbose("Got expected results for " |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
537 |
+ desc + "\n\t" + expected); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
538 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
539 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
540 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
541 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
542 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
543 |
for (Level loggerLevel : Level.values()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
544 |
sink.level = loggerLevel; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
545 |
for (Level messageLevel : Level.values()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
546 |
String desc = "logger.log(messageLevel, thrown, fooSupplier): loggerLevel=" |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
547 |
+ loggerLevel+", messageLevel="+messageLevel; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
548 |
TestLoggerFinder.LogEvent expected = |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
549 |
TestLoggerFinder.LogEvent.of( |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
550 |
sequencer.get(), |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
551 |
messageLevel.compareTo(loggerLevel) >= 0, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
552 |
name, messageLevel, (ResourceBundle)null, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
553 |
fooSupplier.get(), null, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
554 |
(Throwable)thrown, (Object[])null); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
555 |
logger.log(messageLevel, fooSupplier, thrown); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
556 |
if (loggerLevel == Level.OFF || messageLevel.compareTo(loggerLevel) < 0) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
557 |
if (provider.eventQueue.poll() != null) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
558 |
throw new RuntimeException("unexpected event in queue for " + desc); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
559 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
560 |
} else { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
561 |
TestLoggerFinder.LogEvent actual = provider.eventQueue.poll(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
562 |
if (!expected.equals(actual)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
563 |
throw new RuntimeException("mismatch for " + desc |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
564 |
+ "\n\texpected=" + expected |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
565 |
+ "\n\t actual=" + actual); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
566 |
} else { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
567 |
verbose("Got expected results for " |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
568 |
+ desc + "\n\t" + expected); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
569 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
570 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
571 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
572 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
573 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
574 |
ResourceBundle bundle = ResourceBundle.getBundle(MyBundle.class.getName()); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
575 |
for (Level loggerLevel : Level.values()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
576 |
sink.level = loggerLevel; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
577 |
for (Level messageLevel : Level.values()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
578 |
String desc = "logger.log(messageLevel, bundle, format, params...): loggerLevel=" |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
579 |
+ loggerLevel+", messageLevel="+messageLevel; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
580 |
TestLoggerFinder.LogEvent expected = |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
581 |
TestLoggerFinder.LogEvent.of( |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
582 |
sequencer.get(), |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
583 |
messageLevel.compareTo(loggerLevel) >= 0 && loggerLevel != Level.OFF, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
584 |
name, messageLevel, bundle, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
585 |
format, null, (Throwable)null, new Object[] {foo, msg}); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
586 |
logger.log(messageLevel, bundle, format, foo, msg); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
587 |
TestLoggerFinder.LogEvent actual = provider.eventQueue.poll(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
588 |
if (!expected.equals(actual)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
589 |
throw new RuntimeException("mismatch for " + desc |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
590 |
+ "\n\texpected=" + expected |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
591 |
+ "\n\t actual=" + actual); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
592 |
} else { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
593 |
verbose("Got expected results for " |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
594 |
+ desc + "\n\t" + expected); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
595 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
596 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
597 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
598 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
599 |
for (Level loggerLevel : Level.values()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
600 |
sink.level = loggerLevel; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
601 |
for (Level messageLevel : Level.values()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
602 |
String desc = "logger.log(messageLevel, bundle, \"blah\", thrown): loggerLevel=" |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
603 |
+ loggerLevel+", messageLevel="+messageLevel; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
604 |
TestLoggerFinder.LogEvent expected = |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
605 |
TestLoggerFinder.LogEvent.of( |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
606 |
sequencer.get(), |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
607 |
messageLevel.compareTo(loggerLevel) >= 0 && loggerLevel != Level.OFF, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
608 |
name, messageLevel, bundle, |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
609 |
msg, null, thrown, (Object[]) null); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
610 |
logger.log(messageLevel, bundle, msg, thrown); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
611 |
TestLoggerFinder.LogEvent actual = provider.eventQueue.poll(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
612 |
if (!expected.equals(actual)) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
613 |
throw new RuntimeException("mismatch for " + desc |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
614 |
+ "\n\texpected=" + expected |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
615 |
+ "\n\t actual=" + actual); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
616 |
} else { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
617 |
verbose("Got expected results for " |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
618 |
+ desc + "\n\t" + expected); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
619 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
620 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
621 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
622 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
623 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
624 |
final static class PermissionsBuilder { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
625 |
final Permissions perms; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
626 |
public PermissionsBuilder() { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
627 |
this(new Permissions()); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
628 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
629 |
public PermissionsBuilder(Permissions perms) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
630 |
this.perms = perms; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
631 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
632 |
public PermissionsBuilder add(Permission p) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
633 |
perms.add(p); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
634 |
return this; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
635 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
636 |
public PermissionsBuilder addAll(PermissionCollection col) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
637 |
if (col != null) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
638 |
for (Enumeration<Permission> e = col.elements(); e.hasMoreElements(); ) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
639 |
perms.add(e.nextElement()); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
640 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
641 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
642 |
return this; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
643 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
644 |
public Permissions toPermissions() { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
645 |
final PermissionsBuilder builder = new PermissionsBuilder(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
646 |
builder.addAll(perms); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
647 |
return builder.perms; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
648 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
649 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
650 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
651 |
public static class SimplePolicy extends Policy { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
652 |
final static RuntimePermission CONTROL = LOGGERFINDER_PERMISSION; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
653 |
final static RuntimePermission ACCESS = new RuntimePermission("accessClassInPackage.jdk.internal.logger"); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
654 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
655 |
final Permissions permissions; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
656 |
final ThreadLocal<AtomicBoolean> allowControl; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
657 |
final ThreadLocal<AtomicBoolean> allowAccess; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
658 |
public SimplePolicy(ThreadLocal<AtomicBoolean> allowControl, ThreadLocal<AtomicBoolean> allowAccess) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
659 |
this.allowControl = allowControl; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
660 |
this.allowAccess = allowAccess; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
661 |
permissions = new Permissions(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
662 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
663 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
664 |
Permissions getPermissions() { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
665 |
if (allowControl.get().get() || allowAccess.get().get()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
666 |
PermissionsBuilder builder = new PermissionsBuilder() |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
667 |
.addAll(permissions); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
668 |
if (allowControl.get().get()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
669 |
builder.add(CONTROL); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
670 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
671 |
if (allowAccess.get().get()) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
672 |
builder.add(ACCESS); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
673 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
674 |
return builder.toPermissions(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
675 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
676 |
return permissions; |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
677 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
678 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
679 |
@Override |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
680 |
public boolean implies(ProtectionDomain domain, Permission permission) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
681 |
return getPermissions().implies(permission); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
682 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
683 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
684 |
@Override |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
685 |
public PermissionCollection getPermissions(CodeSource codesource) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
686 |
return new PermissionsBuilder().addAll(getPermissions()).toPermissions(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
687 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
688 |
|
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
689 |
@Override |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
690 |
public PermissionCollection getPermissions(ProtectionDomain domain) { |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
691 |
return new PermissionsBuilder().addAll(getPermissions()).toPermissions(); |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
692 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
693 |
} |
c1c71107d45f
8140364: JEP 264 Platform Logger API and Service Implementation
dfuchs
parents:
diff
changeset
|
694 |
} |