|
1 /* |
|
2 * Copyright 2003-2004 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 * have any questions. |
|
22 */ |
|
23 |
|
24 /* |
|
25 * @test |
|
26 * @bug 4460354 |
|
27 * @summary Test to make sure that relative paths are redirected in the |
|
28 * output so that they are not broken. |
|
29 * NOTE: these tests have \\n instead of NL because they are user |
|
30 * generated new lines, not Java generated. |
|
31 * @author jamieh |
|
32 * @library ../lib/ |
|
33 * @build JavadocTester |
|
34 * @build TestRelativeLinks |
|
35 * @run main TestRelativeLinks |
|
36 */ |
|
37 |
|
38 public class TestRelativeLinks extends JavadocTester { |
|
39 |
|
40 //Test information. |
|
41 private static final String BUG_ID = "4460354"; |
|
42 |
|
43 //Javadoc arguments. |
|
44 private static final String[] ARGS = new String[] { |
|
45 "-d", BUG_ID, "-use", "-sourcepath", SRC_DIR, "pkg", "pkg2" |
|
46 }; |
|
47 |
|
48 //Input for string search tests. |
|
49 private static final String[][] TEST = { |
|
50 //These relative paths should stay relative because they appear |
|
51 //in the right places. |
|
52 {BUG_ID + FS + "pkg" + FS + "C.html", |
|
53 "<a href=\"relative-class-link.html\">relative class link</a>"}, |
|
54 {BUG_ID + FS + "pkg" + FS + "C.html", |
|
55 "<a href=\"relative-field-link.html\">relative field link</a>"}, |
|
56 {BUG_ID + FS + "pkg" + FS + "C.html", |
|
57 "<a href=\"relative-method-link.html\">relative method link</a>"}, |
|
58 {BUG_ID + FS + "pkg" + FS + "package-summary.html", |
|
59 "<a href=\"relative-package-link.html\">relative package link</a>"}, |
|
60 {BUG_ID + FS + "pkg" + FS + "C.html", |
|
61 " <a\n" + |
|
62 " href=\"relative-multi-line-link.html\">relative-multi-line-link</a>."}, |
|
63 |
|
64 //These relative paths should be redirected because they are in different |
|
65 //places. |
|
66 |
|
67 //INDEX PAGE |
|
68 {BUG_ID + FS + "index-all.html", |
|
69 "<a href=\"./pkg/relative-class-link.html\">relative class link</a>"}, |
|
70 {BUG_ID + FS + "index-all.html", |
|
71 "<a href=\"./pkg/relative-field-link.html\">relative field link</a>"}, |
|
72 {BUG_ID + FS + "index-all.html", |
|
73 "<a href=\"./pkg/relative-method-link.html\">relative method link</a>"}, |
|
74 {BUG_ID + FS + "index-all.html", |
|
75 "<a href=\"./pkg/relative-package-link.html\">relative package link</a>"}, |
|
76 {BUG_ID + FS + "index-all.html", |
|
77 " <a\n" + |
|
78 " href=\"./pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."}, |
|
79 |
|
80 |
|
81 //PACKAGE USE |
|
82 {BUG_ID + FS + "pkg" + FS + "package-use.html", |
|
83 "<a href=\"../pkg/relative-package-link.html\">relative package link</a>."}, |
|
84 {BUG_ID + FS + "pkg" + FS + "package-use.html", |
|
85 "<a href=\"../pkg/relative-class-link.html\">relative class link</a>"}, |
|
86 |
|
87 //CLASS_USE |
|
88 {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html", |
|
89 "<a href=\"../../pkg/relative-field-link.html\">relative field link</a>"}, |
|
90 {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html", |
|
91 "<a href=\"../../pkg/relative-method-link.html\">relative method link</a>"}, |
|
92 {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html", |
|
93 "<a href=\"../../pkg/relative-package-link.html\">relative package link</a>"}, |
|
94 {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html", |
|
95 " <a\n" + |
|
96 " href=\"../../pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."}, |
|
97 |
|
98 //PACKAGE OVERVIEW |
|
99 {BUG_ID + FS + "overview-summary.html", |
|
100 "<a href=\"./pkg/relative-package-link.html\">relative package link</a>"}, |
|
101 |
|
102 |
|
103 }; |
|
104 private static final String[][] NEGATED_TEST = NO_TEST; |
|
105 |
|
106 /** |
|
107 * The entry point of the test. |
|
108 * @param args the array of command line arguments. |
|
109 */ |
|
110 public static void main(String[] args) { |
|
111 TestRelativeLinks tester = new TestRelativeLinks(); |
|
112 run(tester, ARGS, TEST, NEGATED_TEST); |
|
113 tester.printSummary(); |
|
114 } |
|
115 |
|
116 /** |
|
117 * {@inheritDoc} |
|
118 */ |
|
119 public String getBugId() { |
|
120 return BUG_ID; |
|
121 } |
|
122 |
|
123 /** |
|
124 * {@inheritDoc} |
|
125 */ |
|
126 public String getBugName() { |
|
127 return getClass().getName(); |
|
128 } |
|
129 } |