author | bpatel |
Fri, 18 Oct 2013 16:34:42 -0700 | |
changeset 21478 | fa4c7cda1b41 |
parent 9083 | 63f3c4d2d992 |
child 23971 | f5ff1f5a8dee |
permissions | -rw-r--r-- |
10 | 1 |
/* |
21478
fa4c7cda1b41
8026567: Use meaningful style names for strong and italic styles.
bpatel
parents:
9083
diff
changeset
|
2 |
* Copyright (c) 2002, 2013, 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 |
|
21478
fa4c7cda1b41
8026567: Use meaningful style names for strong and italic styles.
bpatel
parents:
9083
diff
changeset
|
26 |
* @bug 4720957 5020118 8026567 |
10 | 27 |
* @summary Test to make sure that -link and -linkoffline link to |
28 |
* right files. |
|
29 |
* @author jamieh |
|
30 |
* @library ../lib/ |
|
9083
63f3c4d2d992
7010344: Some of the html files do not have element <a> in right context.
bpatel
parents:
7681
diff
changeset
|
31 |
* @build JavadocTester TestLinkOption |
10 | 32 |
* @run main TestLinkOption |
33 |
*/ |
|
34 |
||
35 |
public class TestLinkOption extends JavadocTester { |
|
36 |
||
37 |
private static final String BUG_ID = "4720957-5020118"; |
|
38 |
||
39 |
//Generate the documentation using -linkoffline and a URL as the first parameter. |
|
40 |
private static final String[] ARGS1 = new String[] { |
|
41 |
"-d", BUG_ID + "-1", "-sourcepath", SRC_DIR, |
|
42 |
"-linkoffline", "http://java.sun.com/j2se/1.4/docs/api/", |
|
43 |
SRC_DIR, "-package", "pkg", "java.lang" |
|
44 |
}; |
|
45 |
||
46 |
private static final String[][] TEST1 = { |
|
47 |
{BUG_ID + "-1" + FS + "pkg" + FS + "C.html", |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
48 |
"<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true\" " + |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
49 |
"title=\"class or interface in java.lang\"><code>Link to String Class</code></a>" |
10 | 50 |
}, |
51 |
//Make sure the parameters are indented properly when the -link option is used. |
|
52 |
{BUG_ID + "-1" + FS + "pkg" + FS + "C.html", |
|
53 |
"(int p1," + NL + |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
54 |
" int p2," + NL + |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
55 |
" int p3)" |
10 | 56 |
}, |
57 |
{BUG_ID + "-1" + FS + "pkg" + FS + "C.html", |
|
58 |
"(int p1," + NL + |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
59 |
" int p2," + NL + |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
60 |
" <a href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\">" + |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
61 |
"Object</a> p3)" |
10 | 62 |
}, |
63 |
{BUG_ID + "-1" + FS + "java" + FS + "lang" + FS + "StringBuilderChild.html", |
|
21478
fa4c7cda1b41
8026567: Use meaningful style names for strong and italic styles.
bpatel
parents:
9083
diff
changeset
|
64 |
"<pre>public abstract class <span class=\"typeNameLabel\">StringBuilderChild</span>" + NL + |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
65 |
"extends <a href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" " + |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
66 |
"title=\"class or interface in java.lang\">Object</a></pre>" |
10 | 67 |
}, |
68 |
||
69 |
}; |
|
70 |
private static final String[][] NEGATED_TEST1 = NO_TEST; |
|
71 |
||
72 |
//Generate the documentation using -linkoffline and a relative path as the first parameter. |
|
73 |
//We will try linking to the docs generated in test 1 with a relative path. |
|
74 |
private static final String[] ARGS2 = new String[] { |
|
75 |
"-d", BUG_ID + "-2", "-sourcepath", SRC_DIR, |
|
76 |
"-linkoffline", "../" + BUG_ID + "-1", BUG_ID + "-1", "-package", "pkg2" |
|
77 |
}; |
|
78 |
||
79 |
private static final String[][] TEST2 = { |
|
80 |
{BUG_ID + "-2" + FS + "pkg2" + FS + "C2.html", |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
81 |
"This is a link to <a href=\"../../" + BUG_ID + "-1/pkg/C.html?is-external=true\" " + |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
82 |
"title=\"class or interface in pkg\"><code>Class C</code></a>." |
10 | 83 |
} |
84 |
}; |
|
85 |
private static final String[][] NEGATED_TEST2 = NO_TEST; |
|
86 |
||
87 |
/** |
|
88 |
* The entry point of the test. |
|
89 |
* @param args the array of command line arguments. |
|
90 |
*/ |
|
91 |
public static void main(String[] args) { |
|
92 |
TestLinkOption tester = new TestLinkOption(); |
|
93 |
run(tester, ARGS1, TEST1, NEGATED_TEST1); |
|
94 |
run(tester, ARGS2, TEST2, NEGATED_TEST2); |
|
95 |
tester.printSummary(); |
|
96 |
} |
|
97 |
||
98 |
/** |
|
99 |
* {@inheritDoc} |
|
100 |
*/ |
|
101 |
public String getBugId() { |
|
102 |
return BUG_ID; |
|
103 |
} |
|
104 |
||
105 |
/** |
|
106 |
* {@inheritDoc} |
|
107 |
*/ |
|
108 |
public String getBugName() { |
|
109 |
return getClass().getName(); |
|
110 |
} |
|
111 |
} |