author | mfang |
Wed, 17 Aug 2011 14:18:26 -0700 | |
changeset 10294 | 8fcdae2a7ec7 |
parent 4662 | 49b8cbe45e6a |
child 12047 | 320a714614e9 |
permissions | -rw-r--r-- |
2 | 1 |
#!/bin/sh |
2 |
# |
|
3 |
# @test |
|
4 |
# @bug 6332666 |
|
5 |
# @summary tests the capability of replacing the currency data with user |
|
6 |
# specified currency properties file |
|
7 |
# @build PropertiesTest |
|
8 |
# @run shell/timeout=600 PropertiesTest.sh |
|
9 |
||
10 |
if [ "${TESTSRC}" = "" ] |
|
11 |
then |
|
12 |
echo "TESTSRC not set. Test cannot execute. Failed." |
|
13 |
exit 1 |
|
14 |
fi |
|
15 |
echo "TESTSRC=${TESTSRC}" |
|
16 |
if [ "${TESTJAVA}" = "" ] |
|
17 |
then |
|
18 |
echo "TESTJAVA not set. Test cannot execute. Failed." |
|
19 |
exit 1 |
|
20 |
fi |
|
21 |
echo "TESTJAVA=${TESTJAVA}" |
|
22 |
if [ "${TESTCLASSES}" = "" ] |
|
23 |
then |
|
24 |
echo "TESTCLASSES not set. Test cannot execute. Failed." |
|
25 |
exit 1 |
|
26 |
fi |
|
27 |
echo "TESTCLASSES=${TESTCLASSES}" |
|
28 |
echo "CLASSPATH=${CLASSPATH}" |
|
29 |
||
30 |
# set platform-dependent variables |
|
31 |
OS=`uname -s` |
|
32 |
case "$OS" in |
|
33 |
SunOS | Linux ) |
|
34 |
PS=":" |
|
35 |
FS="/" |
|
36 |
;; |
|
4662
49b8cbe45e6a
6911108: These tests do not work with CYGWIN: java/util
ohair
parents:
2
diff
changeset
|
37 |
Windows* | CYGWIN* ) |
2 | 38 |
PS=";" |
39 |
FS="\\" |
|
40 |
;; |
|
41 |
* ) |
|
42 |
echo "Unrecognized system!" |
|
43 |
exit 1; |
|
44 |
;; |
|
45 |
esac |
|
46 |
||
47 |
# Currency dump path #1. Just dump currencies with the bare JRE |
|
48 |
||
49 |
# run |
|
50 |
RUNCMD="${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} PropertiesTest -d dump1" |
|
51 |
||
52 |
echo ${RUNCMD} |
|
53 |
${RUNCMD} |
|
54 |
result=$? |
|
55 |
||
56 |
if [ $result -eq 0 ] |
|
57 |
then |
|
58 |
echo "Execution successful" |
|
59 |
else |
|
60 |
echo "Execution of the test case failed." |
|
61 |
fi |
|
62 |
||
63 |
# Currency dump path #2. Dump currencies using the JRE with replacement currencies |
|
64 |
||
65 |
# copy the test properties file |
|
66 |
COPIED=0 |
|
67 |
if [ -w $TESTJAVA ] |
|
68 |
then |
|
69 |
WRITABLEJDK=$TESTJAVA |
|
70 |
else |
|
71 |
WRITABLEJDK=.${FS}testjava |
|
72 |
cp -r $TESTJAVA $WRITABLEJDK |
|
73 |
COPIED=1 |
|
74 |
fi |
|
75 |
||
76 |
if [ -d ${WRITABLEJDK}${FS}jre ] |
|
77 |
then |
|
78 |
PROPLOCATION=${WRITABLEJDK}${FS}jre${FS}lib |
|
79 |
else |
|
80 |
PROPLOCATION=${WRITABLEJDK}${FS}lib |
|
81 |
fi |
|
82 |
cp ${TESTSRC}${FS}currency.properties $PROPLOCATION |
|
83 |
||
84 |
# run |
|
85 |
RUNCMD="${WRITABLEJDK}${FS}bin${FS}java -classpath ${TESTCLASSES} PropertiesTest -d dump2" |
|
86 |
||
87 |
echo ${RUNCMD} |
|
88 |
${RUNCMD} |
|
89 |
result=$? |
|
90 |
||
91 |
if [ $result -eq 0 ] |
|
92 |
then |
|
93 |
echo "Execution successful" |
|
94 |
else |
|
95 |
echo "Execution of the test case failed." |
|
96 |
fi |
|
97 |
||
98 |
# Now compare the two dump files |
|
99 |
||
100 |
RUNCMD="${WRITABLEJDK}${FS}bin${FS}java -classpath ${TESTCLASSES} PropertiesTest -c dump1 dump2" |
|
101 |
||
102 |
echo ${RUNCMD} |
|
103 |
${RUNCMD} |
|
104 |
result=$? |
|
105 |
||
106 |
if [ $result -eq 0 ] |
|
107 |
then |
|
108 |
echo "Execution successful" |
|
109 |
else |
|
110 |
echo "Execution of the test case failed." |
|
111 |
fi |
|
112 |
||
113 |
# Cleanup |
|
114 |
rm -f dump1 |
|
115 |
rm -f dump2 |
|
116 |
rm -f ${PROPLOCATION}${FS}currency.properties |
|
117 |
if [ $COPIED -eq 1 ] |
|
118 |
then |
|
119 |
rm -rf $WRITABLEJDK |
|
120 |
fi |
|
121 |
||
122 |
exit $result |