1 # |
|
2 # Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. |
|
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 # |
|
5 # This code is free software; you can redistribute it and/or modify it |
|
6 # under the terms of the GNU General Public License version 2 only, as |
|
7 # published by the Free Software Foundation. |
|
8 # |
|
9 # This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 # version 2 for more details (a copy is included in the LICENSE file that |
|
13 # accompanied this code). |
|
14 # |
|
15 # You should have received a copy of the GNU General Public License version |
|
16 # 2 along with this work; if not, write to the Free Software Foundation, |
|
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 # |
|
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 # or visit www.oracle.com if you need additional information or have any |
|
21 # questions. |
|
22 # |
|
23 |
|
24 # |
|
25 # @test |
|
26 # @summary Tests for the RMI unmarshalling errors not to cause silent failure. |
|
27 # @author Jaroslav Bachorik |
|
28 # @bug 6937053 |
|
29 # |
|
30 # @run shell TestSerializationMismatch.sh |
|
31 # |
|
32 |
|
33 #set -x |
|
34 |
|
35 #Set appropriate jdk |
|
36 # |
|
37 |
|
38 if [ ! -z "${TESTJAVA}" ] ; then |
|
39 jdk="$TESTJAVA" |
|
40 else |
|
41 echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test." |
|
42 exit 1 |
|
43 fi |
|
44 |
|
45 SERVER_TESTCLASSES=$TESTCLASSES/Server |
|
46 CLIENT_TESTCLASSES=$TESTCLASSES/Client |
|
47 |
|
48 URL_PATH=$SERVER_TESTCLASSES/jmxurl |
|
49 |
|
50 rm $URL_PATH |
|
51 |
|
52 mkdir -p $SERVER_TESTCLASSES |
|
53 mkdir -p $CLIENT_TESTCLASSES |
|
54 |
|
55 $TESTJAVA/bin/javac -d $CLIENT_TESTCLASSES $TESTSRC/Client/ConfigKey.java $TESTSRC/Client/TestNotification.java $TESTSRC/Client/Client.java |
|
56 $TESTJAVA/bin/javac -d $SERVER_TESTCLASSES $TESTSRC/Server/ConfigKey.java $TESTSRC/Server/TestNotification.java $TESTSRC/Server/SteMBean.java $TESTSRC/Server/Ste.java $TESTSRC/Server/Server.java |
|
57 |
|
58 startServer() |
|
59 { |
|
60 ($TESTJAVA/bin/java -classpath $SERVER_TESTCLASSES Server) 1>$URL_PATH & |
|
61 SERVER_PID=$! |
|
62 } |
|
63 |
|
64 runClient() |
|
65 { |
|
66 while true |
|
67 do |
|
68 [ -f $URL_PATH ] && break |
|
69 sleep 2 |
|
70 done |
|
71 read JMXURL < $URL_PATH |
|
72 |
|
73 HAS_ERRORS=`($TESTJAVA/bin/java -classpath $CLIENT_TESTCLASSES Client $JMXURL) 2>&1 | grep -i "SEVERE: Failed to fetch notification, stopping thread. Error is: java.rmi.UnmarshalException"` |
|
74 } |
|
75 |
|
76 startServer |
|
77 |
|
78 runClient |
|
79 |
|
80 sleep 1 # wait for notifications to arrive |
|
81 |
|
82 kill "$SERVER_PID" |
|
83 |
|
84 if [ -z "$HAS_ERRORS" ] |
|
85 then |
|
86 echo "Test PASSED" |
|
87 exit 0 |
|
88 fi |
|
89 |
|
90 echo "Test FAILED" |
|
91 echo $HAS_ERRORS 1>&2 |
|
92 exit 1 |
|
93 |
|