test/com/sun/javadoc/PackagesHeader/PackagesHeader.java

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

author
katleman
date
Wed, 28 Nov 2012 14:07:26 -0800
changeset 1425
20230f8b0eef
parent 554
9d9f26857129
child 2525
2eb010b6cb22
permissions
-rw-r--r--

Merge

     1 /*
     2  * Copyright (c) 2002, 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      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  */
    37 public class PackagesHeader extends JavadocTester {
    39     //Test information.
    40     private static final String BUG_ID = "4766385";
    41     private static final String OUTPUT_DIR = "docs-" + BUG_ID;
    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;
    47     /**
    48      * Assign value for [ fileToSearch, stringToFind ]
    49      */
    50     private static final String[][] TESTARRAY1 = {
    52         // Test that the -header shows up in the packages frame
    53         { OUTPUT_DIR1 + "overview-frame.html",
    54                  "Main Frame Header" }
    55     };
    57     private static final String[][] TESTARRAY2 = {
    59         // Test that the -packagesheader string shows
    60         // up in the packages frame
    62         {  OUTPUT_DIR2 + "overview-frame.html",
    63                  "Packages Frame Header" }
    64     };
    66     private static final String[][] TESTARRAY3 = {
    68         // Test that the both headers show up and are different
    70         { OUTPUT_DIR3 + "overview-frame.html",
    71                  "Packages Frame Header" },
    73         { OUTPUT_DIR3 + "overview-summary.html",
    74                  "Main Frame Header" }
    75     };
    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"};
    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"};
    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"};
   100     //Input for string search tests.
   101     private static final String[][] NEGATED_TEST = NO_TEST;
   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();
   110         run(tester, JAVADOC_ARGS1, TESTARRAY1, NEGATED_TEST);
   111         run(tester, JAVADOC_ARGS2, TESTARRAY2, NEGATED_TEST);
   112         run(tester, JAVADOC_ARGS3, TESTARRAY3, NEGATED_TEST);
   114         tester.printSummary();
   115     }
   117     /**
   118      * {@inheritDoc}
   119      */
   120     public String getBugId() {
   121         return BUG_ID;
   122     }
   124     /**
   125      * {@inheritDoc}
   126      */
   127     public String getBugName() {
   128         return getClass().getName();
   129     }
   130 }

mercurial