author | janvalenta |
Thu, 27 Jun 2013 17:47:18 +0200 | |
changeset 18659 | 5fe5650da7f9 |
parent 14060 | ae69cea86e83 |
child 20257 | 9da4f6c30089 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
14060
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
2 |
* Copyright (c) 2002, 2012, 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 |
|
14060
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
26 |
* @bug 4496290 4985072 7006178 7068595 |
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 |
||
14060
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
37 |
private static final String BUG_ID = "4496290-4985072-7006178-7068595"; |
10 | 38 |
|
39 |
//Input for string search tests. |
|
40 |
private static final String[] TEST2 = { |
|
41 |
"Field in C1.", |
|
42 |
"Field in C2.", |
|
43 |
"Field in C4.", |
|
44 |
"Field in C5.", |
|
45 |
"Field in C6.", |
|
46 |
"Field in C7.", |
|
47 |
"Field in C8.", |
|
48 |
"Method in C1.", |
|
49 |
"Method in C2.", |
|
50 |
"Method in C4.", |
|
51 |
"Method in C5.", |
|
52 |
"Method in C6.", |
|
53 |
"Method in C7.", |
|
54 |
"Method in C8.", |
|
55 |
}; |
|
56 |
||
8841
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
57 |
private static final String[][] TEST3 = { |
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
58 |
{BUG_ID + "-3" + FS + "class-use" + FS + "UsedInC.html", "Uses of <a href=" + |
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
59 |
"\"../UsedInC.html\" title=\"class in <Unnamed>\">" + |
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
60 |
"UsedInC</a> in <a href=\"../package-summary.html\"><Unnamed></a>" |
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
61 |
}, |
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
62 |
{BUG_ID + "-3" + FS + "package-use.html", "<td class=\"colOne\">" + |
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
63 |
"<a href=\"class-use/UsedInC.html#<Unnamed>\">UsedInC</a> </td>" |
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 |
}; |
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
66 |
|
14060
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
67 |
private static final String[][] TEST4 = { |
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
68 |
{BUG_ID + "-4" + FS + "pkg2" + FS + "class-use" + FS + "C3.html", "<a href=" + |
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
69 |
"\"../../index.html?pkg2/class-use/C3.html\" target=\"_top\">" + |
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
70 |
"Frames</a></li>" |
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 |
}; |
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
73 |
|
10 | 74 |
private static final String[] ARGS = new String[] { |
75 |
"-d", BUG_ID, "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2" |
|
76 |
}; |
|
77 |
||
78 |
private static final String[] ARGS2 = new String[] { |
|
79 |
"-d", BUG_ID+"-2", "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2" |
|
80 |
}; |
|
81 |
||
8841
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
82 |
private static final String[] ARGS3 = new String[] { |
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
83 |
"-d", BUG_ID + "-3", "-sourcepath", SRC_DIR, "-use", SRC_DIR + FS + "C.java", SRC_DIR + FS + "UsedInC.java" |
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[] { |
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
87 |
"-d", BUG_ID + "-4", "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2" |
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++) { |
|
98 |
tests[i][0] = BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html"; |
|
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++) { |
|
103 |
tests[i][0] = BUG_ID + FS + "pkg1" + FS + "package-use.html"; |
|
104 |
tests[i][1] = "Test " + j + " passes"; |
|
105 |
} |
|
106 |
TestUseOption tester = new TestUseOption(); |
|
107 |
run(tester, ARGS, tests, NO_TEST); |
|
108 |
tester.printSummary(); |
|
109 |
run(tester, ARGS2, NO_TEST, NO_TEST); |
|
110 |
String usePageContents = tester.readFileToString(BUG_ID +"-2" + FS + "pkg1" + FS + "class-use" + FS + "UsedClass.html"); |
|
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(); |
|
8841
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
121 |
run(tester, ARGS3, TEST3, NO_TEST); |
14060
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
122 |
run(tester, 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 |
||
126 |
/** |
|
127 |
* {@inheritDoc} |
|
128 |
*/ |
|
129 |
public String getBugId() { |
|
130 |
return BUG_ID; |
|
131 |
} |
|
132 |
||
133 |
/** |
|
134 |
* {@inheritDoc} |
|
135 |
*/ |
|
136 |
public String getBugName() { |
|
137 |
return getClass().getName(); |
|
138 |
} |
|
139 |
} |