author | ksrini |
Tue, 24 Dec 2013 09:17:37 -0800 | |
changeset 22448 | a85fbad9d687 |
parent 19920 | ead15bfdcfa0 |
child 23971 | f5ff1f5a8dee |
permissions | -rw-r--r-- |
14262
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
1 |
/* |
19920
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
2 |
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
14262
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
4 |
* |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
8 |
* |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
13 |
* accompanied this code). |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
14 |
* |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
18 |
* |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
21 |
* questions. |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
22 |
*/ |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
23 |
|
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
24 |
/* |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
25 |
* @test |
19920
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
26 |
* @bug 8000418 8024288 |
14262
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
27 |
* @summary Verify that files use a common Generated By string |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
28 |
* @library ../lib/ |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
29 |
* @build JavadocTester TestGeneratedBy |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
30 |
* @run main TestGeneratedBy |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
31 |
*/ |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
32 |
|
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
33 |
public class TestGeneratedBy extends JavadocTester { |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
34 |
|
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
35 |
private static final String OUTPUT_DIR = "tmp"; |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
36 |
|
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
37 |
private static final String[] FILES = { |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
38 |
"pkg/MyClass.html", |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
39 |
"pkg/package-summary.html", |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
40 |
"pkg/package-frame.html", |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
41 |
"pkg/package-tree.html", |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
42 |
"allclasses-noframe.html", |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
43 |
"constant-values.html", |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
44 |
"allclasses-frame.html", |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
45 |
"overview-tree.html", |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
46 |
"deprecated-list.html", |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
47 |
"serialized-form.html", |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
48 |
"help-doc.html", |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
49 |
"index-all.html", |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
50 |
"index.html" |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
51 |
}; |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
52 |
|
19920
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
53 |
private static final String[] STD_ARGS = |
14262
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
54 |
new String[] { |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
55 |
"-d", OUTPUT_DIR, |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
56 |
"-sourcepath", SRC_DIR, |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
57 |
"pkg" |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
58 |
}; |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
59 |
|
19920
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
60 |
private static final String[] NO_TIMESTAMP_ARGS = |
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
61 |
new String[] { |
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
62 |
"-notimestamp", |
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
63 |
"-d", OUTPUT_DIR, |
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
64 |
"-sourcepath", SRC_DIR, |
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
65 |
"pkg" |
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
66 |
}; |
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
67 |
|
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
68 |
private static final String BUG_ID = "8000418-8024288"; |
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
69 |
|
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
70 |
private static String[][] getTests(boolean timestamp) { |
14262
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
71 |
String version = System.getProperty("java.version"); |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
72 |
String[][] tests = new String[FILES.length][]; |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
73 |
for (int i = 0; i < FILES.length; i++) { |
19920
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
74 |
String genBy = "Generated by javadoc"; |
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
75 |
if (timestamp) genBy += " (" + version + ") on "; |
14262
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
76 |
tests[i] = new String[] { |
19920
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
77 |
OUTPUT_DIR + FS + FILES[i], genBy |
14262
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
78 |
}; |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
79 |
} |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
80 |
return tests; |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
81 |
} |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
82 |
|
19920
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
83 |
private static String[][] getNegatedTests(boolean timestamp) { |
14262
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
84 |
String[][] tests = new String[FILES.length][]; |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
85 |
for (int i = 0; i < FILES.length; i++) { |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
86 |
tests[i] = new String[] { |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
87 |
OUTPUT_DIR + FS + FILES[i], |
19920
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
88 |
(timestamp |
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
89 |
? "Generated by javadoc (version" |
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
90 |
: "Generated by javadoc ("), |
14262
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
91 |
"Generated by javadoc on" |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
92 |
}; |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
93 |
} |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
94 |
return tests; |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
95 |
} |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
96 |
|
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
97 |
/** |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
98 |
* The entry point of the test. |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
99 |
* @param args the array of command line arguments. |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
100 |
*/ |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
101 |
public static void main(String[] args) { |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
102 |
TestGeneratedBy tester = new TestGeneratedBy(); |
19920
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
103 |
int ec1 = run(tester, STD_ARGS, getTests(true), getNegatedTests(true)); |
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
104 |
int ec2 = run(tester, NO_TIMESTAMP_ARGS, getTests(false), getNegatedTests(false)); |
14262
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
105 |
tester.printSummary(); |
19920
ead15bfdcfa0
8024288: javadoc generated-by comment should always be present
jjg
parents:
14262
diff
changeset
|
106 |
if (ec1 != 0 || ec2 != 0) { |
14262
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
107 |
throw new Error("Error found while executing Javadoc"); |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
108 |
} |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
109 |
} |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
110 |
|
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
111 |
/** |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
112 |
* {@inheritDoc} |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
113 |
*/ |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
114 |
public String getBugId() { |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
115 |
return BUG_ID; |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
116 |
} |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
117 |
|
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
118 |
/** |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
119 |
* {@inheritDoc} |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
120 |
*/ |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
121 |
public String getBugName() { |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
122 |
return getClass().getName(); |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
123 |
} |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
124 |
} |
058238ba531e
8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents:
diff
changeset
|
125 |