test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java

Wed, 13 Aug 2014 14:50:00 -0700

author
katleman
date
Wed, 13 Aug 2014 14:50:00 -0700
changeset 2549
0b6cc4ea670f
parent 2218
2d0a0ae7fa9c
child 2525
2eb010b6cb22
child 2628
a5eb8f677bd4
permissions
-rw-r--r--

Added tag jdk8u40-b01 for changeset bf89a471779d

     1 /*
     2  * Copyright (c) 2011, 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 6553182 8025416 8029504
    27  * @summary This test verifies the -Xdocrootparent option.
    28  * @author Bhavesh Patel
    29  * @library ../lib/
    30  * @build JavadocTester TestDocRootLink
    31  * @run main TestDocRootLink
    32  */
    33 public class TestDocRootLink extends JavadocTester {
    35     private static final String BUG_ID = "6553182";
    36     private static final String[][] TEST1 = {
    37         {BUG_ID + FS + "pkg1" + FS + "C1.html",
    38             "Refer <a href=\"../../technotes/guides/index.html\">Here</a>"
    39         },
    40         {BUG_ID + FS + "pkg1" + FS + "C1.html",
    41             "This <a href=\"../pkg2/C2.html\">Here</a> should not be replaced" + NL +
    42             " with an absolute link."
    43         },
    44         {BUG_ID + FS + "pkg1" + FS + "C1.html",
    45             "Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and" + NL +
    46             " <a href=\"../pkg2/C2.html\">Link 2</a>."
    47         },
    48         {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
    49             "<a href=\"../../technotes/guides/index.html\">" + NL +
    50             "            Test document 1</a>"
    51         },
    52         {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
    53             "<a href=\"../pkg2/C2.html\">" + NL +
    54             "            Another Test document 1</a>"
    55         },
    56         {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
    57             "<a href=\"../technotes/guides/index.html\">" + NL +
    58             "            Another Test document 2.</a>"
    59         }
    60     };
    61     private static final String[][] NEGATED_TEST1 = {
    62         {BUG_ID + FS + "pkg1" + FS + "C1.html",
    63             "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
    64         },
    65         {BUG_ID + FS + "pkg1" + FS + "C1.html",
    66             "<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">"
    67         },
    68         {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
    69             "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
    70         },
    71         {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
    72             "<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">"
    73         }
    74     };
    75     private static final String[][] TEST2 = {
    76         {BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html",
    77             "Refer <a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">Here</a>"
    78         },
    79         {BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html",
    80             "This <a href=\"../pkg1/C1.html\">Here</a> should not be replaced" + NL +
    81             " with an absolute link."
    82         },
    83         {BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html",
    84             "Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and" + NL +
    85             " <a href=\"../pkg1/C1.html\">Link 2</a>."
    86         },
    87         {BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html",
    88             "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">" + NL +
    89             "            Test document 1</a>"
    90         },
    91         {BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html",
    92             "<a href=\"../pkg1/C1.html\">" + NL + "            Another Test document 1</a>"
    93         },
    94         {BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html",
    95             "<a href=\"../technotes/guides/index.html\">" + NL + "            Another Test document 2.</a>"
    96         }
    97     };
    98     private static final String[][] NEGATED_TEST2 = {
    99         {BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html",
   100             "<a href=\"../../technotes/guides/index.html\">"
   101         },
   102         {BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html",
   103             "<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">"
   104         },
   105         {BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html",
   106             "<a href=\"../../technotes/guides/index.html\">"
   107         },
   108         {BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html",
   109             "<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">"
   110         }
   111     };
   112     private static final String[] ARGS1 =
   113             new String[]{
   114         "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1", "pkg2"
   115     };
   116     private static final String[] ARGS2 =
   117             new String[]{
   118         "-d", BUG_ID + "-1", "-Xdocrootparent", "http://download.oracle.com/javase/7/docs", "-sourcepath", SRC_DIR, "pkg1", "pkg2"
   119     };
   121     /**
   122      * The entry point of the test.
   123      * @param args the array of command line arguments.
   124      */
   125     public static void main(String[] args) {
   126         TestDocRootLink tester = new TestDocRootLink();
   127         run(tester, ARGS1, TEST1, NEGATED_TEST1);
   128         run(tester, ARGS2, TEST2, NEGATED_TEST2);
   129         tester.printSummary();
   130     }
   132     /**
   133      * {@inheritDoc}
   134      */
   135     public String getBugId() {
   136         return BUG_ID;
   137     }
   139     /**
   140      * {@inheritDoc}
   141      */
   142     public String getBugName() {
   143         return getClass().getName();
   144     }
   145 }

mercurial