jdk/test/java/util/Locale/LocaleProviders.sh
author naoto
Tue, 21 Aug 2012 11:00:30 -0700
changeset 13583 dc0017b1a452
child 14024 694c379c2958
permissions -rw-r--r--
6336885: RFE: Locale Data Deployment Enhancements 4609153: Provide locale data for Indic locales 5104387: Support for gl_ES locale (galician language) 6337471: desktop/system locale preferences support 7056139: (cal) SPI support for locale-dependent Calendar parameters 7058206: Provide CalendarData SPI for week params and display field value names 7073852: Support multiple scripts for digits and decimal symbols per locale 7079560: [Fmt-Da] Context dependent month names support in SimpleDateFormat 7171324: getAvailableLocales() of locale sensitive services should return the actual availability of locales 7151414: (cal) Support calendar type identification 7168528: LocaleServiceProvider needs to be aware of Locale extensions 7171372: (cal) locale's default Calendar should be created if unknown calendar is specified Summary: JEP 127: Improve Locale Data Packaging and Adopt Unicode CLDR Data (part 1 w/o packaging changes. by Naoto Sato and Masayoshi Okutsu) Reviewed-by: erikj, sherman, peytoia
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
     1
#
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
     2
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
     4
#
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
     7
# published by the Free Software Foundation.
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
     8
#
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
     9
# This code is distributed in the hope that it will be useful, but WITHOUT
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    12
# version 2 for more details (a copy is included in the LICENSE file that
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    13
# accompanied this code).
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    14
#
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    15
# You should have received a copy of the GNU General Public License version
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    16
# 2 along with this work; if not, write to the Free Software Foundation,
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    18
#
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    20
# or visit www.oracle.com if you need additional information or have any
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    21
# questions.
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    22
#
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    23
#!/bin/sh
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    24
#
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    25
# @test
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    26
# @bug 6336885
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    27
# @summary tests for "java.locale.providers" system property
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    28
# @compile -XDignore.symbol.file LocaleProviders.java
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    29
# @run shell/timeout=600 LocaleProviders.sh
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    30
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    31
if [ "${TESTSRC}" = "" ]
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    32
then
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    33
  echo "TESTSRC not set.  Test cannot execute.  Failed."
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    34
  exit 1
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    35
fi
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    36
echo "TESTSRC=${TESTSRC}"
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    37
if [ "${TESTJAVA}" = "" ]
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    38
then
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    39
  echo "TESTJAVA not set.  Test cannot execute.  Failed."
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    40
  exit 1
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    41
fi
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    42
echo "TESTJAVA=${TESTJAVA}"
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    43
if [ "${TESTCLASSES}" = "" ]
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    44
then
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    45
  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    46
  exit 1
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    47
fi
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    48
echo "TESTCLASSES=${TESTCLASSES}"
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    49
echo "CLASSPATH=${CLASSPATH}"
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    50
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    51
# set platform-dependent variables
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    52
OS=`uname -s`
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    53
case "$OS" in
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    54
  SunOS | Linux | *BSD | Darwin )
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    55
    PS=":"
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    56
    FS="/"
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    57
    ;;
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    58
  Windows* | CYGWIN* )
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    59
    PS=";"
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    60
    FS="\\"
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    61
    ;;
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    62
  * )
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    63
    echo "Unrecognized system!"
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    64
    exit 1;
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    65
    ;;
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    66
esac
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    67
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    68
runTest()
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    69
{
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    70
    RUNCMD="${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} -Duser.language=$DEFLANG -Duser.country=$DEFCTRY -Djava.locale.providers=$PREFLIST LocaleProviders $EXPECTED $TESTLANG $TESTCTRY"
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    71
    echo ${RUNCMD}
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    72
    ${RUNCMD}
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    73
    result=$?
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    74
    if [ $result -eq 0 ]
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    75
    then
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    76
      echo "Execution successful"
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    77
    else
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    78
      echo "Execution of the test case failed."
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    79
      exit $result
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    80
    fi
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    81
}
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    82
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    83
# testing HOST is selected for the default locale, if specified on Windows or MacOSX
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    84
DEFLANG=en
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    85
DEFCTRY=US
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    86
PREFLIST=HOST
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    87
case "$OS" in
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    88
  Windows_NT* )
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    89
    WINVER=`uname -r`
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    90
    if [ "${WINVER}" = "5" ]
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    91
    then
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    92
      EXPECTED=JRE
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    93
    else
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    94
      EXPECTED=HOST
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    95
    fi
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    96
    ;;
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    97
  CYGWIN_NT-6* | Darwin )
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    98
    EXPECTED=HOST
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
    99
    ;;
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   100
  * )
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   101
    EXPECTED=JRE
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   102
    ;;
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   103
esac
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   104
TESTLANG=en
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   105
TESTCTRY=US
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   106
runTest
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   107
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   108
# testing HOST is NOT selected for the non-default locale, if specified
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   109
DEFLANG=en
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   110
DEFCTRY=US
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   111
PREFLIST=HOST
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   112
EXPECTED=JRE
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   113
TESTLANG=en
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   114
TESTCTRY=GB
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   115
runTest
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   116
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   117
# testing SPI is NOT selected, as there is none.
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   118
PREFLIST=SPI
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   119
EXPECTED=JRE
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   120
TESTLANG=en
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   121
TESTCTRY=US
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   122
runTest
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   123
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   124
# testing the order, variaton #1. This assumes en_GB DateFormat data are available both in JRE & CLDR
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   125
PREFLIST=CLDR
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   126
EXPECTED=CLDR
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   127
TESTLANG=en
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   128
TESTCTRY=GB
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   129
runTest
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   130
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   131
# testing the order, variaton #2. This assumes en_GB DateFormat data are available both in JRE & CLDR
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   132
PREFLIST=JRE,CLDR
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   133
EXPECTED=JRE
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   134
TESTLANG=en
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   135
TESTCTRY=GB
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   136
runTest
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   137
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   138
# testing the order, variaton #3 for non-existent locale in JRE assuming "haw" is not in JRE.
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   139
PREFLIST=JRE,CLDR
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   140
EXPECTED=CLDR
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   141
TESTLANG=haw
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   142
TESTCTRY=GB
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   143
runTest
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   144
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents:
diff changeset
   145
exit $result