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 /*
25 * @test
26 * @bug 6336885 7196799 7197573 7198834 8000245 8000615 8001440 8008577
27 * 8010666 8013086 8013233 8013903 8015960 8028771 8054482 8062006
28 * 8150432 8215913 8220227 8228465 8232871 8232860 8236495
29 * @summary tests for "java.locale.providers" system property
30 * @library /test/lib
31 * @build LocaleProviders
32 * providersrc.spi.src.tznp
33 * providersrc.spi.src.tznp8013086
34 * @modules java.base/sun.util.locale
35 * java.base/sun.util.locale.provider
36 * @run main LocaleProvidersRun
37 */
38
39 import java.util.Locale;
40
41 import jdk.test.lib.JDKToolLauncher;
42 import jdk.test.lib.process.ProcessTools;
43 import jdk.test.lib.Utils;
44
45 public class LocaleProvidersRun {
46 public static void main(String[] args) throws Throwable {
47 //get the platform default locales
48 Locale platDefLoc = Locale.getDefault(Locale.Category.DISPLAY);
145 // (yuan) sign.
146 if (defFmtLang.equals("zh") && defFmtCtry.equals("CN")) {
147 testRun("JRE,HOST", "bug8027289Test", "FFE5", "", "");
148 testRun("COMPAT,HOST", "bug8027289Test", "FFE5", "", "");
149 testRun("HOST", "bug8027289Test", "00A5", "", "");
150 }
151
152 //testing 8220227 fix. (Windows only)
153 if (!defLang.equals("en")) {
154 testRun("HOST", "bug8220227Test", "", "", "");
155 }
156
157 //testing 8228465 fix. (Windows only)
158 testRun("HOST", "bug8228465Test", "", "", "");
159
160 //testing 8232871 fix. (macOS only)
161 testRun("HOST", "bug8232871Test", "", "", "");
162
163 //testing 8232860 fix. (macOS/Windows only)
164 testRun("HOST", "bug8232860Test", "", "", "");
165 }
166
167 private static void testRun(String prefList, String methodName,
168 String param1, String param2, String param3) throws Throwable{
169 JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
170 launcher.addToolArg("-ea")
171 .addToolArg("-esa")
172 .addToolArg("-cp")
173 .addToolArg(Utils.TEST_CLASS_PATH)
174 .addToolArg("-Djava.locale.providers=" + prefList)
175 .addToolArg("--add-exports=java.base/sun.util.locale.provider=ALL-UNNAMED")
176 .addToolArg("LocaleProviders")
177 .addToolArg(methodName)
178 .addToolArg(param1)
179 .addToolArg(param2)
180 .addToolArg(param3);
181 int exitCode = ProcessTools.executeCommand(launcher.getCommand())
182 .getExitValue();
183 if (exitCode != 0) {
184 throw new RuntimeException("Unexpected exit code: " + exitCode);
|
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 /*
25 * @test
26 * @bug 6336885 7196799 7197573 7198834 8000245 8000615 8001440 8008577
27 * 8010666 8013086 8013233 8013903 8015960 8028771 8054482 8062006
28 * 8150432 8215913 8220227 8228465 8232871 8232860 8236495 8245241
29 * @summary tests for "java.locale.providers" system property
30 * @library /test/lib
31 * @build LocaleProviders
32 * providersrc.spi.src.tznp
33 * providersrc.spi.src.tznp8013086
34 * @modules java.base/sun.util.locale
35 * java.base/sun.util.locale.provider
36 * @run main LocaleProvidersRun
37 */
38
39 import java.util.Locale;
40
41 import jdk.test.lib.JDKToolLauncher;
42 import jdk.test.lib.process.ProcessTools;
43 import jdk.test.lib.Utils;
44
45 public class LocaleProvidersRun {
46 public static void main(String[] args) throws Throwable {
47 //get the platform default locales
48 Locale platDefLoc = Locale.getDefault(Locale.Category.DISPLAY);
145 // (yuan) sign.
146 if (defFmtLang.equals("zh") && defFmtCtry.equals("CN")) {
147 testRun("JRE,HOST", "bug8027289Test", "FFE5", "", "");
148 testRun("COMPAT,HOST", "bug8027289Test", "FFE5", "", "");
149 testRun("HOST", "bug8027289Test", "00A5", "", "");
150 }
151
152 //testing 8220227 fix. (Windows only)
153 if (!defLang.equals("en")) {
154 testRun("HOST", "bug8220227Test", "", "", "");
155 }
156
157 //testing 8228465 fix. (Windows only)
158 testRun("HOST", "bug8228465Test", "", "", "");
159
160 //testing 8232871 fix. (macOS only)
161 testRun("HOST", "bug8232871Test", "", "", "");
162
163 //testing 8232860 fix. (macOS/Windows only)
164 testRun("HOST", "bug8232860Test", "", "", "");
165
166 //testing 8245241 fix.
167 testRun("FOO", "bug8245241Test",
168 "Invalid locale provider adapter \"FOO\" ignored.", "", "");
169 }
170
171 private static void testRun(String prefList, String methodName,
172 String param1, String param2, String param3) throws Throwable{
173 JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
174 launcher.addToolArg("-ea")
175 .addToolArg("-esa")
176 .addToolArg("-cp")
177 .addToolArg(Utils.TEST_CLASS_PATH)
178 .addToolArg("-Djava.locale.providers=" + prefList)
179 .addToolArg("--add-exports=java.base/sun.util.locale.provider=ALL-UNNAMED")
180 .addToolArg("LocaleProviders")
181 .addToolArg(methodName)
182 .addToolArg(param1)
183 .addToolArg(param2)
184 .addToolArg(param3);
185 int exitCode = ProcessTools.executeCommand(launcher.getCommand())
186 .getExitValue();
187 if (exitCode != 0) {
188 throw new RuntimeException("Unexpected exit code: " + exitCode);
|