test/java/rmi/registry/readTest/readTest.sh

Print this page


   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=$?
   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* | CYGWIN* )
  39     PS=";"
  40     FS="\\"
  41     FILEURL="file:/"
  42     ;;
  43   * )
  44     echo "Unrecognized system!"
  45     exit 1;
  46     ;;
  47 esac
  48 
  49 TEST_CLASSPATH=.:$TESTCLASSES
  50 cp -r ${TESTSRC}${FS}* .
  51 ${TESTJAVA}${FS}bin${FS}javac testPkg${FS}*java
  52 ${TESTJAVA}${FS}bin${FS}javac -cp $TEST_CLASSPATH readTest.java
  53 
  54 mkdir rmi_tmp
  55 RMIREG_OUT=rmi.out
  56 #start rmiregistry without any local classes on classpath
  57 cd rmi_tmp
  58 # NOTE: This RMI Registry port must match TestLibrary.READTEST_REGISTRY_PORT
  59 ${TESTJAVA}${FS}bin${FS}rmiregistry 64005 > ..${FS}${RMIREG_OUT} 2>&1 &
  60 RMIREG_PID=$!
  61 # allow some time to start
  62 sleep 3
  63 cd ..
  64 
  65 # trailing / after code base is important for rmi codebase property.
  66 ${TESTJAVA}${FS}bin${FS}java -cp $TEST_CLASSPATH -Djava.rmi.server.codebase=${FILEURL}`pwd`/ readTest > OUT.TXT 2>&1 &
  67 TEST_PID=$!
  68 #bulk of testcase - let it run for a while
  69 sleep 5
  70 
  71 #we're done, kill processes first
  72 kill -9 ${RMIREG_PID} ${TEST_PID}
  73 sleep 3
  74 
  75 echo "Test output : "
  76 
  77 cat OUT.TXT
  78 echo "=============="
  79 echo "rmiregistry output  : "
  80 cat ${RMIREG_OUT}
  81 echo "=============="
  82 
  83 grep "Server ready" OUT.TXT
  84 result1=$?
  85 grep "Test passed" OUT.TXT
  86 result2=$?