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 
  24 # @test
  25 # @bug 8044767 8139067
  26 # @summary Test case for having resource bundles in a local named module
  27 #          with no ResourceBundleProviders.
  28 
  29 
  30 set -e
  31 
  32 if [ -z "$TESTJAVA" ]; then
  33   if [ $# -lt 1 ]; then exit 1; fi
  34   TESTJAVA="$1"; shift
  35   COMPILEJAVA="${TESTJAVA}"
  36   TESTSRC="`pwd`"
  37   TESTCLASSES="`pwd`"
  38 fi
  39 
  40 JAVAC="$COMPILEJAVA/bin/javac"
  41 JAR="$COMPILEJAVA/bin/jar"
  42 JAVA="$TESTJAVA/bin/java"
  43 
  44 rm -rf mods
  45 mkdir -p mods/test
  46 
  47 #
  48 # Copy .properties files
  49 #
  50 PROPS="`(cd $TESTSRC/src; find . -name '*.properties')`"
  51 if [ "x$PROPS" != x ]; then
  52     for P in $PROPS
  53     do
  54       D=`dirname $P`
  55       mkdir -p mods/$D
  56       cp $TESTSRC/src/$P mods/$D/
  57     done
  58 fi
  59 
  60 $JAVAC -g -d mods -modulesourcepath $TESTSRC/src \
  61        -cp mods/bundles `find $TESTSRC/src/test -name "*.java"`
  62 
  63 # Create a jar to be added to the class path. Expected properties files are
  64 # picked up from the class path.
  65 rm -f extra.jar
  66 mkdir -p classes
  67 $JAR -cf extra.jar -C $TESTSRC/src/extra jdk/test/resources
  68 
  69 STATUS=0
  70 
  71 echo 'jdk.test.Main should load bundles local to named module "test".'
  72 $JAVA -mp mods -m test/jdk.test.Main de fr ja zh-tw en de || STATUS=1
  73 
  74 echo "jdk.test.Main should NOT load bundles from the jar file specified by the class-path."
  75 $JAVA -cp extra.jar -mp mods -m test/jdk.test.Main vi && STATUS=1
  76 
  77 exit $STATUS