Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/security/krb5/config/Duplicates.java
38853 views
1
/*
2
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
/*
24
* @test
25
* @bug 7184246
26
* @compile -XDignore.symbol.file Duplicates.java
27
* @run main/othervm Duplicates
28
* @summary Simplify Config.get() of krb5
29
*/
30
31
import sun.security.krb5.Config;
32
33
public class Duplicates {
34
public static void main(String[] args) throws Exception {
35
System.setProperty("java.security.krb5.conf",
36
System.getProperty("test.src", ".") +"/k1.conf");
37
Config config = Config.getInstance();
38
config.listTable();
39
String s;
40
41
// Latter overwrites former for root section
42
s = config.get("libdefaults", "default_realm");
43
if (s != null) {
44
throw new Exception();
45
}
46
// Latter overwrites former for strings
47
s = config.get("libdefaults", "default_tkt_enctypes");
48
if (!s.equals("aes256-cts")) {
49
throw new Exception();
50
}
51
// Latter overwrites former for sub-section
52
s = config.get("realms", "R1", "kdc");
53
if (!s.equals("k2")) {
54
throw new Exception(s);
55
}
56
// Duplicate keys in [realms] are merged
57
s = config.getAll("realms", "R2", "kdc");
58
if (!s.equals("k1 k2 k3 k4")) {
59
throw new Exception(s);
60
}
61
// Duplicate keys in [capaths] are merged
62
s = config.getAll("capaths", "R1", "R2");
63
if (!s.equals("R3 R4 R5 R6")) {
64
throw new Exception(s);
65
}
66
// We can be very deep now
67
s = config.get("new", "x", "y", "z", "a", "b", "c");
68
if (!s.equals("d")) {
69
throw new Exception(s);
70
}
71
}
72
}
73
74