1 # 2 # Copyright (c) 2011, 2012, 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 # @library ../../testlibrary 27 # @build TestLibrary 28 # @summary remove java.rmi.server.codebase property parsing from registyimpl 29 # @run shell readTest.sh 30 31 OS=`uname -s` 32 case "$OS" in 33 SunOS | Linux | Darwin ) 34 PS=":" 35 FS="/" 36 FILEURL="file:" 37 ;; 38 Windows* ) 39 PS=";" 40 FS="\\" 41 FILEURL="file:/" 42 ;; 43 CYGWIN* ) 44 PS=";" 45 FS="/" 46 FILEURL="file:/" 47 ;; 48 * ) 49 echo "Unrecognized system!" 50 exit 1; 51 ;; 52 esac 53 54 TEST_CLASSPATH=.$PS${TESTCLASSPATH:-$TESTCLASSES} 55 cp -r ${TESTSRC}${FS}* . 56 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} testPkg${FS}*java 57 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -cp $TEST_CLASSPATH readTest.java 58 59 mkdir rmi_tmp 60 RMIREG_OUT=rmi.out 61 #start rmiregistry without any local classes on classpath 62 cd rmi_tmp 63 # NOTE: This RMI Registry port must match TestLibrary.READTEST_REGISTRY_PORT 64 ${TESTJAVA}${FS}bin${FS}rmiregistry -J-Djava.rmi.server.useCodebaseOnly=false \ 65 ${TESTTOOLVMOPTS} 64005 > ..${FS}${RMIREG_OUT} 2>&1 & 66 RMIREG_PID=$! 67 # allow some time to start 68 sleep 3 69 cd .. 70 71 case "$OS" in 72 CYGWIN* ) 73 CODEBASE=`cygpath -w $PWD` 74 ;; 75 * ) 76 CODEBASE=`pwd` 77 ;; 78 esac 79 # trailing / after code base is important for rmi codebase property. 80 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp $TEST_CLASSPATH -Djava.rmi.server.codebase=${FILEURL}$CODEBASE/ readTest > OUT.TXT 2>&1 & 81 TEST_PID=$! 82 #bulk of testcase - let it run for a while 83 sleep 5 84 85 #we're done, kill processes first 86 kill -9 ${RMIREG_PID} ${TEST_PID} 87 sleep 3 88 89 echo "Test output : " 90 91 cat OUT.TXT 92 echo "==============" 93 echo "rmiregistry output : " 94 cat ${RMIREG_OUT} 95 echo "==============" 96 97 grep "Server ready" OUT.TXT 98 result1=$? 99 grep "Test passed" OUT.TXT 100 result2=$? 101 102 if [ $result1 -eq 0 -a $result2 -eq 0 ] 103 then 104 echo "Passed" 105 exitCode=0; 106 else 107 echo "Failed" 108 exitCode=1 109 fi 110 rm -rf OUT.TXT ${RMIREG_OUT} rmi_tmp 111 exit ${exitCode} 112 113