1 # 2 # Copyright (c) 2015, 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 # @test 24 # @bug 8055160 25 # @summary Unit test for javax.accessibility.AccessibilitySPI 26 # 27 # @build Load FooProvider 28 # @run shell basic.sh 29 # 30 # Command-line usage: sh basic.sh /path/to/build 31 32 if [ -z "$TESTJAVA" ]; then 33 if [ $# -lt 1 ]; then exit 1; fi 34 TESTJAVA="$1" 35 TESTCLASSES="`pwd`" 36 fi 37 38 JAVA="$TESTJAVA/bin/java" 39 40 OS=`uname -s` 41 case "$OS" in 42 SunOS | Darwin | AIX ) 43 FS='/' 44 SEP=':' ;; 45 Linux ) 46 FS='/' 47 SEP=':' ;; 48 * ) 49 FS='\\' 50 SEP='\;' ;; 51 esac 52 53 TESTD=x.test 54 rm -rf $TESTD 55 mkdir -p $TESTD 56 57 mv $TESTCLASSES/FooProvider.class $TESTD 58 mkdir -p $TESTD/META-INF/services 59 echo FooProvider >$TESTD/META-INF/services/javax.accessibility.AccessibilitySPI 60 61 failures=0 62 63 go() { 64 echo '' 65 CP="$TESTCLASSES$SEP$TESTD" 66 sh -xc "'$JAVA' $SECURITY_MANAGER $PROVIDER $TESTVMOPTS -cp $CP Load $1" 2>&1 67 if [ $? != 0 ]; then failures=`expr $failures + 1`; fi 68 } 69 70 # find provider 71 PROVIDER="-Djavax.accessibility.assistive_technologies=FooProvider" 72 go 73 74 #find provider, using security manager 75 SECURITY_MANAGER="-Djava.security.manager" 76 go 77 78 #fail if no provider 79 PROVIDER="-Djavax.accessibility.assistive_technologies=NoProvider" 80 go fail 81 82 echo '' 83 if [ $failures -gt 0 ]; 84 then echo "$failures case(s) failed"; 85 else echo "All cases passed"; fi 86 exit $failures 87