test/com/sun/javadoc/testGeneratedBy/TestGeneratedBy.java

Wed, 28 Nov 2012 14:07:26 -0800

author
katleman
date
Wed, 28 Nov 2012 14:07:26 -0800
changeset 1425
20230f8b0eef
parent 1361
6517bf8e50d0
child 2006
044721d4d359
permissions
-rw-r--r--

Merge

     1 /*
     2  * Copyright (c) 2012, Oracle and/or its affiliates. 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 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.
    22  */
    24 /*
    25  * @test
    26  * @bug 8000418
    27  * @summary Verify that files use a common Generated By string
    28  * @library ../lib/
    29  * @build JavadocTester TestGeneratedBy
    30  * @run main TestGeneratedBy
    31  */
    33 public class TestGeneratedBy extends JavadocTester {
    35     private static final String OUTPUT_DIR = "tmp";
    37     private static final String[] FILES = {
    38         "pkg/MyClass.html",
    39         "pkg/package-summary.html",
    40         "pkg/package-frame.html",
    41         "pkg/package-tree.html",
    42         "allclasses-noframe.html",
    43         "constant-values.html",
    44         "allclasses-frame.html",
    45         "overview-tree.html",
    46         "deprecated-list.html",
    47         "serialized-form.html",
    48         "help-doc.html",
    49         "index-all.html",
    50         "index.html"
    51     };
    53     private static final String[] ARGS =
    54         new String[] {
    55             "-d", OUTPUT_DIR,
    56             "-sourcepath", SRC_DIR,
    57             "pkg"
    58         };
    59     private static final String BUG_ID = "8000418";
    61     private static String[][] getTests() {
    62         String version = System.getProperty("java.version");
    63         String[][] tests = new String[FILES.length][];
    64         for (int i = 0; i < FILES.length; i++) {
    65             tests[i] = new String[] {
    66                 OUTPUT_DIR + FS + FILES[i],
    67                 "Generated by javadoc (" + version + ") on "
    68             };
    69         }
    70         return tests;
    71     }
    73     private static String[][] getNegatedTests() {
    74         String[][] tests = new String[FILES.length][];
    75         for (int i = 0; i < FILES.length; i++) {
    76             tests[i] = new String[] {
    77                 OUTPUT_DIR + FS + FILES[i],
    78                 "Generated by javadoc (version",
    79                 "Generated by javadoc on"
    80             };
    81         }
    82         return tests;
    83     }
    85     /**
    86      * The entry point of the test.
    87      * @param args the array of command line arguments.
    88      */
    89     public static void main(String[] args) {
    90         TestGeneratedBy tester = new TestGeneratedBy();
    91         int exitCode = run(tester, ARGS, getTests(), getNegatedTests());
    92         tester.printSummary();
    93         if (exitCode != 0) {
    94             throw new Error("Error found while executing Javadoc");
    95         }
    96     }
    98     /**
    99      * {@inheritDoc}
   100      */
   101     public String getBugId() {
   102         return BUG_ID;
   103     }
   105     /**
   106      * {@inheritDoc}
   107      */
   108     public String getBugName() {
   109         return getClass().getName();
   110     }
   111 }

mercurial