author | naoto |
Fri, 05 Oct 2012 09:57:50 -0700 | |
changeset 14028 | 5f3d5ae5f1ea |
parent 14024 | 694c379c2958 |
child 14185 | 916ec0a4d039 |
permissions | -rw-r--r-- |
13583 | 1 |
# |
2 |
# Copyright (c) 2012, 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 |
#!/bin/sh |
|
24 |
# |
|
25 |
# @test |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
26 |
# @bug 6336885 7196799 7197573 7198834 |
13583 | 27 |
# @summary tests for "java.locale.providers" system property |
28 |
# @compile -XDignore.symbol.file LocaleProviders.java |
|
29 |
# @run shell/timeout=600 LocaleProviders.sh |
|
30 |
||
31 |
if [ "${TESTSRC}" = "" ] |
|
32 |
then |
|
33 |
echo "TESTSRC not set. Test cannot execute. Failed." |
|
34 |
exit 1 |
|
35 |
fi |
|
36 |
echo "TESTSRC=${TESTSRC}" |
|
37 |
if [ "${TESTJAVA}" = "" ] |
|
38 |
then |
|
39 |
echo "TESTJAVA not set. Test cannot execute. Failed." |
|
40 |
exit 1 |
|
41 |
fi |
|
42 |
echo "TESTJAVA=${TESTJAVA}" |
|
43 |
if [ "${TESTCLASSES}" = "" ] |
|
44 |
then |
|
45 |
echo "TESTCLASSES not set. Test cannot execute. Failed." |
|
46 |
exit 1 |
|
47 |
fi |
|
48 |
echo "TESTCLASSES=${TESTCLASSES}" |
|
49 |
echo "CLASSPATH=${CLASSPATH}" |
|
50 |
||
51 |
# set platform-dependent variables |
|
52 |
OS=`uname -s` |
|
53 |
case "$OS" in |
|
54 |
SunOS | Linux | *BSD | Darwin ) |
|
55 |
PS=":" |
|
56 |
FS="/" |
|
57 |
;; |
|
58 |
Windows* | CYGWIN* ) |
|
59 |
PS=";" |
|
60 |
FS="\\" |
|
61 |
;; |
|
62 |
* ) |
|
63 |
echo "Unrecognized system!" |
|
64 |
exit 1; |
|
65 |
;; |
|
66 |
esac |
|
67 |
||
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
68 |
# get the platform default locales |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
69 |
PLATDEF=`${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} LocaleProviders getPlatformLocale display` |
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
70 |
DEFLANG=`echo ${PLATDEF} | sed -e "s/,.*//"` |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
71 |
DEFCTRY=`echo ${PLATDEF} | sed -e "s/.*,//"` |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
72 |
echo "DEFLANG=${DEFLANG}" |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
73 |
echo "DEFCTRY=${DEFCTRY}" |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
74 |
PLATDEF=`${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} LocaleProviders getPlatformLocale format` |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
75 |
DEFFMTLANG=`echo ${PLATDEF} | sed -e "s/,.*//"` |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
76 |
DEFFMTCTRY=`echo ${PLATDEF} | sed -e "s/.*,//"` |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
77 |
echo "DEFFMTLANG=${DEFFMTLANG}" |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
78 |
echo "DEFFMTCTRY=${DEFFMTCTRY}" |
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
79 |
|
13583 | 80 |
runTest() |
81 |
{ |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
82 |
RUNCMD="${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} -Djava.locale.providers=$PREFLIST LocaleProviders $METHODNAME $PARAM1 $PARAM2 $PARAM3" |
13583 | 83 |
echo ${RUNCMD} |
84 |
${RUNCMD} |
|
85 |
result=$? |
|
86 |
if [ $result -eq 0 ] |
|
87 |
then |
|
88 |
echo "Execution successful" |
|
89 |
else |
|
90 |
echo "Execution of the test case failed." |
|
91 |
exit $result |
|
92 |
fi |
|
93 |
} |
|
94 |
||
95 |
# testing HOST is selected for the default locale, if specified on Windows or MacOSX |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
96 |
METHODNAME=adapterTest |
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
97 |
PREFLIST=HOST,JRE |
13583 | 98 |
case "$OS" in |
99 |
Windows_NT* ) |
|
100 |
WINVER=`uname -r` |
|
101 |
if [ "${WINVER}" = "5" ] |
|
102 |
then |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
103 |
PARAM1=JRE |
13583 | 104 |
else |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
105 |
PARAM1=HOST |
13583 | 106 |
fi |
107 |
;; |
|
108 |
CYGWIN_NT-6* | Darwin ) |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
109 |
PARAM1=HOST |
13583 | 110 |
;; |
111 |
* ) |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
112 |
PARAM1=JRE |
13583 | 113 |
;; |
114 |
esac |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
115 |
PARAM2=${DEFLANG} |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
116 |
PARAM3=${DEFCTRY} |
13583 | 117 |
runTest |
118 |
||
119 |
# testing HOST is NOT selected for the non-default locale, if specified |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
120 |
METHODNAME=adapterTest |
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
121 |
PREFLIST=HOST,JRE |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
122 |
PARAM1=JRE |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
123 |
# Try to find the locale JRE supports which is not the platform default (HOST supports that one) |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
124 |
if [ "${DEFLANG}" != "en" ] && [ "${DEFFMTLANG}" != "en" ]; then |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
125 |
PARAM2=en |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
126 |
PARAM3=US |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
127 |
elif [ "${DEFLANG}" != "ja" ] && [ "${DEFFMTLANG}" != "ja" ]; then |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
128 |
PARAM2=ja |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
129 |
PARAM3=JP |
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
130 |
else |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
131 |
PARAM2=zh |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
132 |
PARAM3=CN |
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
133 |
fi |
13583 | 134 |
runTest |
135 |
||
136 |
# testing SPI is NOT selected, as there is none. |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
137 |
METHODNAME=adapterTest |
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
138 |
PREFLIST=SPI,JRE |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
139 |
PARAM1=JRE |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
140 |
PARAM2=en |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
141 |
PARAM3=US |
13583 | 142 |
runTest |
143 |
||
144 |
# testing the order, variaton #1. This assumes en_GB DateFormat data are available both in JRE & CLDR |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
145 |
METHODNAME=adapterTest |
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
146 |
PREFLIST=CLDR,JRE |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
147 |
PARAM1=CLDR |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
148 |
PARAM2=en |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
149 |
PARAM3=GB |
13583 | 150 |
runTest |
151 |
||
152 |
# testing the order, variaton #2. This assumes en_GB DateFormat data are available both in JRE & CLDR |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
153 |
METHODNAME=adapterTest |
13583 | 154 |
PREFLIST=JRE,CLDR |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
155 |
PARAM1=JRE |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
156 |
PARAM2=en |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
157 |
PARAM3=GB |
13583 | 158 |
runTest |
159 |
||
160 |
# testing the order, variaton #3 for non-existent locale in JRE assuming "haw" is not in JRE. |
|
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
161 |
METHODNAME=adapterTest |
13583 | 162 |
PREFLIST=JRE,CLDR |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
163 |
PARAM1=CLDR |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
164 |
PARAM2=haw |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
165 |
PARAM3=GB |
13583 | 166 |
runTest |
167 |
||
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
168 |
# testing the order, variaton #4 for the bug 7196799. CLDR's "zh" data should be used in "zh_CN" |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
169 |
METHODNAME=adapterTest |
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
170 |
PREFLIST=CLDR |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
171 |
PARAM1=CLDR |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
172 |
PARAM2=zh |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
173 |
PARAM3=CN |
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
174 |
runTest |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
175 |
|
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
176 |
# testing FALLBACK provider. SPI and invalid one cases. |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
177 |
METHODNAME=adapterTest |
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
178 |
PREFLIST=SPI |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
179 |
PARAM1=FALLBACK |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
180 |
PARAM2=en |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
181 |
PARAM3=US |
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
182 |
runTest |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
183 |
PREFLIST=FOO |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
184 |
PARAM1=JRE |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
185 |
PARAM2=en |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
186 |
PARAM3=US |
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
187 |
runTest |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
188 |
PREFLIST=BAR,SPI |
14028
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
189 |
PARAM1=FALLBACK |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
190 |
PARAM2=en |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
191 |
PARAM3=US |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
192 |
runTest |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
193 |
|
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
194 |
# testing 7198834 fix. Only works on Windows Vista or upper. |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
195 |
METHODNAME=bug7198834Test |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
196 |
PREFLIST=HOST |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
197 |
PARAM1= |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
198 |
PARAM2= |
5f3d5ae5f1ea
7198834: HOST Adapter: one extra empty space in the end of the pattern string
naoto
parents:
14024
diff
changeset
|
199 |
PARAM3= |
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
200 |
runTest |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
201 |
|
13583 | 202 |
exit $result |