J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | |
| 3 | # |
| 4 | # Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. |
| 5 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 6 | # |
| 7 | # This code is free software; you can redistribute it and/or modify it |
| 8 | # under the terms of the GNU General Public License version 2 only, as |
| 9 | # published by the Free Software Foundation. |
| 10 | # |
| 11 | # This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | # version 2 for more details (a copy is included in the LICENSE file that |
| 15 | # accompanied this code). |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License version |
| 18 | # 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | # |
| 21 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | # CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | # have any questions. |
| 24 | # |
| 25 | |
| 26 | # |
| 27 | # @test |
| 28 | # @bug 4457046 6592906 |
| 29 | # @summary checks that applets can lookup print services and will not |
| 30 | # see services registered by other applets from difference code bases. |
| 31 | # @run shell/manual AppletPrintLookup.sh |
| 32 | |
| 33 | echo "TESTJAVA=${TESTJAVA}" |
| 34 | echo "TESTSRC=${TESTSRC}" |
| 35 | echo "TESTCLASSES=${TESTCLASSES}" |
| 36 | |
| 37 | echo "Wait until 5 applets have initialised and started and display string" |
| 38 | echo "messages. Applet 0 and Applet 2 should find one less print service" |
| 39 | echo "than the rest." |
| 40 | echo "Specifically all except Applets 0 and 2 should find a service called" |
| 41 | echo "Applet N printer where N is the number of the applet. They should NOT" |
| 42 | echo "find Applet M printer (where M != N)." |
| 43 | |
| 44 | OS=`uname -s` |
| 45 | |
| 46 | SEP="/" |
| 47 | OS=`uname -s` |
| 48 | case "$OS" in |
| 49 | Win* ) |
| 50 | echo "WINDOWS" |
| 51 | SEP="\\" |
| 52 | ;; |
| 53 | * ) |
| 54 | ;; |
| 55 | esac |
| 56 | |
| 57 | JAVAC_CMD=${TESTJAVA}${SEP}bin${SEP}javac |
| 58 | |
| 59 | (cd ${TESTSRC} ; ${JAVAC_CMD} -d ${TESTCLASSES} YesNo.java) |
| 60 | |
| 61 | mkdir -p ${TESTCLASSES}${SEP}applet0 |
| 62 | (cd ${TESTSRC}${SEP}applet0 ; ${JAVAC_CMD} -d ${TESTCLASSES}${SEP}applet0 Applet0.java) |
| 63 | |
| 64 | mkdir -p ${TESTCLASSES}${SEP}applet1 |
| 65 | (cd ${TESTSRC}${SEP}applet1 ; ${JAVAC_CMD} -d ${TESTCLASSES}${SEP}applet1 Applet1.java Applet1PrintService.java Applet1PrintServiceLookup.java) |
| 66 | rm -rf ${TESTCLASSES}${SEP}applet1/META-INF/services |
| 67 | mkdir -p ${TESTCLASSES}${SEP}applet1/META-INF/services |
| 68 | cp -p ${TESTSRC}${SEP}applet1/META-INF/services/javax.print.PrintServiceLookup ${TESTCLASSES}${SEP}applet1/META-INF/services |
| 69 | (cd ${TESTCLASSES}${SEP}applet1 ; ${TESTJAVA}${SEP}bin${SEP}jar -cf applet1.jar *.class META-INF) |
| 70 | |
| 71 | mkdir -p ${TESTCLASSES}${SEP}applet2 |
| 72 | (cd ${TESTSRC}${SEP}applet2 ; ${JAVAC_CMD} -d ${TESTCLASSES}${SEP}applet2 Applet2.java Applet2PrintService.java Applet2PrintServiceLookup.java) |
| 73 | |
| 74 | mkdir -p ${TESTCLASSES}${SEP}applet3 |
| 75 | (cd ${TESTSRC}${SEP}applet3 ; ${JAVAC_CMD} -d ${TESTCLASSES}${SEP}applet3 Applet3.java Applet3PrintService.java) |
| 76 | |
| 77 | mkdir -p ${TESTCLASSES}${SEP}applet4 |
| 78 | (cd ${TESTSRC}${SEP}applet4 ; ${JAVAC_CMD} -d ${TESTCLASSES}${SEP}applet4 Applet4.java Applet4PrintService.java Applet4PrintServiceLookup.java) |
| 79 | |
| 80 | cp ${TESTSRC}${SEP}AppletPrintLookup.html ${TESTCLASSES} |
| 81 | |
| 82 | ${TESTJAVA}${SEP}bin${SEP}appletviewer ${TESTCLASSES}${SEP}AppletPrintLookup.html & |
| 83 | |
| 84 | cd ${TESTCLASSES} |
| 85 | ${TESTJAVA}${SEP}bin${SEP}java YesNo |
| 86 | if [ $? -ne 0 ] |
| 87 | then |
| 88 | echo "Test fails!" |
| 89 | exit 1 |
| 90 | fi |
| 91 | |
| 92 | echo "Test passes." |
| 93 | exit 0 |