author | jjg |
Tue, 22 Apr 2014 17:57:40 -0700 | |
changeset 24072 | e7549dcbc4af |
parent 24065 | fc4022e50129 |
child 24399 | af1a0220d0fa |
permissions | -rw-r--r-- |
10 | 1 |
/* |
23971 | 2 |
* Copyright (c) 2002, 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 |
|
20257
9da4f6c30089
8016328: Regression : Javadoc i18n regression caused by fix for 8012375
bpatel
parents:
14060
diff
changeset
|
26 |
* @bug 4496290 4985072 7006178 7068595 8016328 |
10 | 27 |
* @summary A simple test to determine if -use works. |
28 |
* @author jamieh |
|
29 |
* @library ../lib/ |
|
30 |
* @build JavadocTester |
|
31 |
* @build TestUseOption |
|
32 |
* @run main TestUseOption |
|
33 |
*/ |
|
34 |
||
35 |
public class TestUseOption extends JavadocTester { |
|
36 |
||
37 |
//Input for string search tests. |
|
38 |
private static final String[] TEST2 = { |
|
39 |
"Field in C1.", |
|
40 |
"Field in C2.", |
|
41 |
"Field in C4.", |
|
42 |
"Field in C5.", |
|
43 |
"Field in C6.", |
|
44 |
"Field in C7.", |
|
45 |
"Field in C8.", |
|
46 |
"Method in C1.", |
|
47 |
"Method in C2.", |
|
48 |
"Method in C4.", |
|
49 |
"Method in C5.", |
|
50 |
"Method in C6.", |
|
51 |
"Method in C7.", |
|
52 |
"Method in C8.", |
|
53 |
}; |
|
54 |
||
8841
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
55 |
private static final String[][] TEST3 = { |
24072 | 56 |
{ "class-use/UsedInC.html", |
57 |
"Uses of <a href=\"../UsedInC.html\" title=\"class in <Unnamed>\">" + |
|
58 |
"UsedInC</a> in <a href=\"../package-summary.html\"><Unnamed></a>" |
|
8841
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
59 |
}, |
24072 | 60 |
{ "package-use.html", |
61 |
"<td class=\"colOne\">" + |
|
62 |
"<a href=\"class-use/UsedInC.html#%3CUnnamed%3E\">UsedInC</a> </td>" |
|
8841
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
63 |
} |
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
64 |
}; |
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
65 |
|
14060
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
66 |
private static final String[][] TEST4 = { |
24072 | 67 |
{ "pkg2/class-use/C3.html", |
68 |
"<a href=\"../../index.html?pkg2/class-use/C3.html\" target=\"_top\">" + |
|
69 |
"Frames</a></li>" |
|
14060
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
70 |
} |
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
71 |
}; |
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
72 |
|
10 | 73 |
private static final String[] ARGS = new String[] { |
24072 | 74 |
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2" |
10 | 75 |
}; |
76 |
||
77 |
private static final String[] ARGS2 = new String[] { |
|
24072 | 78 |
"-d", OUTPUT_DIR+"-2", "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2" |
10 | 79 |
}; |
80 |
||
8841
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
81 |
private static final String[] ARGS3 = new String[] { |
24072 | 82 |
"-d", OUTPUT_DIR + "-3", "-sourcepath", SRC_DIR, "-use", |
83 |
SRC_DIR + "/C.java", SRC_DIR + "/UsedInC.java" |
|
8841
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
84 |
}; |
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
85 |
|
14060
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
86 |
private static final String[] ARGS4 = new String[] { |
24072 | 87 |
"-d", OUTPUT_DIR + "-4", "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2" |
14060
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
88 |
}; |
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
89 |
|
10 | 90 |
/** |
91 |
* The entry point of the test. |
|
92 |
* @param args the array of command line arguments. |
|
93 |
*/ |
|
94 |
public static void main(String[] args) throws Exception { |
|
95 |
String[][] tests = new String[11][2]; |
|
96 |
//Eight tests for class use. |
|
97 |
for (int i = 0; i < 8; i++) { |
|
24072 | 98 |
tests[i][0] = "pkg1/class-use/C1.html"; |
10 | 99 |
tests[i][1] = "Test " + (i + 1) + " passes"; |
100 |
} |
|
101 |
//Three more tests for package use. |
|
102 |
for (int i = 8, j = 1; i < tests.length; i++, j++) { |
|
24072 | 103 |
tests[i][0] = "pkg1/package-use.html"; |
10 | 104 |
tests[i][1] = "Test " + j + " passes"; |
105 |
} |
|
106 |
TestUseOption tester = new TestUseOption(); |
|
24065
fc4022e50129
8041150: Avoid silly use of static methods in JavadocTester
jjg
parents:
23971
diff
changeset
|
107 |
tester.run(ARGS, tests, NO_TEST); |
10 | 108 |
tester.printSummary(); |
24065
fc4022e50129
8041150: Avoid silly use of static methods in JavadocTester
jjg
parents:
23971
diff
changeset
|
109 |
tester.run(ARGS2, NO_TEST, NO_TEST); |
24072 | 110 |
String usePageContents = tester.readFileToString("pkg1/class-use/UsedClass.html"); |
10 | 111 |
int prevIndex = -1; |
112 |
int currentIndex = -1; |
|
113 |
for (int i = 0; i < TEST2.length; i++) { |
|
114 |
currentIndex = usePageContents.indexOf(TEST2[i]); |
|
115 |
System.err.println(TEST2[i] + " at index " + currentIndex); |
|
116 |
if (currentIndex < prevIndex) |
|
117 |
throw new Exception(TEST2[i] + " is in the wrong order."); |
|
118 |
prevIndex = currentIndex; |
|
119 |
} |
|
120 |
tester.printSummary(); |
|
24065
fc4022e50129
8041150: Avoid silly use of static methods in JavadocTester
jjg
parents:
23971
diff
changeset
|
121 |
tester.run(ARGS3, TEST3, NO_TEST); |
fc4022e50129
8041150: Avoid silly use of static methods in JavadocTester
jjg
parents:
23971
diff
changeset
|
122 |
tester.run(ARGS4, TEST4, NO_TEST); |
8841
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
123 |
tester.printSummary(); |
10 | 124 |
} |
125 |
} |