1 # 2 # Copyright (c) 2011, 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 # @test 25 # @bug 7102369 7094468 7100592 26 # @summary remove java.rmi.server.codebase property parsing from registyimpl 27 # @run shell readTest.sh 28 29 OS=`uname -s` 30 case "$OS" in 31 SunOS | Linux | Darwin ) 32 PS=":" 33 FS="/" 34 FILEURL="file:" 35 ;; 36 Windows* | CYGWIN* ) 37 PS=";" 38 FS="\\" 39 FILEURL="file:/" 40 ;; 41 * ) 42 echo "Unrecognized system!" 43 exit 1; 44 ;; 45 esac 46 47 cp -r ${TESTSRC}${FS}* . 48 ${TESTJAVA}${FS}bin${FS}javac testPkg${FS}*java 49 ${TESTJAVA}${FS}bin${FS}javac readTest.java 50 51 mkdir rmi_tmp 52 RMIREG_OUT=rmi.out 53 #start rmiregistry without any local classes on classpath 54 cd rmi_tmp 55 ${TESTJAVA}${FS}bin${FS}rmiregistry 7491 > ..${FS}${RMIREG_OUT} 2>&1 & 56 RMIREG_PID=$! 57 # allow some time to start 58 sleep 3 59 cd .. 60 61 # trailing / after code base is important for rmi codebase property. 62 ${TESTJAVA}${FS}bin${FS}java -Djava.rmi.server.codebase=${FILEURL}`pwd`/ readTest > OUT.TXT 2>&1 & 63 TEST_PID=$! 64 #bulk of testcase - let it run for a while 65 sleep 5 66 67 #we're done, kill processes first 68 kill -9 ${RMIREG_PID} ${TEST_PID} 69 sleep 3 70 71 echo "Test output : " 72 73 cat OUT.TXT 74 echo "==============" 75 echo "rmiregistry output : " 76 cat ${RMIREG_OUT} 77 echo "==============" 78 79 grep "Server ready" OUT.TXT 80 result1=$? 81 grep "Test passed" OUT.TXT 82 result2=$? 83 84 if [ $result1 -eq 0 -a $result2 -eq 0 ] 85 then 86 echo "Passed" 87 exitCode=0; 88 else 89 echo "Failed" 90 exitCode=1 91 fi 92 rm -rf OUT.TXT ${RMIREG_OUT} rmi_tmp 93 exit ${exitCode} 94 95