test/com/sun/javadoc/testRelativeLinks/TestRelativeLinks.java

Tue, 28 Dec 2010 15:54:52 -0800

author
ohair
date
Tue, 28 Dec 2010 15:54:52 -0800
changeset 798
4868a36f6fd8
parent 554
9d9f26857129
child 1911
80e75aa6a707
permissions
-rw-r--r--

6962318: Update copyright year
Reviewed-by: xdono

     1 /*
     2  * Copyright (c) 2003, 2004, 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      4460354
    27  * @summary  Test to make sure that relative paths are redirected in the
    28  *           output so that they are not broken.
    29  *           NOTE: these tests have \\n instead of NL because they are user
    30  *           generated new lines, not Java generated.
    31  * @author   jamieh
    32  * @library  ../lib/
    33  * @build    JavadocTester
    34  * @build    TestRelativeLinks
    35  * @run main TestRelativeLinks
    36  */
    38 public class TestRelativeLinks extends JavadocTester {
    40     //Test information.
    41     private static final String BUG_ID = "4460354";
    43     //Javadoc arguments.
    44     private static final String[] ARGS = new String[] {
    45         "-d", BUG_ID, "-use", "-sourcepath", SRC_DIR, "pkg", "pkg2"
    46     };
    48     //Input for string search tests.
    49     private static final String[][] TEST = {
    50         //These relative paths should stay relative because they appear
    51         //in the right places.
    52         {BUG_ID + FS + "pkg" + FS + "C.html",
    53             "<a href=\"relative-class-link.html\">relative class link</a>"},
    54         {BUG_ID + FS + "pkg" + FS + "C.html",
    55             "<a href=\"relative-field-link.html\">relative field link</a>"},
    56         {BUG_ID + FS + "pkg" + FS + "C.html",
    57             "<a href=\"relative-method-link.html\">relative method link</a>"},
    58         {BUG_ID + FS + "pkg" + FS + "package-summary.html",
    59             "<a href=\"relative-package-link.html\">relative package link</a>"},
    60         {BUG_ID + FS + "pkg" + FS + "C.html",
    61             " <a\n" +
    62             " href=\"relative-multi-line-link.html\">relative-multi-line-link</a>."},
    64         //These relative paths should be redirected because they are in different
    65         //places.
    67         //INDEX PAGE
    68         {BUG_ID + FS + "index-all.html",
    69             "<a href=\"./pkg/relative-class-link.html\">relative class link</a>"},
    70         {BUG_ID + FS + "index-all.html",
    71             "<a href=\"./pkg/relative-field-link.html\">relative field link</a>"},
    72         {BUG_ID + FS + "index-all.html",
    73             "<a href=\"./pkg/relative-method-link.html\">relative method link</a>"},
    74         {BUG_ID + FS + "index-all.html",
    75             "<a href=\"./pkg/relative-package-link.html\">relative package link</a>"},
    76         {BUG_ID + FS + "index-all.html",
    77             " <a\n" +
    78             " href=\"./pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."},
    81         //PACKAGE USE
    82         {BUG_ID + FS + "pkg" + FS + "package-use.html",
    83             "<a href=\"../pkg/relative-package-link.html\">relative package link</a>."},
    84         {BUG_ID + FS + "pkg" + FS + "package-use.html",
    85             "<a href=\"../pkg/relative-class-link.html\">relative class link</a>"},
    87         //CLASS_USE
    88         {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html",
    89             "<a href=\"../../pkg/relative-field-link.html\">relative field link</a>"},
    90         {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html",
    91             "<a href=\"../../pkg/relative-method-link.html\">relative method link</a>"},
    92         {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html",
    93             "<a href=\"../../pkg/relative-package-link.html\">relative package link</a>"},
    94         {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html",
    95             " <a\n" +
    96             " href=\"../../pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."},
    98         //PACKAGE OVERVIEW
    99         {BUG_ID + FS + "overview-summary.html",
   100             "<a href=\"./pkg/relative-package-link.html\">relative package link</a>"},
   103     };
   104     private static final String[][] NEGATED_TEST = NO_TEST;
   106     /**
   107      * The entry point of the test.
   108      * @param args the array of command line arguments.
   109      */
   110     public static void main(String[] args) {
   111         TestRelativeLinks tester = new TestRelativeLinks();
   112         run(tester, ARGS, TEST, NEGATED_TEST);
   113         tester.printSummary();
   114     }
   116     /**
   117      * {@inheritDoc}
   118      */
   119     public String getBugId() {
   120         return BUG_ID;
   121     }
   123     /**
   124      * {@inheritDoc}
   125      */
   126     public String getBugName() {
   127         return getClass().getName();
   128     }
   129 }

mercurial