jjg@1361: /* jjg@1361: * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. jjg@1361: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jjg@1361: * jjg@1361: * This code is free software; you can redistribute it and/or modify it jjg@1361: * under the terms of the GNU General Public License version 2 only, as jjg@1361: * published by the Free Software Foundation. jjg@1361: * jjg@1361: * This code is distributed in the hope that it will be useful, but WITHOUT jjg@1361: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jjg@1361: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jjg@1361: * version 2 for more details (a copy is included in the LICENSE file that jjg@1361: * accompanied this code). jjg@1361: * jjg@1361: * You should have received a copy of the GNU General Public License version jjg@1361: * 2 along with this work; if not, write to the Free Software Foundation, jjg@1361: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jjg@1361: * jjg@1361: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jjg@1361: * or visit www.oracle.com if you need additional information or have any jjg@1361: * questions. jjg@1361: */ jjg@1361: jjg@1361: /* jjg@1361: * @test jjg@1361: * @bug 8000418 jjg@1361: * @summary Verify that files use a common Generated By string jjg@1361: * @library ../lib/ jjg@1361: * @build JavadocTester TestGeneratedBy jjg@1361: * @run main TestGeneratedBy jjg@1361: */ jjg@1361: jjg@1361: public class TestGeneratedBy extends JavadocTester { jjg@1361: jjg@1361: private static final String OUTPUT_DIR = "tmp"; jjg@1361: jjg@1361: private static final String[] FILES = { jjg@1361: "pkg/MyClass.html", jjg@1361: "pkg/package-summary.html", jjg@1361: "pkg/package-frame.html", jjg@1361: "pkg/package-tree.html", jjg@1361: "allclasses-noframe.html", jjg@1361: "constant-values.html", jjg@1361: "allclasses-frame.html", jjg@1361: "overview-tree.html", jjg@1361: "deprecated-list.html", jjg@1361: "serialized-form.html", jjg@1361: "help-doc.html", jjg@1361: "index-all.html", jjg@1361: "index.html" jjg@1361: }; jjg@1361: jjg@1361: private static final String[] ARGS = jjg@1361: new String[] { jjg@1361: "-d", OUTPUT_DIR, jjg@1361: "-sourcepath", SRC_DIR, jjg@1361: "pkg" jjg@1361: }; jjg@1361: private static final String BUG_ID = "8000418"; jjg@1361: jjg@1361: private static String[][] getTests() { jjg@1361: String version = System.getProperty("java.version"); jjg@1361: String[][] tests = new String[FILES.length][]; jjg@1361: for (int i = 0; i < FILES.length; i++) { jjg@1361: tests[i] = new String[] { jjg@1361: OUTPUT_DIR + FS + FILES[i], jjg@1361: "Generated by javadoc (" + version + ") on " jjg@1361: }; jjg@1361: } jjg@1361: return tests; jjg@1361: } jjg@1361: jjg@1361: private static String[][] getNegatedTests() { jjg@1361: String[][] tests = new String[FILES.length][]; jjg@1361: for (int i = 0; i < FILES.length; i++) { jjg@1361: tests[i] = new String[] { jjg@1361: OUTPUT_DIR + FS + FILES[i], jjg@1361: "Generated by javadoc (version", jjg@1361: "Generated by javadoc on" jjg@1361: }; jjg@1361: } jjg@1361: return tests; jjg@1361: } jjg@1361: jjg@1361: /** jjg@1361: * The entry point of the test. jjg@1361: * @param args the array of command line arguments. jjg@1361: */ jjg@1361: public static void main(String[] args) { jjg@1361: TestGeneratedBy tester = new TestGeneratedBy(); jjg@1361: int exitCode = run(tester, ARGS, getTests(), getNegatedTests()); jjg@1361: tester.printSummary(); jjg@1361: if (exitCode != 0) { jjg@1361: throw new Error("Error found while executing Javadoc"); jjg@1361: } jjg@1361: } jjg@1361: jjg@1361: /** jjg@1361: * {@inheritDoc} jjg@1361: */ jjg@1361: public String getBugId() { jjg@1361: return BUG_ID; jjg@1361: } jjg@1361: jjg@1361: /** jjg@1361: * {@inheritDoc} jjg@1361: */ jjg@1361: public String getBugName() { jjg@1361: return getClass().getName(); jjg@1361: } jjg@1361: } jjg@1361: