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 }
|
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 // root section merged
42 s = config.get("libdefaults", "default_realm");
43 if (!s.equals("R1")) {
44 throw new Exception();
45 }
46 // Former is preferred to latter for strings and sections
47 s = config.get("libdefaults", "default_tkt_enctypes");
48 if (!s.equals("aes128-cts")) {
49 throw new Exception();
50 }
51 s = config.get("realms", "R1", "kdc");
52 if (!s.equals("k1")) {
53 throw new Exception(s);
54 }
55 // Duplicate keys in [realms] are merged, and sections with the same
56 // name in between ignored
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 }
|