author | dzhou |
Thu, 15 Nov 2018 21:53:30 -0800 | |
changeset 52584 | 5ab248e47901 |
parent 47216 | test/jdk/java/util/ResourceBundle/Bug6299235Test.java@71c04702a3d5 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
52584
5ab248e47901
8210408: Refactor java.util.ResourceBundle:i18n shell tests to plain java tests
dzhou
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 22 |
*/ |
36511 | 23 |
|
52584
5ab248e47901
8210408: Refactor java.util.ResourceBundle:i18n shell tests to plain java tests
dzhou
parents:
47216
diff
changeset
|
24 |
/* |
5ab248e47901
8210408: Refactor java.util.ResourceBundle:i18n shell tests to plain java tests
dzhou
parents:
47216
diff
changeset
|
25 |
* @test |
5ab248e47901
8210408: Refactor java.util.ResourceBundle:i18n shell tests to plain java tests
dzhou
parents:
47216
diff
changeset
|
26 |
* @bug 6299235 8210408 |
5ab248e47901
8210408: Refactor java.util.ResourceBundle:i18n shell tests to plain java tests
dzhou
parents:
47216
diff
changeset
|
27 |
* @summary test Bug 6299235 to make sure the third-party provided sun resources |
5ab248e47901
8210408: Refactor java.util.ResourceBundle:i18n shell tests to plain java tests
dzhou
parents:
47216
diff
changeset
|
28 |
* could be picked up. |
5ab248e47901
8210408: Refactor java.util.ResourceBundle:i18n shell tests to plain java tests
dzhou
parents:
47216
diff
changeset
|
29 |
* @modules java.desktop |
5ab248e47901
8210408: Refactor java.util.ResourceBundle:i18n shell tests to plain java tests
dzhou
parents:
47216
diff
changeset
|
30 |
* @library patches |
5ab248e47901
8210408: Refactor java.util.ResourceBundle:i18n shell tests to plain java tests
dzhou
parents:
47216
diff
changeset
|
31 |
* @build java.desktop/sun.awt.resources.awt_ru_RU |
5ab248e47901
8210408: Refactor java.util.ResourceBundle:i18n shell tests to plain java tests
dzhou
parents:
47216
diff
changeset
|
32 |
* @run main Bug6299235Test |
5ab248e47901
8210408: Refactor java.util.ResourceBundle:i18n shell tests to plain java tests
dzhou
parents:
47216
diff
changeset
|
33 |
*/ |
5ab248e47901
8210408: Refactor java.util.ResourceBundle:i18n shell tests to plain java tests
dzhou
parents:
47216
diff
changeset
|
34 |
|
36511 | 35 |
import java.awt.Toolkit; |
2 | 36 |
import java.util.Locale; |
37 |
||
38 |
/* |
|
39 |
* After introducing CoreResourceBundleControl for Awt/Swing resources |
|
40 |
* loading, non-existent resources won't be actually searched from |
|
41 |
* bootclasspath and extension directory. But we should still fallback |
|
42 |
* to the current behavior which allows the third-part to provide their |
|
43 |
* own version of awt resources, for example even though we never claim |
|
44 |
* we support it yet. |
|
45 |
* Look into bug 6299235 for more details. |
|
46 |
*/ |
|
47 |
||
48 |
public class Bug6299235Test { |
|
52584
5ab248e47901
8210408: Refactor java.util.ResourceBundle:i18n shell tests to plain java tests
dzhou
parents:
47216
diff
changeset
|
49 |
private static final Locale ru_RU = new Locale("ru", "RU"); |
2 | 50 |
|
36511 | 51 |
public static void main(String args[]) { |
52 |
Locale locale = Locale.getDefault(); |
|
53 |
try { |
|
54 |
Locale.setDefault(ru_RU); |
|
55 |
// Get the value for the test key "foo" |
|
56 |
String value = Toolkit.getProperty("foo", "undefined"); |
|
57 |
if (!value.equals("bar")) { |
|
58 |
throw new RuntimeException("key = foo, value = " + value); |
|
2 | 59 |
} |
36511 | 60 |
// Get the value for a valid key "AWT.enter" |
61 |
value = Toolkit.getProperty("AWT.enter", "DO NOT ENTER"); |
|
62 |
if (value.equals("DO NOT ENTER")) { |
|
63 |
throw new RuntimeException("AWT.enter undefined."); |
|
64 |
} |
|
65 |
} finally { |
|
66 |
// Restore the default Locale |
|
67 |
Locale.setDefault(locale); |
|
2 | 68 |
} |
36511 | 69 |
System.out.println("Bug6299235Test passed"); |
2 | 70 |
} |
71 |
} |