Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/print/applet/AppletPrintLookup.sh
38838 views
#!/bin/sh12#3# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.4# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.5#6# This code is free software; you can redistribute it and/or modify it7# under the terms of the GNU General Public License version 2 only, as8# published by the Free Software Foundation.9#10# This code is distributed in the hope that it will be useful, but WITHOUT11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13# version 2 for more details (a copy is included in the LICENSE file that14# accompanied this code).15#16# You should have received a copy of the GNU General Public License version17# 2 along with this work; if not, write to the Free Software Foundation,18# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19#20# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21# or visit www.oracle.com if you need additional information or have any22# questions.23#2425#26# @test27# @bug 4457046 659290628# @summary checks that applets can lookup print services and will not29# see services registered by other applets from difference code bases.30# @run shell/manual AppletPrintLookup.sh3132echo "TESTJAVA=${TESTJAVA}"33echo "TESTSRC=${TESTSRC}"34echo "TESTCLASSES=${TESTCLASSES}"3536echo "Wait until 5 applets have initialised and started and display string"37echo "messages. Applet 0 and Applet 2 should find one less print service"38echo "than the rest."39echo "Specifically all except Applets 0 and 2 should find a service called"40echo "Applet N printer where N is the number of the applet. They should NOT"41echo "find Applet M printer (where M != N)."4243OS=`uname -s`4445SEP="/"46OS=`uname -s`47case "$OS" in48Win* )49echo "WINDOWS"50SEP="\\"51;;52* )53;;54esac5556JAVAC_CMD=${TESTJAVA}${SEP}bin${SEP}javac5758(cd ${TESTSRC} ; ${JAVAC_CMD} -d ${TESTCLASSES} YesNo.java)5960mkdir -p ${TESTCLASSES}${SEP}applet061(cd ${TESTSRC}${SEP}applet0 ; ${JAVAC_CMD} -d ${TESTCLASSES}${SEP}applet0 Applet0.java)6263mkdir -p ${TESTCLASSES}${SEP}applet164(cd ${TESTSRC}${SEP}applet1 ; ${JAVAC_CMD} -d ${TESTCLASSES}${SEP}applet1 Applet1.java Applet1PrintService.java Applet1PrintServiceLookup.java)65rm -rf ${TESTCLASSES}${SEP}applet1/META-INF/services66mkdir -p ${TESTCLASSES}${SEP}applet1/META-INF/services67cp -p ${TESTSRC}${SEP}applet1/META-INF/services/javax.print.PrintServiceLookup ${TESTCLASSES}${SEP}applet1/META-INF/services68(cd ${TESTCLASSES}${SEP}applet1 ; ${TESTJAVA}${SEP}bin${SEP}jar -cf applet1.jar *.class META-INF)6970mkdir -p ${TESTCLASSES}${SEP}applet271(cd ${TESTSRC}${SEP}applet2 ; ${JAVAC_CMD} -d ${TESTCLASSES}${SEP}applet2 Applet2.java Applet2PrintService.java Applet2PrintServiceLookup.java)7273mkdir -p ${TESTCLASSES}${SEP}applet374(cd ${TESTSRC}${SEP}applet3 ; ${JAVAC_CMD} -d ${TESTCLASSES}${SEP}applet3 Applet3.java Applet3PrintService.java)7576mkdir -p ${TESTCLASSES}${SEP}applet477(cd ${TESTSRC}${SEP}applet4 ; ${JAVAC_CMD} -d ${TESTCLASSES}${SEP}applet4 Applet4.java Applet4PrintService.java Applet4PrintServiceLookup.java)7879cp ${TESTSRC}${SEP}AppletPrintLookup.html ${TESTCLASSES}8081${TESTJAVA}${SEP}bin${SEP}appletviewer ${TESTCLASSES}${SEP}AppletPrintLookup.html &8283cd ${TESTCLASSES}84${TESTJAVA}${SEP}bin${SEP}java ${TESTVMOPTS} YesNo85if [ $? -ne 0 ]86then87echo "Test fails!"88exit 189fi9091echo "Test passes."92exit 0939495