blob: 1f731662b5fa10222c3ebc5fd10a4e618bbaf2ae [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001#!/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
33echo "TESTJAVA=${TESTJAVA}"
34echo "TESTSRC=${TESTSRC}"
35echo "TESTCLASSES=${TESTCLASSES}"
36
37echo "Wait until 5 applets have initialised and started and display string"
38echo "messages. Applet 0 and Applet 2 should find one less print service"
39echo "than the rest."
40echo "Specifically all except Applets 0 and 2 should find a service called"
41echo "Applet N printer where N is the number of the applet. They should NOT"
42echo "find Applet M printer (where M != N)."
43
44OS=`uname -s`
45
46SEP="/"
47OS=`uname -s`
48case "$OS" in
49 Win* )
50 echo "WINDOWS"
51 SEP="\\"
52 ;;
53 * )
54 ;;
55esac
56
57JAVAC_CMD=${TESTJAVA}${SEP}bin${SEP}javac
58
59(cd ${TESTSRC} ; ${JAVAC_CMD} -d ${TESTCLASSES} YesNo.java)
60
61mkdir -p ${TESTCLASSES}${SEP}applet0
62(cd ${TESTSRC}${SEP}applet0 ; ${JAVAC_CMD} -d ${TESTCLASSES}${SEP}applet0 Applet0.java)
63
64mkdir -p ${TESTCLASSES}${SEP}applet1
65(cd ${TESTSRC}${SEP}applet1 ; ${JAVAC_CMD} -d ${TESTCLASSES}${SEP}applet1 Applet1.java Applet1PrintService.java Applet1PrintServiceLookup.java)
66rm -rf ${TESTCLASSES}${SEP}applet1/META-INF/services
67mkdir -p ${TESTCLASSES}${SEP}applet1/META-INF/services
68cp -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
71mkdir -p ${TESTCLASSES}${SEP}applet2
72(cd ${TESTSRC}${SEP}applet2 ; ${JAVAC_CMD} -d ${TESTCLASSES}${SEP}applet2 Applet2.java Applet2PrintService.java Applet2PrintServiceLookup.java)
73
74mkdir -p ${TESTCLASSES}${SEP}applet3
75(cd ${TESTSRC}${SEP}applet3 ; ${JAVAC_CMD} -d ${TESTCLASSES}${SEP}applet3 Applet3.java Applet3PrintService.java)
76
77mkdir -p ${TESTCLASSES}${SEP}applet4
78(cd ${TESTSRC}${SEP}applet4 ; ${JAVAC_CMD} -d ${TESTCLASSES}${SEP}applet4 Applet4.java Applet4PrintService.java Applet4PrintServiceLookup.java)
79
80cp ${TESTSRC}${SEP}AppletPrintLookup.html ${TESTCLASSES}
81
82${TESTJAVA}${SEP}bin${SEP}appletviewer ${TESTCLASSES}${SEP}AppletPrintLookup.html &
83
84cd ${TESTCLASSES}
85${TESTJAVA}${SEP}bin${SEP}java YesNo
86 if [ $? -ne 0 ]
87 then
88 echo "Test fails!"
89 exit 1
90 fi
91
92echo "Test passes."
93exit 0