--- /dev/null 2015-03-19 19:58:11.000000000 -0500 +++ new/test/javax/accessibility/AccessibilityProvider/basic.sh 2015-03-19 19:58:10.597993100 -0500 @@ -0,0 +1,99 @@ +# +# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# @test +# @bug 8055160 +# @summary Unit test for javax.accessibility.AccessibilitySPI +# +# @build Load FooProvider +# @build Load BarProvider +# @build Load UnusedProvider +# @run shell basic.sh +# +# Command-line usage: sh basic.sh /path/to/build + +if [ -z "$TESTJAVA" ]; then + if [ $# -lt 1 ]; then exit 1; fi + TESTJAVA="$1" + TESTSRC=`pwd` + TESTCLASSES="`pwd`" +fi + +JAVA="$TESTJAVA/bin/java" + +OS=`uname -s` +case "$OS" in + SunOS | Darwin | AIX ) + FS='/' + SEP=':' ;; + Linux ) + FS='/' + SEP=':' ;; + * ) + FS='\\' + SEP='\;' ;; +esac + +TESTD=x.test +rm -rf $TESTD +mkdir -p $TESTD + +mv $TESTCLASSES/FooProvider.class $TESTD +mv $TESTCLASSES/BarProvider.class $TESTD +mv $TESTCLASSES/UnusedProvider.class $TESTD +mkdir -p $TESTD/META-INF/services +echo FooProvider >$TESTD/META-INF/services/javax.accessibility.AccessibilityProvider +echo BarProvider >>$TESTD/META-INF/services/javax.accessibility.AccessibilityProvider +echo UnusedProvider >>$TESTD/META-INF/services/javax.accessibility.AccessibilityProvider + + +failures=0 + +go() { + echo '' + CP="$TESTCLASSES$SEP$TESTD" + sh -xc "'$JAVA' $SECURITY_MANAGER $PROVIDER $TESTVMOPTS -cp $CP Load $1" 2>&1 + if [ $? != 0 ]; then failures=`expr $failures + 1`; fi +} + +# find one provider +PROVIDER="-Djavax.accessibility.assistive_technologies=FooProvider" +go + +# find two providers +PROVIDER="-Djavax.accessibility.assistive_technologies=FooProvider,BarProvider" +go + +#find provider, using security manager +SECURITY_MANAGER="-Djava.security.manager -Djava.security.policy==$TESTSRC/accessibilityProvider.sp" +go + +#fail if no provider +PROVIDER="-Djavax.accessibility.assistive_technologies=NoProvider" +go fail + +echo '' +if [ $failures -gt 0 ]; + then echo "$failures case(s) failed"; + else echo "All cases passed"; fi +exit $failures +