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