1 #!/bin/sh |
|
2 # |
|
3 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
|
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
5 # |
|
6 # This code is free software; you can redistribute it and/or modify it |
|
7 # under the terms of the GNU General Public License version 2 only, as |
|
8 # published by the Free Software Foundation. |
|
9 # |
|
10 # This code is distributed in the hope that it will be useful, but WITHOUT |
|
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 # version 2 for more details (a copy is included in the LICENSE file that |
|
14 # accompanied this code). |
|
15 # |
|
16 # You should have received a copy of the GNU General Public License version |
|
17 # 2 along with this work; if not, write to the Free Software Foundation, |
|
18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
19 # |
|
20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
21 # or visit www.oracle.com if you need additional information or have any |
|
22 # questions. |
|
23 # |
|
24 # |
|
25 # @test |
|
26 # @bug 4700857 6997928 7079486 |
|
27 # @summary tests for Locale.getDefault(Locale.Category) and |
|
28 # Locale.setDefault(Locale.Category, Locale) |
|
29 # @library /java/text/testlib |
|
30 # @build LocaleCategory TestUtils |
|
31 # @run shell/timeout=600 LocaleCategory.sh |
|
32 |
|
33 if [ "${TESTSRC}" = "" ] |
|
34 then |
|
35 echo "TESTSRC not set. Test cannot execute. Failed." |
|
36 exit 1 |
|
37 fi |
|
38 echo "TESTSRC=${TESTSRC}" |
|
39 if [ "${TESTJAVA}" = "" ] |
|
40 then |
|
41 echo "TESTJAVA not set. Test cannot execute. Failed." |
|
42 exit 1 |
|
43 fi |
|
44 echo "TESTJAVA=${TESTJAVA}" |
|
45 if [ "${TESTCLASSES}" = "" ] |
|
46 then |
|
47 echo "TESTCLASSES not set. Test cannot execute. Failed." |
|
48 exit 1 |
|
49 fi |
|
50 |
|
51 echo "TESTCLASSES=${TESTCLASSES}" |
|
52 echo "TESTCLASSPATH=${TESTCLASSPATH}" |
|
53 echo "CLASSPATH=${CLASSPATH}" |
|
54 |
|
55 # set platform-dependent variables |
|
56 OS=`uname -s` |
|
57 case "$OS" in |
|
58 SunOS | Linux | *BSD | Darwin | AIX ) |
|
59 PS=":" |
|
60 FS="/" |
|
61 ;; |
|
62 Windows* | CYGWIN* ) |
|
63 PS=";" |
|
64 FS="\\" |
|
65 ;; |
|
66 * ) |
|
67 echo "Unrecognized system!" |
|
68 exit 1; |
|
69 ;; |
|
70 esac |
|
71 |
|
72 # test user.xxx.display user.xxx.format properties |
|
73 |
|
74 # run |
|
75 RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSPATH} -Duser.language.display=ja -Duser.language.format=zh LocaleCategory" |
|
76 |
|
77 echo ${RUNCMD} |
|
78 ${RUNCMD} |
|
79 result=$? |
|
80 |
|
81 if [ $result -eq 0 ] |
|
82 then |
|
83 echo "Execution successful" |
|
84 else |
|
85 echo "Execution of the test case failed." |
|
86 fi |
|
87 |
|
88 # test user.xxx properties overriding user.xxx.display/format |
|
89 |
|
90 # run |
|
91 RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSPATH} -Duser.language=en -Duser.language.display=ja -Duser.language.format=zh LocaleCategory" |
|
92 |
|
93 echo ${RUNCMD} |
|
94 ${RUNCMD} |
|
95 result=$? |
|
96 |
|
97 if [ $result -eq 0 ] |
|
98 then |
|
99 echo "Execution successful" |
|
100 else |
|
101 echo "Execution of the test case failed." |
|
102 fi |
|
103 |
|
104 exit $result |
|