author | wetmore |
Wed, 13 Apr 2011 16:12:49 -0700 | |
changeset 9267 | bbad6ad93743 |
parent 5506 | 202f599c92aa |
child 14786 | a9f61e0cbe61 |
permissions | -rw-r--r-- |
2 | 1 |
#!/bin/sh |
2 |
||
3 |
# |
|
9267
bbad6ad93743
6626257: Update SWAN-specific webcaching to Oracle environment in the regression tests.
wetmore
parents:
5506
diff
changeset
|
4 |
# Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. |
2 | 5 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6 |
# |
|
7 |
# This code is free software; you can redistribute it and/or modify it |
|
8 |
# under the terms of the GNU General Public License version 2 only, as |
|
9 |
# published by the Free Software Foundation. |
|
10 |
# |
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
# accompanied this code). |
|
16 |
# |
|
17 |
# You should have received a copy of the GNU General Public License version |
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
# |
|
5506 | 21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
# or visit www.oracle.com if you need additional information or have any |
|
23 |
# questions. |
|
2 | 24 |
# |
25 |
||
26 |
||
27 |
# @test |
|
28 |
# @bug 4763315 |
|
9267
bbad6ad93743
6626257: Update SWAN-specific webcaching to Oracle environment in the regression tests.
wetmore
parents:
5506
diff
changeset
|
29 |
# @build CanonicalName Lookup |
2 | 30 |
# @run shell/timeout=120 cname.sh |
31 |
# @summary Test DNS provider's handling of CNAME records |
|
32 |
||
33 |
||
34 |
# The host that we try to resolve |
|
35 |
||
9267
bbad6ad93743
6626257: Update SWAN-specific webcaching to Oracle environment in the regression tests.
wetmore
parents:
5506
diff
changeset
|
36 |
HOST=www-proxy.us.oracle.com |
2 | 37 |
|
9267
bbad6ad93743
6626257: Update SWAN-specific webcaching to Oracle environment in the regression tests.
wetmore
parents:
5506
diff
changeset
|
38 |
# fail gracefully if DNS is not configured or there |
2 | 39 |
# isn't a CNAME record. |
40 |
||
41 |
CLASSPATH=${TESTCLASSES} |
|
42 |
export CLASSPATH |
|
43 |
JAVA="${TESTJAVA}/bin/java" |
|
44 |
||
45 |
sh -xc "$JAVA CanonicalName $HOST" 2>&1 |
|
9267
bbad6ad93743
6626257: Update SWAN-specific webcaching to Oracle environment in the regression tests.
wetmore
parents:
5506
diff
changeset
|
46 |
if [ $? != 0 ]; then |
2 | 47 |
echo "DNS not configured or host doesn't resolve to CNAME record" |
48 |
exit 0 |
|
49 |
fi |
|
50 |
||
51 |
failures=0 |
|
52 |
||
53 |
go() { |
|
54 |
echo '' |
|
55 |
sh -xc "$JAVA $1 Lookup $2" 2>&1 |
|
56 |
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi |
|
57 |
} |
|
58 |
||
59 |
# Tests - with & without security manager |
|
60 |
||
61 |
POLICY=java.policy |
|
62 |
echo "grant {" > ${POLICY} |
|
63 |
echo " permission java.net.SocketPermission \"${HOST}\", \"resolve\";" >> ${POLICY} |
|
64 |
echo "};" >> ${POLICY} |
|
65 |
||
66 |
np="-Dsun.net.spi.nameservice.provider.1=dns,sun" |
|
67 |
sm="-Djava.security.manager -Djava.security.policy=${POLICY}" |
|
68 |
||
69 |
go "$np" "$HOST" |
|
70 |
go "$np $sm" "$HOST" |
|
71 |
||
72 |
||
9267
bbad6ad93743
6626257: Update SWAN-specific webcaching to Oracle environment in the regression tests.
wetmore
parents:
5506
diff
changeset
|
73 |
# |
2 | 74 |
# Results |
75 |
# |
|
76 |
echo '' |
|
77 |
if [ $failures -gt 0 ]; |
|
78 |
then echo "$failures test(s) failed"; |
|
79 |
else echo "All test(s) passed"; fi |
|
80 |
exit $failures |