author | naoto |
Thu, 04 Oct 2012 10:04:56 -0700 | |
changeset 14024 | 694c379c2958 |
parent 13583 | dc0017b1a452 |
child 14028 | 5f3d5ae5f1ea |
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 |
|
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
26 |
# @bug 6336885 7196799 7197573 |
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 |
||
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
68 |
# get the platform default locale |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
69 |
PLATDEF=`${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} LocaleProviders` |
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}" |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
74 |
|
13583 | 75 |
runTest() |
76 |
{ |
|
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
77 |
RUNCMD="${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} -Djava.locale.providers=$PREFLIST LocaleProviders $EXPECTED $TESTLANG $TESTCTRY" |
13583 | 78 |
echo ${RUNCMD} |
79 |
${RUNCMD} |
|
80 |
result=$? |
|
81 |
if [ $result -eq 0 ] |
|
82 |
then |
|
83 |
echo "Execution successful" |
|
84 |
else |
|
85 |
echo "Execution of the test case failed." |
|
86 |
exit $result |
|
87 |
fi |
|
88 |
} |
|
89 |
||
90 |
# testing HOST is selected for the default locale, if specified on Windows or MacOSX |
|
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
91 |
PREFLIST=HOST,JRE |
13583 | 92 |
case "$OS" in |
93 |
Windows_NT* ) |
|
94 |
WINVER=`uname -r` |
|
95 |
if [ "${WINVER}" = "5" ] |
|
96 |
then |
|
97 |
EXPECTED=JRE |
|
98 |
else |
|
99 |
EXPECTED=HOST |
|
100 |
fi |
|
101 |
;; |
|
102 |
CYGWIN_NT-6* | Darwin ) |
|
103 |
EXPECTED=HOST |
|
104 |
;; |
|
105 |
* ) |
|
106 |
EXPECTED=JRE |
|
107 |
;; |
|
108 |
esac |
|
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
109 |
TESTLANG=${DEFLANG} |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
110 |
TESTCTRY=${DEFCTRY} |
13583 | 111 |
runTest |
112 |
||
113 |
# testing HOST is NOT selected for the non-default locale, if specified |
|
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
114 |
PREFLIST=HOST,JRE |
13583 | 115 |
EXPECTED=JRE |
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
116 |
if [ "${DEFLANG}" = "en" ] |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
117 |
then |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
118 |
TESTLANG=ja |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
119 |
TESTCTRY=JP |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
120 |
else |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
121 |
TESTLANG=en |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
122 |
TESTCTRY=US |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
123 |
fi |
13583 | 124 |
runTest |
125 |
||
126 |
# testing SPI is NOT selected, as there is none. |
|
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
127 |
PREFLIST=SPI,JRE |
13583 | 128 |
EXPECTED=JRE |
129 |
TESTLANG=en |
|
130 |
TESTCTRY=US |
|
131 |
runTest |
|
132 |
||
133 |
# testing the order, variaton #1. This assumes en_GB DateFormat data are available both in JRE & CLDR |
|
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
134 |
PREFLIST=CLDR,JRE |
13583 | 135 |
EXPECTED=CLDR |
136 |
TESTLANG=en |
|
137 |
TESTCTRY=GB |
|
138 |
runTest |
|
139 |
||
140 |
# testing the order, variaton #2. This assumes en_GB DateFormat data are available both in JRE & CLDR |
|
141 |
PREFLIST=JRE,CLDR |
|
142 |
EXPECTED=JRE |
|
143 |
TESTLANG=en |
|
144 |
TESTCTRY=GB |
|
145 |
runTest |
|
146 |
||
147 |
# testing the order, variaton #3 for non-existent locale in JRE assuming "haw" is not in JRE. |
|
148 |
PREFLIST=JRE,CLDR |
|
149 |
EXPECTED=CLDR |
|
150 |
TESTLANG=haw |
|
151 |
TESTCTRY=GB |
|
152 |
runTest |
|
153 |
||
14024
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
154 |
# testing the order, variaton #4 for the bug 7196799. CLDR's "zh" data should be used in "zh_CN" |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
155 |
PREFLIST=CLDR |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
156 |
EXPECTED=CLDR |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
157 |
TESTLANG=zh |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
158 |
TESTCTRY=CN |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
159 |
runTest |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
160 |
|
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
161 |
# testing FALLBACK provider. SPI and invalid one cases. |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
162 |
PREFLIST=SPI |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
163 |
EXPECTED=FALLBACK |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
164 |
TESTLANG=en |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
165 |
TESTCTRY=US |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
166 |
runTest |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
167 |
PREFLIST=FOO |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
168 |
EXPECTED=JRE |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
169 |
TESTLANG=en |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
170 |
TESTCTRY=US |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
171 |
runTest |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
172 |
PREFLIST=BAR,SPI |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
173 |
EXPECTED=FALLBACK |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
174 |
TESTLANG=en |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
175 |
TESTCTRY=US |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
176 |
runTest |
694c379c2958
7196799: CLDR adapter can not be invoked when region code is specified in Locale
naoto
parents:
13583
diff
changeset
|
177 |
|
13583 | 178 |
exit $result |