--- /dev/null 2017-03-27 15:31:30.174082525 -0700 +++ new/test/java/util/Calendar/SupplementalJapaneseEraTest.sh 2017-03-30 13:04:41.504146712 -0700 @@ -0,0 +1,62 @@ +# +# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# @test +# @bug 8054214 8173423 +# @summary Test for Japanese supplemental era in calendars.properties support +# @build SupplementalJapaneseEraTest +# @run shell/timeout=600 SupplementalJapaneseEraTest.sh + +# copy the runtime for modifying lib/calendars.properties +WRITABLEJDK=./testjava +cp -H -R $TESTJAVA $WRITABLEJDK || exit 1 +if [ -d ${TESTJAVA}/jre ] +then + PROPLOCATION=${WRITABLEJDK}/jre/lib +else + PROPLOCATION=${WRITABLEJDK}/lib +fi +chmod -R a+rx $WRITABLEJDK || exit 1 + +STATUS=0 + +# get the start time of the fictional next era +SINCE=`${TESTJAVA}/bin/java -cp "${TESTCLASSES}" SupplementalJapaneseEraTest -s` + +# modify calendars.properties +mv $PROPLOCATION/calendars.properties $PROPLOCATION/calendars.properties.orig || exit 1 +sed -e "s/\(name=Heisei,abbr=H,since=600220800000\)/\1;name=NewEra,abbr=N.E.,since=$SINCE/" < $PROPLOCATION/calendars.properties.orig > $PROPLOCATION/calendars.properties || exit 1 + +# run +if ${WRITABLEJDK}/bin/java ${TESTVMOPTS} -cp "${TESTCLASSES}" \ + SupplementalJapaneseEraTest -t; then + echo "passed" +else + echo "failed" + STATUS=1 +fi + +# Cleanup +rm -rf $WRITABLEJDK + +exit $STATUS