author | pmuthuswamy |
Wed, 30 Jan 2019 16:39:26 +0530 | |
changeset 53562 | 0d9dee001667 |
parent 53391 | a99bd2570660 |
child 54350 | 4f9772f4403d |
permissions | -rw-r--r-- |
10 | 1 |
/* |
53391
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
2 |
* Copyright (c) 2003, 2019, 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 |
|
50293
edfb87b2520e
8196202: Javadoc should not generate frames by default
jjg
parents:
49139
diff
changeset
|
26 |
* @bug 4460354 8014636 8043186 8195805 8182765 8196202 |
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 |
|
53097 | 30 |
* @library ../../lib |
36526 | 31 |
* @modules jdk.javadoc/jdk.javadoc.internal.tool |
53097 | 32 |
* @build javadoc.tester.* |
10 | 33 |
* @run main TestRelativeLinks |
34 |
*/ |
|
35 |
||
53391
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
36 |
import java.io.File; |
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
37 |
import java.io.FileOutputStream; |
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
38 |
import java.io.IOException; |
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
39 |
|
53097 | 40 |
import javadoc.tester.JavadocTester; |
41 |
||
10 | 42 |
public class TestRelativeLinks extends JavadocTester { |
43 |
||
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
44 |
public static void main(String... args) throws Exception { |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
45 |
TestRelativeLinks tester = new TestRelativeLinks(); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
46 |
tester.runTests(); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
47 |
} |
10 | 48 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
49 |
@Test |
53097 | 50 |
public void test() { |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
51 |
javadoc("-d", "out", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
52 |
"-use", |
50293
edfb87b2520e
8196202: Javadoc should not generate frames by default
jjg
parents:
49139
diff
changeset
|
53 |
"--frames", |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
54 |
"-sourcepath", testSrc, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
55 |
"pkg", "pkg2"); |
49139
771616d26ca1
8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents:
48655
diff
changeset
|
56 |
checkExit(Exit.ERROR); |
771616d26ca1
8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents:
48655
diff
changeset
|
57 |
|
771616d26ca1
8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents:
48655
diff
changeset
|
58 |
checkOutput(Output.OUT, true, |
771616d26ca1
8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents:
48655
diff
changeset
|
59 |
"attribute not supported in HTML5: name"); |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
60 |
|
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
61 |
// These relative paths should stay relative because they appear |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
62 |
// in the right places. |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
63 |
checkOutput("pkg/C.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
64 |
"<a href=\"relative-class-link.html\">relative class link</a>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
65 |
"<a href=\"relative-field-link.html\">relative field link</a>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
66 |
"<a href=\"relative-method-link.html\">relative method link</a>", |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
67 |
" <a href=\"relative-multi-line-link.html\">relative-multi-line-link</a>."); |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
68 |
checkOutput("pkg/package-summary.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
69 |
"<a href=\"relative-package-link.html\">relative package link</a>"); |
10 | 70 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
71 |
// These relative paths should be redirected because they are in different |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
72 |
// places. |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
73 |
|
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
74 |
// INDEX PAGE |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
75 |
checkOutput("index-all.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
76 |
"<a href=\"./pkg/relative-class-link.html\">relative class link</a>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
77 |
"<a href=\"./pkg/relative-field-link.html\">relative field link</a>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
78 |
"<a href=\"./pkg/relative-method-link.html\">relative method link</a>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
79 |
"<a href=\"./pkg/relative-package-link.html\">relative package link</a>", |
48655
e1876e6b57b6
8195805: Doclet incorrectly updates all attributes in <a> tags when relocating links
jjg
parents:
47216
diff
changeset
|
80 |
" <a href=\"./pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."); |
e1876e6b57b6
8195805: Doclet incorrectly updates all attributes in <a> tags when relocating links
jjg
parents:
47216
diff
changeset
|
81 |
|
e1876e6b57b6
8195805: Doclet incorrectly updates all attributes in <a> tags when relocating links
jjg
parents:
47216
diff
changeset
|
82 |
// This is not a relative path and should not be redirected. |
e1876e6b57b6
8195805: Doclet incorrectly updates all attributes in <a> tags when relocating links
jjg
parents:
47216
diff
changeset
|
83 |
checkOutput("index-all.html", true, |
e1876e6b57b6
8195805: Doclet incorrectly updates all attributes in <a> tags when relocating links
jjg
parents:
47216
diff
changeset
|
84 |
"<div class=\"block\"><a name=\"masters\"></a>"); |
e1876e6b57b6
8195805: Doclet incorrectly updates all attributes in <a> tags when relocating links
jjg
parents:
47216
diff
changeset
|
85 |
checkOutput("index-all.html", false, |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
86 |
"<div class=\"block\"><a name=\"./pkg/masters\"></a>"); |
10 | 87 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
88 |
// PACKAGE USE |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
89 |
checkOutput("pkg/package-use.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
90 |
"<a href=\"../pkg/relative-package-link.html\">relative package link</a>.", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
91 |
"<a href=\"../pkg/relative-class-link.html\">relative class link</a>"); |
10 | 92 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
93 |
// CLASS_USE |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
94 |
checkOutput("pkg/class-use/C.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
95 |
"<a href=\"../../pkg/relative-field-link.html\">relative field link</a>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
96 |
"<a href=\"../../pkg/relative-method-link.html\">relative method link</a>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
97 |
"<a href=\"../../pkg/relative-package-link.html\">relative package link</a>", |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
30730
diff
changeset
|
98 |
" <a href=\"../../pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."); |
10 | 99 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
100 |
// PACKAGE OVERVIEW |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
101 |
checkOutput("overview-summary.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
102 |
"<a href=\"./pkg/relative-package-link.html\">relative package link</a>"); |
10 | 103 |
} |
49139
771616d26ca1
8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents:
48655
diff
changeset
|
104 |
|
53391
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
105 |
private void touch(String file) { |
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
106 |
File f = new File(outputDir, file); |
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
107 |
out.println("touch " + f); |
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
108 |
try (FileOutputStream fos = new FileOutputStream(f)) { |
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
109 |
} catch (IOException e) { |
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
110 |
checking("Touch file"); |
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
111 |
failed("Error creating file: " + e); |
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
112 |
} |
a99bd2570660
8217034: JavadocTester should check for missing files by default
jjg
parents:
53097
diff
changeset
|
113 |
} |
10 | 114 |
} |