Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java
48035 views
/*1* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 6553182 8025416 802950426* @summary This test verifies the -Xdocrootparent option.27* @author Bhavesh Patel28* @library ../lib/29* @build JavadocTester TestDocRootLink30* @run main TestDocRootLink31*/32public class TestDocRootLink extends JavadocTester {3334private static final String BUG_ID = "6553182";35private static final String[][] TEST1 = {36{BUG_ID + FS + "pkg1" + FS + "C1.html",37"Refer <a href=\"../../technotes/guides/index.html\">Here</a>"38},39{BUG_ID + FS + "pkg1" + FS + "C1.html",40"This <a href=\"../pkg2/C2.html\">Here</a> should not be replaced" + NL +41" with an absolute link."42},43{BUG_ID + FS + "pkg1" + FS + "C1.html",44"Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and" + NL +45" <a href=\"../pkg2/C2.html\">Link 2</a>."46},47{BUG_ID + FS + "pkg1" + FS + "package-summary.html",48"<a href=\"../../technotes/guides/index.html\">" + NL +49" Test document 1</a>"50},51{BUG_ID + FS + "pkg1" + FS + "package-summary.html",52"<a href=\"../pkg2/C2.html\">" + NL +53" Another Test document 1</a>"54},55{BUG_ID + FS + "pkg1" + FS + "package-summary.html",56"<a href=\"../technotes/guides/index.html\">" + NL +57" Another Test document 2.</a>"58}59};60private static final String[][] NEGATED_TEST1 = {61{BUG_ID + FS + "pkg1" + FS + "C1.html",62"<a href=\"https://docs.oracle.com/javase/7/docs/technotes/guides/index.html\">"63},64{BUG_ID + FS + "pkg1" + FS + "C1.html",65"<a href=\"https://docs.oracle.com/javase/7/docs/pkg2/C2.html\">"66},67{BUG_ID + FS + "pkg1" + FS + "package-summary.html",68"<a href=\"https://docs.oracle.com/javase/7/docs/technotes/guides/index.html\">"69},70{BUG_ID + FS + "pkg1" + FS + "package-summary.html",71"<a href=\"https://docs.oracle.com/javase/7/docs/pkg2/C2.html\">"72}73};74private static final String[][] TEST2 = {75{BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html",76"Refer <a href=\"https://docs.oracle.com/javase/7/docs/technotes/guides/index.html\">Here</a>"77},78{BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html",79"This <a href=\"../pkg1/C1.html\">Here</a> should not be replaced" + NL +80" with an absolute link."81},82{BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html",83"Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and" + NL +84" <a href=\"../pkg1/C1.html\">Link 2</a>."85},86{BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html",87"<a href=\"https://docs.oracle.com/javase/7/docs/technotes/guides/index.html\">" + NL +88" Test document 1</a>"89},90{BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html",91"<a href=\"../pkg1/C1.html\">" + NL + " Another Test document 1</a>"92},93{BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html",94"<a href=\"../technotes/guides/index.html\">" + NL + " Another Test document 2.</a>"95}96};97private static final String[][] NEGATED_TEST2 = {98{BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html",99"<a href=\"../../technotes/guides/index.html\">"100},101{BUG_ID + "-1" + FS + "pkg2" + FS + "C2.html",102"<a href=\"https://docs.oracle.com/javase/7/docs/pkg1/C1.html\">"103},104{BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html",105"<a href=\"../../technotes/guides/index.html\">"106},107{BUG_ID + "-1" + FS + "pkg2" + FS + "package-summary.html",108"<a href=\"https://docs.oracle.com/javase/7/docs/pkg1/C1.html\">"109}110};111private static final String[] ARGS1 =112new String[]{113"-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1", "pkg2"114};115private static final String[] ARGS2 =116new String[]{117"-d", BUG_ID + "-1", "-Xdocrootparent", "https://docs.oracle.com/javase/7/docs", "-sourcepath", SRC_DIR, "pkg1", "pkg2"118};119120/**121* The entry point of the test.122* @param args the array of command line arguments.123*/124public static void main(String[] args) {125TestDocRootLink tester = new TestDocRootLink();126run(tester, ARGS1, TEST1, NEGATED_TEST1);127run(tester, ARGS2, TEST2, NEGATED_TEST2);128tester.printSummary();129}130131/**132* {@inheritDoc}133*/134public String getBugId() {135return BUG_ID;136}137138/**139* {@inheritDoc}140*/141public String getBugName() {142return getClass().getName();143}144}145146147