jdk/test/java/util/Calendar/SupplementalJapaneseEraTest.sh
author okutsu
Thu, 07 Aug 2014 13:04:26 +0900
changeset 25966 71ee1f15845e
child 42696 a0df1f76b88e
permissions -rw-r--r--
8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era Reviewed-by: naoto, alanb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25966
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
     1
#
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
     2
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
     4
#
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
     7
# published by the Free Software Foundation.
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
     8
#
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
     9
# This code is distributed in the hope that it will be useful, but WITHOUT
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    12
# version 2 for more details (a copy is included in the LICENSE file that
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    13
# accompanied this code).
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    14
#
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    15
# You should have received a copy of the GNU General Public License version
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    16
# 2 along with this work; if not, write to the Free Software Foundation,
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    18
#
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    20
# or visit www.oracle.com if you need additional information or have any
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    21
# questions.
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    22
#
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    23
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    24
# @test
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    25
# @bug 8048123
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    26
# @summary Test for jdk.calendar.japanese.supplemental.era support
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    27
# @build SupplementalJapaneseEraTest
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    28
# @run shell SupplementalJapaneseEraTest.sh
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    29
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    30
PROPERTY=jdk.calendar.japanese.supplemental.era
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    31
STATUS=0
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    32
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    33
# get the start time of the fictional next era
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    34
SINCE=`${TESTJAVA}/bin/java -cp "${TESTCLASSES}" SupplementalJapaneseEraTest -s`
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    35
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    36
echo "Tests with valid property values..."
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    37
for P in "name=NewEra,abbr=N.E.,since=$SINCE" \
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    38
         "name = NewEra, abbr = N.E., since = $SINCE"
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    39
do
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    40
    if ${TESTJAVA}/bin/java ${TESTVMOPTS} -cp "${TESTCLASSES}" \
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    41
           -D$PROPERTY="$P" SupplementalJapaneseEraTest -t; then
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    42
        echo "$P: passed"
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    43
    else
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    44
        echo "$P: failed"
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    45
        STATUS=1
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    46
    fi
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    47
done
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    48
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    49
# get the name of the current era to be used to confirm that
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    50
# invalid property values are ignored.
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    51
ERA=`${TESTJAVA}/bin/java -cp "${TESTCLASSES}" SupplementalJapaneseEraTest -e`
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    52
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    53
echo "Tests with invalid property values..."
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    54
for P in "foo=Bar,name=NewEra,abbr=N.E.,since=$SINCE" \
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    55
         "=NewEra,abbr=N.E.,since=$SINCE" \
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    56
         "=,abbr=N.E.,since=$SINCE" \
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    57
         "name,abbr=N.E.,since=$SINCE" \
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    58
         "abbr=N.E.,since=$SINCE" \
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    59
         "name=NewEra,since=$SINCE" \
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    60
         "name=,abbr=N.E.,since=$SINCE" \
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    61
         "name=NewEra,abbr=,since=$SINCE" \
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    62
         "name=NewEra,abbr=N.E." \
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    63
         "name=NewEra,abbr=N.E.,since=0" \
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    64
         "name=NewEra,abbr=N.E.,since=9223372036854775808" # Long.MAX_VALUE+1
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    65
do
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    66
    if ${TESTJAVA}/bin/java ${TESTVMOPTS} -cp "${TESTCLASSES}" \
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    67
           -D$PROPERTY="$P" SupplementalJapaneseEraTest -b "$ERA"; then
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    68
        echo "$P: passed"
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    69
    else
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    70
        echo "$P: failed"
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    71
        STATUS=1
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    72
    fi
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    73
done
71ee1f15845e 8048123: Replace calendars.properties with another mechanism to specify a new Japanese calendar era
okutsu
parents:
diff changeset
    74
exit $STATUS