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
|
|
26 |
# @bug 6336885
|
|
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 |
|
|
68 |
runTest()
|
|
69 |
{
|
|
70 |
RUNCMD="${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} -Duser.language=$DEFLANG -Duser.country=$DEFCTRY -Djava.locale.providers=$PREFLIST LocaleProviders $EXPECTED $TESTLANG $TESTCTRY"
|
|
71 |
echo ${RUNCMD}
|
|
72 |
${RUNCMD}
|
|
73 |
result=$?
|
|
74 |
if [ $result -eq 0 ]
|
|
75 |
then
|
|
76 |
echo "Execution successful"
|
|
77 |
else
|
|
78 |
echo "Execution of the test case failed."
|
|
79 |
exit $result
|
|
80 |
fi
|
|
81 |
}
|
|
82 |
|
|
83 |
# testing HOST is selected for the default locale, if specified on Windows or MacOSX
|
|
84 |
DEFLANG=en
|
|
85 |
DEFCTRY=US
|
|
86 |
PREFLIST=HOST
|
|
87 |
case "$OS" in
|
|
88 |
Windows_NT* )
|
|
89 |
WINVER=`uname -r`
|
|
90 |
if [ "${WINVER}" = "5" ]
|
|
91 |
then
|
|
92 |
EXPECTED=JRE
|
|
93 |
else
|
|
94 |
EXPECTED=HOST
|
|
95 |
fi
|
|
96 |
;;
|
|
97 |
CYGWIN_NT-6* | Darwin )
|
|
98 |
EXPECTED=HOST
|
|
99 |
;;
|
|
100 |
* )
|
|
101 |
EXPECTED=JRE
|
|
102 |
;;
|
|
103 |
esac
|
|
104 |
TESTLANG=en
|
|
105 |
TESTCTRY=US
|
|
106 |
runTest
|
|
107 |
|
|
108 |
# testing HOST is NOT selected for the non-default locale, if specified
|
|
109 |
DEFLANG=en
|
|
110 |
DEFCTRY=US
|
|
111 |
PREFLIST=HOST
|
|
112 |
EXPECTED=JRE
|
|
113 |
TESTLANG=en
|
|
114 |
TESTCTRY=GB
|
|
115 |
runTest
|
|
116 |
|
|
117 |
# testing SPI is NOT selected, as there is none.
|
|
118 |
PREFLIST=SPI
|
|
119 |
EXPECTED=JRE
|
|
120 |
TESTLANG=en
|
|
121 |
TESTCTRY=US
|
|
122 |
runTest
|
|
123 |
|
|
124 |
# testing the order, variaton #1. This assumes en_GB DateFormat data are available both in JRE & CLDR
|
|
125 |
PREFLIST=CLDR
|
|
126 |
EXPECTED=CLDR
|
|
127 |
TESTLANG=en
|
|
128 |
TESTCTRY=GB
|
|
129 |
runTest
|
|
130 |
|
|
131 |
# testing the order, variaton #2. This assumes en_GB DateFormat data are available both in JRE & CLDR
|
|
132 |
PREFLIST=JRE,CLDR
|
|
133 |
EXPECTED=JRE
|
|
134 |
TESTLANG=en
|
|
135 |
TESTCTRY=GB
|
|
136 |
runTest
|
|
137 |
|
|
138 |
# testing the order, variaton #3 for non-existent locale in JRE assuming "haw" is not in JRE.
|
|
139 |
PREFLIST=JRE,CLDR
|
|
140 |
EXPECTED=CLDR
|
|
141 |
TESTLANG=haw
|
|
142 |
TESTCTRY=GB
|
|
143 |
runTest
|
|
144 |
|
|
145 |
exit $result
|