2007-12-01 00:00:00 +00:00
|
|
|
#!/bin/sh
|
2012-12-02 16:37:31 +00:00
|
|
|
|
|
|
|
# Copyright (c) 2007, 2012, 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.
|
2007-12-01 00:00:00 +00:00
|
|
|
#
|
2012-12-02 16:37:31 +00:00
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
# @test
|
2013-06-21 20:42:55 +00:00
|
|
|
# @bug 6332666 6863624 7180362 8003846
|
2007-12-01 00:00:00 +00:00
|
|
|
# @summary tests the capability of replacing the currency data with user
|
|
|
|
# specified currency properties file
|
|
|
|
# @build PropertiesTest
|
|
|
|
# @run shell/timeout=600 PropertiesTest.sh
|
|
|
|
|
|
|
|
if [ "${TESTSRC}" = "" ]
|
|
|
|
then
|
|
|
|
echo "TESTSRC not set. Test cannot execute. Failed."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "TESTSRC=${TESTSRC}"
|
|
|
|
if [ "${TESTJAVA}" = "" ]
|
|
|
|
then
|
|
|
|
echo "TESTJAVA not set. Test cannot execute. Failed."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "TESTJAVA=${TESTJAVA}"
|
|
|
|
if [ "${TESTCLASSES}" = "" ]
|
|
|
|
then
|
|
|
|
echo "TESTCLASSES not set. Test cannot execute. Failed."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "TESTCLASSES=${TESTCLASSES}"
|
|
|
|
echo "CLASSPATH=${CLASSPATH}"
|
|
|
|
|
|
|
|
# set platform-dependent variables
|
|
|
|
OS=`uname -s`
|
|
|
|
case "$OS" in
|
2014-01-17 20:54:30 +00:00
|
|
|
SunOS | Linux | Darwin | AIX )
|
2007-12-01 00:00:00 +00:00
|
|
|
PS=":"
|
|
|
|
FS="/"
|
|
|
|
;;
|
2013-06-21 20:42:55 +00:00
|
|
|
Windows* )
|
2007-12-01 00:00:00 +00:00
|
|
|
PS=";"
|
2012-12-02 16:37:31 +00:00
|
|
|
FS="/"
|
2007-12-01 00:00:00 +00:00
|
|
|
;;
|
2013-06-21 20:42:55 +00:00
|
|
|
CYGWIN* )
|
|
|
|
PS=";"
|
|
|
|
FS="/"
|
|
|
|
TESTJAVA=`cygpath -u ${TESTJAVA}`
|
|
|
|
;;
|
2007-12-01 00:00:00 +00:00
|
|
|
* )
|
|
|
|
echo "Unrecognized system!"
|
|
|
|
exit 1;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2012-12-02 16:37:31 +00:00
|
|
|
failures=0
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2012-12-02 16:37:31 +00:00
|
|
|
run() {
|
|
|
|
echo ''
|
2012-12-13 14:47:35 +00:00
|
|
|
sh -xc "${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} $*" 2>&1
|
2012-12-02 16:37:31 +00:00
|
|
|
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2012-12-02 16:37:31 +00:00
|
|
|
PROPS=${TESTSRC}${FS}currency.properties
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
|
2012-12-02 16:37:31 +00:00
|
|
|
# Dump built-in currency data
|
|
|
|
|
|
|
|
run PropertiesTest -d dump1
|
|
|
|
|
|
|
|
|
|
|
|
# Dump built-in currency data + overrides in properties file specified
|
|
|
|
# by system property.
|
|
|
|
|
|
|
|
run -Djava.util.currency.data=${PROPS} PropertiesTest -d dump2
|
|
|
|
run PropertiesTest -c dump1 dump2 ${PROPS}
|
|
|
|
|
|
|
|
|
|
|
|
# Dump built-in currency data + overrides in properties file copied into
|
|
|
|
# JRE image.
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2013-06-21 20:42:55 +00:00
|
|
|
# Copy the test properties file. If testjava is not a typical jdk-image
|
|
|
|
# or testjava is not writable, make a private copy of it.
|
2007-12-01 00:00:00 +00:00
|
|
|
COPIED=0
|
2013-06-21 20:42:55 +00:00
|
|
|
if [ -w ${TESTJAVA}${FS}jre${FS}lib ]
|
2012-03-06 20:34:38 +00:00
|
|
|
then
|
2007-12-01 00:00:00 +00:00
|
|
|
WRITABLEJDK=$TESTJAVA
|
2013-06-21 20:42:55 +00:00
|
|
|
PROPLOCATION=${WRITABLEJDK}${FS}jre${FS}lib
|
2007-12-01 00:00:00 +00:00
|
|
|
else
|
2012-03-06 20:34:38 +00:00
|
|
|
WRITABLEJDK=.${FS}testjava
|
2013-06-21 20:42:55 +00:00
|
|
|
if [ -d ${TESTJAVA}${FS}jre ]
|
|
|
|
then
|
|
|
|
PROPLOCATION=${WRITABLEJDK}${FS}jre${FS}lib
|
|
|
|
else
|
|
|
|
PROPLOCATION=${WRITABLEJDK}${FS}lib
|
|
|
|
fi
|
2007-12-01 00:00:00 +00:00
|
|
|
cp -r $TESTJAVA $WRITABLEJDK
|
2013-06-21 20:42:55 +00:00
|
|
|
chmod -R +w $WRITABLEJDK
|
2007-12-01 00:00:00 +00:00
|
|
|
COPIED=1
|
|
|
|
fi
|
2012-12-02 16:37:31 +00:00
|
|
|
cp ${PROPS} $PROPLOCATION
|
2013-06-21 20:42:55 +00:00
|
|
|
echo "Properties location: ${PROPLOCATION}"
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
# run
|
2012-12-02 16:37:31 +00:00
|
|
|
echo ''
|
2012-12-13 14:47:35 +00:00
|
|
|
sh -xc "${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest -d dump3"
|
2012-12-02 16:37:31 +00:00
|
|
|
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
rm -f ${PROPLOCATION}${FS}currency.properties
|
|
|
|
if [ $COPIED -eq 1 ]
|
|
|
|
then
|
|
|
|
rm -rf $WRITABLEJDK
|
|
|
|
fi
|
|
|
|
|
2012-12-02 16:37:31 +00:00
|
|
|
# compare the two dump files
|
|
|
|
run PropertiesTest -c dump1 dump3 ${PROPS}
|
|
|
|
|
|
|
|
|
|
|
|
# Results
|
|
|
|
echo ''
|
|
|
|
if [ $failures -gt 0 ];
|
|
|
|
then echo "$failures tests failed";
|
|
|
|
else echo "All tests passed"; fi
|
|
|
|
exit $failures
|