TestRelativeLinks.java revision 553
1N/A/*
1N/A * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
1N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1N/A *
1N/A * This code is free software; you can redistribute it and/or modify it
1N/A * under the terms of the GNU General Public License version 2 only, as
1N/A * published by the Free Software Foundation.
1N/A *
1N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1N/A * version 2 for more details (a copy is included in the LICENSE file that
1N/A * accompanied this code).
1N/A *
1N/A * You should have received a copy of the GNU General Public License version
1N/A * 2 along with this work; if not, write to the Free Software Foundation,
1N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1N/A *
1N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1N/A * or visit www.oracle.com if you need additional information or have any
1N/A * questions.
1N/A */
1N/A
1N/A/*
1N/A * @test
1N/A * @bug 4460354
1N/A * @summary Test to make sure that relative paths are redirected in the
1N/A * output so that they are not broken.
1N/A * NOTE: these tests have \\n instead of NL because they are user
1N/A * generated new lines, not Java generated.
1N/A * @author jamieh
1N/A * @library ../lib/
1N/A * @build JavadocTester
1N/A * @build TestRelativeLinks
1N/A * @run main TestRelativeLinks
1N/A */
1N/A
1N/Apublic class TestRelativeLinks extends JavadocTester {
1N/A
1N/A //Test information.
1N/A private static final String BUG_ID = "4460354";
1N/A
1N/A //Javadoc arguments.
1N/A private static final String[] ARGS = new String[] {
1N/A "-d", BUG_ID, "-use", "-sourcepath", SRC_DIR, "pkg", "pkg2"
1N/A };
1N/A
1N/A //Input for string search tests.
1N/A private static final String[][] TEST = {
1N/A //These relative paths should stay relative because they appear
1N/A //in the right places.
1N/A {BUG_ID + FS + "pkg" + FS + "C.html",
1N/A "<a href=\"relative-class-link.html\">relative class link</a>"},
1N/A {BUG_ID + FS + "pkg" + FS + "C.html",
1N/A "<a href=\"relative-field-link.html\">relative field link</a>"},
1N/A {BUG_ID + FS + "pkg" + FS + "C.html",
1N/A "<a href=\"relative-method-link.html\">relative method link</a>"},
1N/A {BUG_ID + FS + "pkg" + FS + "package-summary.html",
1N/A "<a href=\"relative-package-link.html\">relative package link</a>"},
1N/A {BUG_ID + FS + "pkg" + FS + "C.html",
1N/A " <a\n" +
1N/A " href=\"relative-multi-line-link.html\">relative-multi-line-link</a>."},
1N/A
1N/A //These relative paths should be redirected because they are in different
1N/A //places.
1N/A
1N/A //INDEX PAGE
1N/A {BUG_ID + FS + "index-all.html",
1N/A "<a href=\"./pkg/relative-class-link.html\">relative class link</a>"},
1N/A {BUG_ID + FS + "index-all.html",
1N/A "<a href=\"./pkg/relative-field-link.html\">relative field link</a>"},
1N/A {BUG_ID + FS + "index-all.html",
1N/A "<a href=\"./pkg/relative-method-link.html\">relative method link</a>"},
1N/A {BUG_ID + FS + "index-all.html",
1N/A "<a href=\"./pkg/relative-package-link.html\">relative package link</a>"},
1N/A {BUG_ID + FS + "index-all.html",
1N/A " <a\n" +
1N/A " href=\"./pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."},
1N/A
1N/A
1N/A //PACKAGE USE
1N/A {BUG_ID + FS + "pkg" + FS + "package-use.html",
1N/A "<a href=\"../pkg/relative-package-link.html\">relative package link</a>."},
1N/A {BUG_ID + FS + "pkg" + FS + "package-use.html",
1N/A "<a href=\"../pkg/relative-class-link.html\">relative class link</a>"},
1N/A
1N/A //CLASS_USE
1N/A {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html",
1N/A "<a href=\"../../pkg/relative-field-link.html\">relative field link</a>"},
1N/A {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html",
1N/A "<a href=\"../../pkg/relative-method-link.html\">relative method link</a>"},
1N/A {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html",
1N/A "<a href=\"../../pkg/relative-package-link.html\">relative package link</a>"},
1N/A {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html",
1N/A " <a\n" +
1N/A " href=\"../../pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."},
1N/A
1N/A //PACKAGE OVERVIEW
1N/A {BUG_ID + FS + "overview-summary.html",
1N/A "<a href=\"./pkg/relative-package-link.html\">relative package link</a>"},
1N/A
1N/A
1N/A };
1N/A private static final String[][] NEGATED_TEST = NO_TEST;
1N/A
1N/A /**
1N/A * The entry point of the test.
1N/A * @param args the array of command line arguments.
1N/A */
1N/A public static void main(String[] args) {
1N/A TestRelativeLinks tester = new TestRelativeLinks();
1N/A run(tester, ARGS, TEST, NEGATED_TEST);
1N/A tester.printSummary();
1N/A }
1N/A
1N/A /**
1N/A * {@inheritDoc}
1N/A */
1N/A public String getBugId() {
1N/A return BUG_ID;
1N/A }
1N/A
1N/A /**
1N/A * {@inheritDoc}
1N/A */
1N/A public String getBugName() {
1N/A return getClass().getName();
1N/A }
1N/A}
1N/A