1 /*
   2  * Copyright 2003-2004 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug      4852280 4517115 4973608 4994589
  27  * @summary  Perform tests on index.html file.
  28  *           Also test that index-all.html has the appropriate output.
  29  *           Test for unnamed package in index.
  30  * @author   jamieh
  31  * @library  ../lib/
  32  * @build    JavadocTester
  33  * @build    TestIndex
  34  * @run main TestIndex
  35  */
  36 
  37 public class TestIndex extends JavadocTester {
  38 
  39     //Test information.
  40     private static final String BUG_ID = "4852280-4517115-4973608-4994589";
  41 
  42     //Javadoc arguments.
  43     private static final String[] ARGS = new String[] {
  44         "-d", BUG_ID, "-source", "1.5", "-sourcepath", SRC_DIR, "pkg", SRC_DIR + FS + "NoPackage.java"
  45     };
  46 
  47     //Input for string search tests.
  48     private static final String[][] TEST = {
  49         //Make sure the horizontal scroll bar does not appear in class frame.
  50         {BUG_ID + FS + "index.html",
  51             "<FRAME src=\"overview-summary.html\" name=\"classFrame\" " +
  52             "title=\"Package, class and interface descriptions\" " +
  53             "scrolling=\"yes\">"},
  54 
  55         //Test index-all.html
  56         {BUG_ID + FS + "index-all.html",
  57             "<A HREF=\"./pkg/C.html\" title=\"class in pkg\"><STRONG>C</STRONG></A>" +
  58             " - Class in <A HREF=\"./pkg/package-summary.html\">pkg</A>"},
  59         {BUG_ID + FS + "index-all.html",
  60             "<A HREF=\"./pkg/Interface.html\" title=\"interface in pkg\">" +
  61             "<STRONG>Interface</STRONG></A> - Interface in " +
  62             "<A HREF=\"./pkg/package-summary.html\">pkg</A>"},
  63         {BUG_ID + FS + "index-all.html",
  64             "<A HREF=\"./pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
  65             "<STRONG>AnnotationType</STRONG></A> - Annotation Type in " +
  66             "<A HREF=\"./pkg/package-summary.html\">pkg</A>"},
  67         {BUG_ID + FS + "index-all.html",
  68             "<A HREF=\"./pkg/Coin.html\" title=\"enum in pkg\">" +
  69             "<STRONG>Coin</STRONG></A> - Enum in " +
  70             "<A HREF=\"./pkg/package-summary.html\">pkg</A>"},
  71         {BUG_ID + FS + "index-all.html",
  72             "Class in <A HREF=\"./package-summary.html\">&lt;Unnamed&gt;</A>"},
  73         {BUG_ID + FS + "index-all.html",
  74             "<DT><A HREF=\"./pkg/C.html#Java\"><STRONG>Java</STRONG></A> - " + NL +
  75             "Static variable in class pkg.<A HREF=\"./pkg/C.html\" title=\"class in pkg\">C</A>" + NL +
  76             "</DT><DD>&nbsp;</DD>" + NL + NL +
  77             "<DT><A HREF=\"./pkg/C.html#JDK\"><STRONG>JDK</STRONG></A> - " + NL +
  78             "Static variable in class pkg.<A HREF=\"./pkg/C.html\" title=\"class in pkg\">C</A>" + NL +
  79             "</DT><DD>&nbsp;</DD>"},
  80     };
  81     private static final String[][] NEGATED_TEST = NO_TEST;
  82 
  83     /**
  84      * The entry point of the test.
  85      * @param args the array of command line arguments.
  86      */
  87     public static void main(String[] args) {
  88         TestIndex tester = new TestIndex();
  89         run(tester, ARGS, TEST, NEGATED_TEST);
  90         tester.printSummary();
  91     }
  92 
  93     /**
  94      * {@inheritDoc}
  95      */
  96     public String getBugId() {
  97         return BUG_ID;
  98     }
  99 
 100     /**
 101      * {@inheritDoc}
 102      */
 103     public String getBugName() {
 104         return getClass().getName();
 105     }
 106 }