36511
|
1 |
/*
|
|
2 |
* Copyright (c) 2016, 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 |
import java.io.BufferedReader;
|
|
25 |
import java.io.InputStream;
|
|
26 |
import java.io.InputStreamReader;
|
|
27 |
import java.io.IOException;
|
|
28 |
import java.io.PrintWriter;
|
|
29 |
import java.io.StringWriter;
|
|
30 |
import java.lang.reflect.Layer;
|
|
31 |
import java.nio.file.Files;
|
|
32 |
import java.nio.file.Path;
|
|
33 |
import java.nio.file.Paths;
|
|
34 |
import java.util.ArrayList;
|
|
35 |
import java.util.Collections;
|
|
36 |
import java.util.List;
|
|
37 |
import java.util.stream.Stream;
|
|
38 |
|
|
39 |
import jdk.tools.jlink.plugin.Plugin;
|
|
40 |
import jdk.tools.jlink.internal.PluginRepository;
|
|
41 |
import tests.Helper;
|
|
42 |
import tests.JImageGenerator;
|
|
43 |
import tests.JImageValidator;
|
|
44 |
|
|
45 |
/*
|
|
46 |
* @test
|
|
47 |
* @summary IncludeLocalesPlugin tests
|
|
48 |
* @author Naoto Sato
|
|
49 |
* @library ../../lib
|
|
50 |
* @modules java.base/jdk.internal.jimage
|
|
51 |
* jdk.jdeps/com.sun.tools.classfile
|
|
52 |
* jdk.jlink/jdk.tools.jlink.internal
|
|
53 |
* jdk.jlink/jdk.tools.jmod
|
|
54 |
* jdk.jlink/jdk.tools.jimage
|
|
55 |
* jdk.compiler
|
|
56 |
* @build tests.*
|
|
57 |
* @build tools.jlink.plugins.GetAvailableLocales
|
|
58 |
* @run main/othervm -verbose:gc -Xmx1g IncludeLocalesPluginTest
|
|
59 |
*/
|
|
60 |
public class IncludeLocalesPluginTest {
|
|
61 |
|
|
62 |
private final static String moduleName = "IncludeLocalesTest";
|
|
63 |
private static Helper helper;
|
|
64 |
private final static int INCLUDE_LOCALES_OPTION = 0;
|
|
65 |
private final static int EXPECTED_LOCATIONS = 1;
|
|
66 |
private final static int UNEXPECTED_PATHS = 2;
|
|
67 |
private final static int AVAILABLE_LOCALES = 3;
|
|
68 |
|
|
69 |
private final static Object[][] testData = {
|
|
70 |
// without --include-locales option: should include all locales
|
|
71 |
{
|
|
72 |
"",
|
|
73 |
List.of(
|
|
74 |
"/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
|
|
75 |
"/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
|
|
76 |
"/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
|
|
77 |
"/jdk.localedata/sun/text/resources/ext/FormatData_zh.class",
|
|
78 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
|
|
79 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
|
|
80 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class",
|
|
81 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"),
|
|
82 |
List.of(),
|
|
83 |
" af af_NA af_ZA agq agq_CM ak ak_GH am am_ET ar ar_001 ar_AE ar_BH " +
|
|
84 |
"ar_DJ ar_DZ ar_EG ar_EH ar_ER ar_IL ar_IQ ar_JO ar_KM ar_KW ar_LB " +
|
|
85 |
"ar_LY ar_MA ar_MR ar_OM ar_PS ar_QA ar_SA ar_SD ar_SO ar_SS ar_SY " +
|
|
86 |
"ar_TD ar_TN ar_YE as as_IN asa asa_TZ ast ast_ES az az_AZ_#Cyrl " +
|
|
87 |
"az_AZ_#Latn az__#Cyrl az__#Latn bas bas_CM be be_BY bem bem_ZM bez " +
|
|
88 |
"bez_TZ bg bg_BG bm bm_ML_#Latn bm__#Latn bn bn_BD bn_IN bo bo_CN " +
|
|
89 |
"bo_IN br br_FR brx brx_IN bs bs_BA_#Cyrl bs_BA_#Latn bs__#Cyrl " +
|
|
90 |
"bs__#Latn ca ca_AD ca_ES ca_ES_VALENCIA ca_FR ca_IT cgg cgg_UG chr " +
|
|
91 |
"chr_US cs cs_CZ cy cy_GB da da_DK da_GL dav dav_KE de de_AT de_BE " +
|
|
92 |
"de_CH de_DE de_GR de_LI de_LU dje dje_NE dsb dsb_DE dua dua_CM dyo " +
|
|
93 |
"dyo_SN dz dz_BT ebu ebu_KE ee ee_GH ee_TG el el_CY el_GR en en_001 " +
|
|
94 |
"en_150 en_AG en_AI en_AS en_AU en_BB en_BE en_BM en_BS en_BW en_BZ " +
|
|
95 |
"en_CA en_CC en_CK en_CM en_CX en_DG en_DM en_ER en_FJ en_FK en_FM " +
|
|
96 |
"en_GB en_GD en_GG en_GH en_GI en_GM en_GU en_GY en_HK en_IE en_IM " +
|
|
97 |
"en_IN en_IO en_JE en_JM en_KE en_KI en_KN en_KY en_LC en_LR en_LS " +
|
|
98 |
"en_MG en_MH en_MO en_MP en_MS en_MT en_MU en_MW en_MY en_NA en_NF " +
|
|
99 |
"en_NG en_NR en_NU en_NZ en_PG en_PH en_PK en_PN en_PR en_PW en_RW " +
|
|
100 |
"en_SB en_SC en_SD en_SG en_SH en_SL en_SS en_SX en_SZ en_TC en_TK " +
|
|
101 |
"en_TO en_TT en_TV en_TZ en_UG en_UM en_US en_US_POSIX en_VC en_VG " +
|
|
102 |
"en_VI en_VU en_WS en_ZA en_ZM en_ZW eo eo_001 es es_419 es_AR es_BO " +
|
|
103 |
"es_CL es_CO es_CR es_CU es_DO es_EA es_EC es_ES es_GQ es_GT es_HN " +
|
|
104 |
"es_IC es_MX es_NI es_PA es_PE es_PH es_PR es_PY es_SV es_US es_UY " +
|
|
105 |
"es_VE et et_EE eu eu_ES ewo ewo_CM fa fa_AF fa_IR ff ff_CM ff_GN " +
|
|
106 |
"ff_MR ff_SN fi fi_FI fil fil_PH fo fo_FO fr fr_BE fr_BF fr_BI fr_BJ " +
|
|
107 |
"fr_BL fr_CA fr_CD fr_CF fr_CG fr_CH fr_CI fr_CM fr_DJ fr_DZ fr_FR " +
|
|
108 |
"fr_GA fr_GF fr_GN fr_GP fr_GQ fr_HT fr_KM fr_LU fr_MA fr_MC fr_MF " +
|
|
109 |
"fr_MG fr_ML fr_MQ fr_MR fr_MU fr_NC fr_NE fr_PF fr_PM fr_RE fr_RW " +
|
|
110 |
"fr_SC fr_SN fr_SY fr_TD fr_TG fr_TN fr_VU fr_WF fr_YT fur fur_IT fy " +
|
|
111 |
"fy_NL ga ga_IE gd gd_GB gl gl_ES gsw gsw_CH gsw_FR gsw_LI gu gu_IN " +
|
|
112 |
"guz guz_KE gv gv_IM ha ha_GH_#Latn ha_NE_#Latn ha_NG_#Latn ha__#Latn " +
|
|
113 |
"haw haw_US hi hi_IN hr hr_BA hr_HR hsb hsb_DE hu hu_HU hy hy_AM ig " +
|
|
114 |
"ig_NG ii ii_CN in in_ID is is_IS it it_CH it_IT it_SM iw iw_IL ja " +
|
|
115 |
"ja_JP ja_JP_JP_#u-ca-japanese jgo jgo_CM ji ji_001 jmc jmc_TZ ka " +
|
|
116 |
"ka_GE kab kab_DZ kam kam_KE kde kde_TZ kea kea_CV khq khq_ML ki " +
|
|
117 |
"ki_KE kk kk_KZ_#Cyrl kk__#Cyrl kkj kkj_CM kl kl_GL kln kln_KE km " +
|
|
118 |
"km_KH kn kn_IN ko ko_KP ko_KR kok kok_IN ks ks_IN_#Arab ks__#Arab " +
|
|
119 |
"ksb ksb_TZ ksf ksf_CM ksh ksh_DE kw kw_GB ky ky_KG_#Cyrl ky__#Cyrl " +
|
|
120 |
"lag lag_TZ lb lb_LU lg lg_UG lkt lkt_US ln ln_AO ln_CD ln_CF ln_CG " +
|
|
121 |
"lo lo_LA lt lt_LT lu lu_CD luo luo_KE luy luy_KE lv lv_LV mas " +
|
|
122 |
"mas_KE mas_TZ mer mer_KE mfe mfe_MU mg mg_MG mgh mgh_MZ mgo mgo_CM " +
|
|
123 |
"mk mk_MK ml ml_IN mn mn_MN_#Cyrl mn__#Cyrl mr mr_IN ms ms_BN_#Latn " +
|
|
124 |
"ms_MY ms_MY_#Latn ms_SG_#Latn ms__#Latn mt mt_MT mua mua_CM my " +
|
|
125 |
"my_MM naq naq_NA nb nb_NO nb_SJ nd nd_ZW ne ne_IN ne_NP nl nl_AW " +
|
|
126 |
"nl_BE nl_BQ nl_CW nl_NL nl_SR nl_SX nmg nmg_CM nn nn_NO nnh nnh_CM " +
|
|
127 |
"no no_NO no_NO_NY nus nus_SD nyn nyn_UG om om_ET om_KE or or_IN os " +
|
|
128 |
"os_GE os_RU pa pa_IN_#Guru pa_PK_#Arab pa__#Arab pa__#Guru pl pl_PL " +
|
|
129 |
"ps ps_AF pt pt_AO pt_BR pt_CV pt_GW pt_MO pt_MZ pt_PT pt_ST pt_TL qu " +
|
|
130 |
"qu_BO qu_EC qu_PE rm rm_CH rn rn_BI ro ro_MD ro_RO rof rof_TZ ru " +
|
|
131 |
"ru_BY ru_KG ru_KZ ru_MD ru_RU ru_UA rw rw_RW rwk rwk_TZ sah sah_RU " +
|
|
132 |
"saq saq_KE sbp sbp_TZ se se_FI se_NO se_SE seh seh_MZ ses ses_ML sg " +
|
|
133 |
"sg_CF shi shi_MA_#Latn shi_MA_#Tfng shi__#Latn shi__#Tfng si si_LK " +
|
|
134 |
"sk sk_SK sl sl_SI smn smn_FI sn sn_ZW so so_DJ so_ET so_KE so_SO sq " +
|
|
135 |
"sq_AL sq_MK sq_XK sr sr_BA sr_BA_#Cyrl sr_BA_#Latn sr_CS sr_ME " +
|
|
136 |
"sr_ME_#Cyrl sr_ME_#Latn sr_RS sr_RS_#Cyrl sr_RS_#Latn sr_XK_#Cyrl " +
|
|
137 |
"sr_XK_#Latn sr__#Cyrl sr__#Latn sv sv_AX sv_FI sv_SE sw sw_CD sw_KE " +
|
|
138 |
"sw_TZ sw_UG ta ta_IN ta_LK ta_MY ta_SG te te_IN teo teo_KE teo_UG " +
|
|
139 |
"th th_TH th_TH_TH_#u-nu-thai ti ti_ER ti_ET to to_TO tr tr_CY tr_TR " +
|
|
140 |
"twq twq_NE tzm tzm_MA_#Latn tzm__#Latn ug ug_CN_#Arab ug__#Arab uk " +
|
|
141 |
"uk_UA ur ur_IN ur_PK uz uz_AF_#Arab uz_UZ_#Cyrl uz_UZ_#Latn " +
|
|
142 |
"uz__#Arab uz__#Cyrl uz__#Latn vai vai_LR_#Latn vai_LR_#Vaii " +
|
|
143 |
"vai__#Latn vai__#Vaii vi vi_VN vun vun_TZ wae wae_CH xog xog_UG yav " +
|
|
144 |
"yav_CM yo yo_BJ yo_NG zgh zgh_MA zh zh_CN zh_CN_#Hans zh_HK " +
|
|
145 |
"zh_HK_#Hans zh_HK_#Hant zh_MO_#Hans zh_MO_#Hant zh_SG zh_SG_#Hans " +
|
|
146 |
"zh_TW zh_TW_#Hant zh__#Hans zh__#Hant zu zu_ZA",
|
|
147 |
},
|
|
148 |
|
|
149 |
// All English/Japanese locales
|
|
150 |
{
|
|
151 |
"--include-locales=en,ja",
|
|
152 |
List.of(
|
|
153 |
"/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
|
|
154 |
"/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
|
|
155 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
|
|
156 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class"),
|
|
157 |
List.of(
|
|
158 |
"/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
|
|
159 |
"/jdk.localedata/sun/text/resources/thai_dict",
|
|
160 |
"/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
|
|
161 |
"/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
|
|
162 |
"/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
|
|
163 |
"/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
|
|
164 |
"/jdk.localedata/sun/text/resources/ext/FormatData_zh.class",
|
|
165 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class",
|
|
166 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"),
|
|
167 |
" en en_001 en_150 en_AG en_AI en_AS en_AU en_BB en_BE en_BM en_BS " +
|
|
168 |
"en_BW en_BZ en_CA en_CC en_CK en_CM en_CX en_DG en_DM en_ER en_FJ " +
|
|
169 |
"en_FK en_FM en_GB en_GD en_GG en_GH en_GI en_GM en_GU en_GY en_HK " +
|
|
170 |
"en_IE en_IM en_IN en_IO en_JE en_JM en_KE en_KI en_KN en_KY en_LC " +
|
|
171 |
"en_LR en_LS en_MG en_MH en_MO en_MP en_MS en_MT en_MU en_MW en_MY " +
|
|
172 |
"en_NA en_NF en_NG en_NR en_NU en_NZ en_PG en_PH en_PK en_PN en_PR " +
|
|
173 |
"en_PW en_RW en_SB en_SC en_SD en_SG en_SH en_SL en_SS en_SX en_SZ " +
|
|
174 |
"en_TC en_TK en_TO en_TT en_TV en_TZ en_UG en_UM en_US en_US_POSIX " +
|
|
175 |
"en_VC en_VG en_VI en_VU en_WS en_ZA en_ZM en_ZW ja ja_JP ja_JP_JP_#u-ca-japanese",
|
|
176 |
},
|
|
177 |
|
|
178 |
// All locales in India
|
|
179 |
{
|
|
180 |
"--include-locales=*-IN",
|
|
181 |
List.of(
|
|
182 |
"/jdk.localedata/sun/text/resources/ext/FormatData_en_IN.class",
|
|
183 |
"/jdk.localedata/sun/text/resources/ext/FormatData_hi_IN.class",
|
|
184 |
"/jdk.localedata/sun/util/resources/cldr/ext/CalendarData_as_IN.class",
|
|
185 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
|
|
186 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_IN.class",
|
|
187 |
"/jdk.localedata/sun/util/resources/cldr/ext/CalendarData_kok_IN.class",
|
|
188 |
"/jdk.localedata/sun/util/resources/cldr/ext/CalendarData_ks_Arab_IN.class"),
|
|
189 |
List.of(
|
|
190 |
"/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
|
|
191 |
"/jdk.localedata/sun/text/resources/thai_dict",
|
|
192 |
"/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
|
|
193 |
"/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
|
|
194 |
"/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
|
|
195 |
"/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
|
|
196 |
"/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
|
|
197 |
"/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
|
|
198 |
"/jdk.localedata/sun/text/resources/ext/FormatData_zh.class",
|
|
199 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
|
|
200 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class",
|
|
201 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"),
|
|
202 |
" as_IN bn_IN bo_IN brx_IN en en_IN en_US en_US_POSIX gu_IN hi_IN kn_IN " +
|
|
203 |
"kok_IN ks_IN_#Arab ml_IN mr_IN ne_IN or_IN pa_IN_#Guru ta_IN te_IN ur_IN",
|
|
204 |
},
|
|
205 |
|
|
206 |
// Thai
|
|
207 |
{"--include-locales=th",
|
|
208 |
List.of(
|
|
209 |
"/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
|
|
210 |
"/jdk.localedata/sun/text/resources/thai_dict",
|
|
211 |
"/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
|
|
212 |
"/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
|
|
213 |
"/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
|
|
214 |
"/jdk.localedata/sun/text/resources/ext/FormatData_th.class"),
|
|
215 |
List.of(
|
|
216 |
"/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
|
|
217 |
"/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
|
|
218 |
"/jdk.localedata/sun/text/resources/ext/FormatData_zh.class",
|
|
219 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
|
|
220 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
|
|
221 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"),
|
|
222 |
" en en_US en_US_POSIX th th_TH th_TH_TH_#u-nu-thai",
|
|
223 |
},
|
|
224 |
|
|
225 |
// Hong Kong
|
|
226 |
{"--include-locales=zh-HK",
|
|
227 |
List.of(
|
|
228 |
"/jdk.localedata/sun/text/resources/ext/FormatData_zh.class",
|
|
229 |
"/jdk.localedata/sun/text/resources/ext/FormatData_zh_HK.class",
|
|
230 |
"/jdk.localedata/sun/text/resources/ext/FormatData_zh_TW.class",
|
|
231 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"),
|
|
232 |
List.of(
|
|
233 |
"/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
|
|
234 |
"/jdk.localedata/sun/text/resources/thai_dict",
|
|
235 |
"/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
|
|
236 |
"/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
|
|
237 |
"/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
|
|
238 |
"/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
|
|
239 |
"/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
|
|
240 |
"/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
|
|
241 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
|
|
242 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
|
|
243 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"),
|
|
244 |
" en en_US en_US_POSIX zh_HK zh_HK_#Hans zh_HK_#Hant",
|
|
245 |
},
|
|
246 |
|
|
247 |
// Norwegian
|
|
248 |
{"--include-locales=nb,nn,no",
|
|
249 |
List.of(
|
|
250 |
"/jdk.localedata/sun/text/resources/ext/FormatData_no.class",
|
|
251 |
"/jdk.localedata/sun/text/resources/ext/FormatData_no_NO.class",
|
|
252 |
"/jdk.localedata/sun/text/resources/ext/FormatData_no_NO_NY.class",
|
|
253 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_nb.class",
|
|
254 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_nn.class"),
|
|
255 |
List.of(
|
|
256 |
"/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
|
|
257 |
"/jdk.localedata/sun/text/resources/thai_dict",
|
|
258 |
"/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
|
|
259 |
"/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
|
|
260 |
"/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
|
|
261 |
"/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
|
|
262 |
"/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
|
|
263 |
"/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
|
|
264 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
|
|
265 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
|
|
266 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"),
|
|
267 |
" en en_US en_US_POSIX nb nb_NO nb_SJ nn nn_NO no no_NO no_NO_NY",
|
|
268 |
},
|
|
269 |
|
|
270 |
// Hebrew/Indonesian/Yiddish
|
|
271 |
{"--include-locales=he,id,yi",
|
|
272 |
List.of(
|
|
273 |
"/jdk.localedata/sun/text/resources/ext/FormatData_in.class",
|
|
274 |
"/jdk.localedata/sun/text/resources/ext/FormatData_in_ID.class",
|
|
275 |
"/jdk.localedata/sun/text/resources/ext/FormatData_iw.class",
|
|
276 |
"/jdk.localedata/sun/text/resources/ext/FormatData_iw_IL.class",
|
|
277 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_in.class",
|
|
278 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_iw.class",
|
|
279 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ji.class"),
|
|
280 |
List.of(
|
|
281 |
"/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
|
|
282 |
"/jdk.localedata/sun/text/resources/thai_dict",
|
|
283 |
"/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
|
|
284 |
"/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
|
|
285 |
"/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
|
|
286 |
"/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
|
|
287 |
"/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
|
|
288 |
"/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
|
|
289 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
|
|
290 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
|
|
291 |
"/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class"),
|
|
292 |
" en en_US en_US_POSIX in in_ID iw iw_IL ji ji_001",
|
|
293 |
},
|
|
294 |
};
|
|
295 |
|
|
296 |
public static void main(String[] args) throws Exception {
|
|
297 |
helper = Helper.newHelper();
|
|
298 |
if (helper == null) {
|
|
299 |
System.err.println("Test not run");
|
|
300 |
return;
|
|
301 |
}
|
|
302 |
|
|
303 |
helper.generateDefaultModules();
|
|
304 |
|
|
305 |
for (Object[] data : testData) {
|
|
306 |
// create image for each test data
|
|
307 |
Path image = JImageGenerator.getJLinkTask()
|
|
308 |
.modulePath(helper.defaultModulePath())
|
|
309 |
.output(helper.createNewImageDir(moduleName))
|
|
310 |
.addMods("jdk.localedata")
|
|
311 |
.option((String)data[INCLUDE_LOCALES_OPTION])
|
|
312 |
.call().assertSuccess();
|
|
313 |
|
|
314 |
// test locale data entries
|
|
315 |
testLocaleDataEntries(image,
|
|
316 |
(List<String>)data[EXPECTED_LOCATIONS],
|
|
317 |
(List<String>)data[UNEXPECTED_PATHS]);
|
|
318 |
|
|
319 |
// test available locales
|
|
320 |
testAvailableLocales(image, (String)data[AVAILABLE_LOCALES]);
|
|
321 |
}
|
|
322 |
}
|
|
323 |
|
|
324 |
private static void testLocaleDataEntries(Path image, List<String> expectedLocations,
|
|
325 |
List<String> unexpectedPaths) throws Exception {
|
|
326 |
JImageValidator.validate(
|
|
327 |
image.resolve("lib").resolve("modules"),
|
|
328 |
expectedLocations, unexpectedPaths);
|
|
329 |
}
|
|
330 |
|
|
331 |
private static void testAvailableLocales(Path image, String availableLocales) throws Exception {
|
|
332 |
Path launcher = image.resolve("bin/java" +
|
|
333 |
(System.getProperty("os.name").startsWith("Windows") ? ".exe" : ""));
|
|
334 |
System.out.print(launcher);
|
|
335 |
ProcessBuilder pb = new ProcessBuilder(launcher.toString(),
|
|
336 |
"GetAvailableLocales", availableLocales);
|
|
337 |
int ret = pb.start().waitFor();
|
|
338 |
System.out.println(" Return code: " + ret);
|
|
339 |
}
|
|
340 |
}
|