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