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 # @summary Test of JNDI factories using classes exported by third-party modules. 26 27 # Demonstrates Java object storage/retrieval, LDAP control and URL context 28 # usage using an LDAP directory. The objects and their associated object 29 # factories, state factories, control factories and URL context factories 30 # are exported from third-party modules. 31 # 32 # Seven types of object are used: 33 # - an AWT object (Serializable) from the 'java.desktop' JDK module 34 # - a Person object (DirContext) from the 'person' third-party module 35 # - a Fruit object (Referenceable) from the 'fruit' third-party module 36 # - an RMI object (Remote) from the 'hello' third-party module 37 # - an LDAP request control (Control) from the 'foo' third-party module 38 # - an LDAP response control (Control) from the 'authz' third-party module 39 # - an ldapv4 URL (DirContext) from the 'ldapv4' third-party module 40 # 41 42 set -e 43 44 if [ -z "$TESTJAVA" ]; then 45 if [ $# -lt 1 ]; then exit 1; fi 46 TESTJAVA="$1"; shift 47 COMPILEJAVA="${TESTJAVA}" 48 TESTSRC="`pwd`" 49 TESTCLASSES="`pwd`" 50 fi 51 52 JAVAC="$COMPILEJAVA/bin/javac" 53 JAVA="$TESTJAVA/bin/java" 54 55 echo "\nPreparing the 'person' module..." 56 mkdir -p mods/person 57 $JAVAC -d mods/person `find $TESTSRC/src/person -name "*.java"` 58 59 echo "\nPreparing the 'fruit' module..." 60 mkdir -p mods/fruit 61 $JAVAC -d mods/fruit `find $TESTSRC/src/fruit -name "*.java"` 62 63 echo "\nPreparing the 'hello' module..." 64 mkdir -p mods/hello 65 $JAVAC -d mods/hello `find $TESTSRC/src/hello -name "*.java"` 66 67 echo "\nPreparing the 'foo' module..." 68 mkdir -p mods/foo 69 $JAVAC -d mods/foo `find $TESTSRC/src/foo -name "*.java"` 70 71 echo "\nPreparing the 'authz' module..." 72 mkdir -p mods/authz 73 $JAVAC -d mods/authz `find $TESTSRC/src/authz -name "*.java"` 74 75 echo "\nPreparing the 'ldapv4' module..." 76 mkdir -p mods/ldapv4 77 $JAVAC -d mods/ldapv4 `find $TESTSRC/src/ldapv4 -name "*.java"` 78 79 echo "\nPreparing the 'test' module..." 80 mkdir -p mods/test 81 $JAVAC -d mods --module-source-path $TESTSRC/src `find $TESTSRC/src/test -name "*.java"` 82 83 84 echo "\nRunning with the 'java.desktop' module..." 85 $JAVA -Dtest.src=${TESTSRC} -p mods -m test/test.StoreObject ldap://localhost/dc=ie,dc=oracle,dc=com 86 87 echo "\nRunning with the 'person' module..." 88 $JAVA -Dtest.src=${TESTSRC} -p mods -m test/test.StorePerson ldap://localhost/dc=ie,dc=oracle,dc=com 89 90 echo "\nRunning with the 'fruit' module..." 91 $JAVA -Dtest.src=${TESTSRC} -p mods -m test/test.StoreFruit ldap://localhost/dc=ie,dc=oracle,dc=com 92 93 echo "\nRunning with the 'hello' module..." 94 $JAVA -Dtest.src=${TESTSRC} -p mods -m test/test.StoreRemote ldap://localhost/dc=ie,dc=oracle,dc=com 95 96 echo "\nRunning with the 'foo' module..." 97 $JAVA -Dtest.src=${TESTSRC} -p mods -m test/test.ConnectWithFoo ldap://localhost/dc=ie,dc=oracle,dc=com 98 99 echo "\nRunning with the 'authz' module..." 100 $JAVA -Dtest.src=${TESTSRC} -p mods -m test/test.ConnectWithAuthzId ldap://localhost/dc=ie,dc=oracle,dc=com 101 102 echo "\nRunning with the 'ldapv4' module..." 103 $JAVA -Dtest.src=${TESTSRC} -p mods -m test/test.ReadByUrl ldap://localhost/dc=ie,dc=oracle,dc=com 104