10
|
1 |
/*
|
23971
|
2 |
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
|
10
|
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 |
*
|
5520
|
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.
|
10
|
22 |
*/
|
|
23 |
|
|
24 |
/*
|
|
25 |
* @test
|
19119
|
26 |
* @bug 4460354 8014636
|
10
|
27 |
* @summary Test to make sure that relative paths are redirected in the
|
|
28 |
* output so that they are not broken.
|
|
29 |
* @author jamieh
|
|
30 |
* @library ../lib/
|
|
31 |
* @build JavadocTester
|
|
32 |
* @build TestRelativeLinks
|
|
33 |
* @run main TestRelativeLinks
|
|
34 |
*/
|
|
35 |
|
|
36 |
public class TestRelativeLinks extends JavadocTester {
|
|
37 |
|
|
38 |
//Javadoc arguments.
|
|
39 |
private static final String[] ARGS = new String[] {
|
24072
|
40 |
"-d", OUTPUT_DIR, "-use", "-sourcepath", SRC_DIR, "pkg", "pkg2"
|
10
|
41 |
};
|
|
42 |
|
|
43 |
//Input for string search tests.
|
|
44 |
private static final String[][] TEST = {
|
|
45 |
//These relative paths should stay relative because they appear
|
|
46 |
//in the right places.
|
24072
|
47 |
{ "pkg/C.html",
|
10
|
48 |
"<a href=\"relative-class-link.html\">relative class link</a>"},
|
24072
|
49 |
{ "pkg/C.html",
|
10
|
50 |
"<a href=\"relative-field-link.html\">relative field link</a>"},
|
24072
|
51 |
{ "pkg/C.html",
|
10
|
52 |
"<a href=\"relative-method-link.html\">relative method link</a>"},
|
24072
|
53 |
{ "pkg/package-summary.html",
|
10
|
54 |
"<a href=\"relative-package-link.html\">relative package link</a>"},
|
24072
|
55 |
{ "pkg/C.html",
|
23971
|
56 |
" <a\n" +
|
10
|
57 |
" href=\"relative-multi-line-link.html\">relative-multi-line-link</a>."},
|
|
58 |
|
|
59 |
//These relative paths should be redirected because they are in different
|
|
60 |
//places.
|
|
61 |
|
|
62 |
//INDEX PAGE
|
24072
|
63 |
{ "index-all.html",
|
10
|
64 |
"<a href=\"./pkg/relative-class-link.html\">relative class link</a>"},
|
24072
|
65 |
{ "index-all.html",
|
10
|
66 |
"<a href=\"./pkg/relative-field-link.html\">relative field link</a>"},
|
24072
|
67 |
{ "index-all.html",
|
10
|
68 |
"<a href=\"./pkg/relative-method-link.html\">relative method link</a>"},
|
24072
|
69 |
{ "index-all.html",
|
10
|
70 |
"<a href=\"./pkg/relative-package-link.html\">relative package link</a>"},
|
24072
|
71 |
{ "index-all.html",
|
23971
|
72 |
" <a\n" +
|
10
|
73 |
" href=\"./pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."},
|
|
74 |
|
|
75 |
|
|
76 |
//PACKAGE USE
|
24072
|
77 |
{ "pkg/package-use.html",
|
10
|
78 |
"<a href=\"../pkg/relative-package-link.html\">relative package link</a>."},
|
24072
|
79 |
{ "pkg/package-use.html",
|
10
|
80 |
"<a href=\"../pkg/relative-class-link.html\">relative class link</a>"},
|
|
81 |
|
|
82 |
//CLASS_USE
|
24072
|
83 |
{ "pkg/class-use/C.html",
|
10
|
84 |
"<a href=\"../../pkg/relative-field-link.html\">relative field link</a>"},
|
24072
|
85 |
{ "pkg/class-use/C.html",
|
10
|
86 |
"<a href=\"../../pkg/relative-method-link.html\">relative method link</a>"},
|
24072
|
87 |
{ "pkg/class-use/C.html",
|
10
|
88 |
"<a href=\"../../pkg/relative-package-link.html\">relative package link</a>"},
|
24072
|
89 |
{ "pkg/class-use/C.html",
|
23971
|
90 |
" <a\n" +
|
10
|
91 |
" href=\"../../pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."},
|
|
92 |
|
|
93 |
//PACKAGE OVERVIEW
|
24072
|
94 |
{ "overview-summary.html",
|
10
|
95 |
"<a href=\"./pkg/relative-package-link.html\">relative package link</a>"},
|
|
96 |
};
|
|
97 |
|
|
98 |
/**
|
|
99 |
* The entry point of the test.
|
|
100 |
* @param args the array of command line arguments.
|
|
101 |
*/
|
|
102 |
public static void main(String[] args) {
|
|
103 |
TestRelativeLinks tester = new TestRelativeLinks();
|
24071
|
104 |
tester.run(ARGS, TEST, NO_TEST);
|
10
|
105 |
tester.printSummary();
|
|
106 |
}
|
|
107 |
}
|