test/jdk/java/util/Calendar/SupplementalJapaneseEraTest.sh
author naoto
Wed, 09 Aug 2017 14:54:37 -0700
changeset 50478 2e3f73b616c2
parent 47216 71c04702a3d5
permissions -rw-r--r--
8202088: Japanese new era implementation Reviewed-by: scolebourne, rriggs, nishjain, weijun
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
#
50478
2e3f73b616c2 8202088: Japanese new era implementation
naoto
parents: 47216
diff changeset
     2
# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
25966
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
43338
f9c4f82a8265 8173423: Wrong display name for supplemental Japanese era
naoto
parents: 42696
diff changeset
    25
# @bug 8048123 8054214 8173423
25966
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..."
50478
2e3f73b616c2 8202088: Japanese new era implementation
naoto
parents: 47216
diff changeset
    37
for P in "name=SupEra,abbr=S.E.,since=$SINCE" \
2e3f73b616c2 8202088: Japanese new era implementation
naoto
parents: 47216
diff changeset
    38
         "name = SupEra, abbr = S.E., since = $SINCE"
25966
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..."
50478
2e3f73b616c2 8202088: Japanese new era implementation
naoto
parents: 47216
diff changeset
    54
for P in "foo=Bar,name=SupEra,abbr=S.E.,since=$SINCE" \
2e3f73b616c2 8202088: Japanese new era implementation
naoto
parents: 47216
diff changeset
    55
         "=SupEra,abbr=S.E.,since=$SINCE" \
2e3f73b616c2 8202088: Japanese new era implementation
naoto
parents: 47216
diff changeset
    56
         "=,abbr=S.E.,since=$SINCE" \
2e3f73b616c2 8202088: Japanese new era implementation
naoto
parents: 47216
diff changeset
    57
         "name,abbr=S.E.,since=$SINCE" \
2e3f73b616c2 8202088: Japanese new era implementation
naoto
parents: 47216
diff changeset
    58
         "abbr=S.E.,since=$SINCE" \
2e3f73b616c2 8202088: Japanese new era implementation
naoto
parents: 47216
diff changeset
    59
         "name=SupEra,since=$SINCE" \
2e3f73b616c2 8202088: Japanese new era implementation
naoto
parents: 47216
diff changeset
    60
         "name=,abbr=S.E.,since=$SINCE" \
2e3f73b616c2 8202088: Japanese new era implementation
naoto
parents: 47216
diff changeset
    61
         "name=SupEra,abbr=,since=$SINCE" \
2e3f73b616c2 8202088: Japanese new era implementation
naoto
parents: 47216
diff changeset
    62
         "name=SupEra,abbr=S.E." \
2e3f73b616c2 8202088: Japanese new era implementation
naoto
parents: 47216
diff changeset
    63
         "name=SupEra,abbr=S.E.,since=0" \
2e3f73b616c2 8202088: Japanese new era implementation
naoto
parents: 47216
diff changeset
    64
         "name=SupEra,abbr=S.E.,since=9223372036854775808" # Long.MAX_VALUE+1
25966
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