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

Wed, 27 Apr 2016 01:34:52 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:34:52 +0800
changeset 0
959103a6100f
child 2525
2eb010b6cb22
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/langtools/
changeset: 2573:53ca196be1ae
tag: jdk8u25-b17

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

mercurial