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