|
1 /* |
|
2 * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. |
|
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 * |
|
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 * have any questions. |
|
22 */ |
|
23 |
|
24 /* |
|
25 * @test |
|
26 * @bug 4766385 |
|
27 * @summary Test that the header option for upper left frame |
|
28 * is present for three sets of options: (1) -header, |
|
29 * (2) -packagesheader, and (3) -header -packagesheader |
|
30 * @author dkramer |
|
31 * @library ../lib/ |
|
32 * @build JavadocTester |
|
33 * @build PackagesHeader |
|
34 * @run main PackagesHeader |
|
35 */ |
|
36 |
|
37 public class PackagesHeader extends JavadocTester { |
|
38 |
|
39 //Test information. |
|
40 private static final String BUG_ID = "4766385"; |
|
41 private static final String OUTPUT_DIR = "docs-" + BUG_ID; |
|
42 |
|
43 private static final String OUTPUT_DIR1 = "docs1-" + BUG_ID + FS; |
|
44 private static final String OUTPUT_DIR2 = "docs2-" + BUG_ID + FS; |
|
45 private static final String OUTPUT_DIR3 = "docs3-" + BUG_ID + FS; |
|
46 |
|
47 /** |
|
48 * Assign value for [ fileToSearch, stringToFind ] |
|
49 */ |
|
50 private static final String[][] TESTARRAY1 = { |
|
51 |
|
52 // Test that the -header shows up in the packages frame |
|
53 { OUTPUT_DIR1 + "overview-frame.html", |
|
54 "Main Frame Header" } |
|
55 }; |
|
56 |
|
57 private static final String[][] TESTARRAY2 = { |
|
58 |
|
59 // Test that the -packagesheader string shows |
|
60 // up in the packages frame |
|
61 |
|
62 { OUTPUT_DIR2 + "overview-frame.html", |
|
63 "Packages Frame Header" } |
|
64 }; |
|
65 |
|
66 private static final String[][] TESTARRAY3 = { |
|
67 |
|
68 // Test that the both headers show up and are different |
|
69 |
|
70 { OUTPUT_DIR3 + "overview-frame.html", |
|
71 "Packages Frame Header" }, |
|
72 |
|
73 { OUTPUT_DIR3 + "overview-summary.html", |
|
74 "Main Frame Header" } |
|
75 }; |
|
76 |
|
77 // First test with -header only |
|
78 private static final String[] JAVADOC_ARGS1 = new String[] { |
|
79 "-d", OUTPUT_DIR1, |
|
80 "-header", "Main Frame Header", |
|
81 "-sourcepath", SRC_DIR, |
|
82 "p1", "p2"}; |
|
83 |
|
84 // Second test with -packagesheader only |
|
85 private static final String[] JAVADOC_ARGS2 = new String[] { |
|
86 "-d", OUTPUT_DIR2, |
|
87 "-packagesheader", "Packages Frame Header", |
|
88 "-sourcepath", SRC_DIR, |
|
89 "p1", "p2"}; |
|
90 |
|
91 // Third test with both -packagesheader and -header |
|
92 private static final String[] JAVADOC_ARGS3 = new String[] { |
|
93 "-d", OUTPUT_DIR3, |
|
94 "-packagesheader", "Packages Frame Header", |
|
95 "-header", "Main Frame Header", |
|
96 "-sourcepath", SRC_DIR, |
|
97 "p1", "p2"}; |
|
98 |
|
99 |
|
100 //Input for string search tests. |
|
101 private static final String[][] NEGATED_TEST = NO_TEST; |
|
102 |
|
103 /** |
|
104 * The entry point of the test. |
|
105 * @param args the array of command line arguments. |
|
106 */ |
|
107 public static void main(String[] args) { |
|
108 JavadocTester tester = new PackagesHeader(); |
|
109 |
|
110 run(tester, JAVADOC_ARGS1, TESTARRAY1, NEGATED_TEST); |
|
111 run(tester, JAVADOC_ARGS2, TESTARRAY2, NEGATED_TEST); |
|
112 run(tester, JAVADOC_ARGS3, TESTARRAY3, NEGATED_TEST); |
|
113 |
|
114 tester.printSummary(); |
|
115 } |
|
116 |
|
117 /** |
|
118 * {@inheritDoc} |
|
119 */ |
|
120 public String getBugId() { |
|
121 return BUG_ID; |
|
122 } |
|
123 |
|
124 /** |
|
125 * {@inheritDoc} |
|
126 */ |
|
127 public String getBugName() { |
|
128 return getClass().getName(); |
|
129 } |
|
130 } |