8015663: Need to supply tests to provide javadoc for profiles support code coverage
authorjjg
Fri, 30 Aug 2013 17:36:47 -0700
changeset 19913 2adc7be8a60b
parent 19912 4b1a79163f9c
child 19914 d86271bd430a
8015663: Need to supply tests to provide javadoc for profiles support code coverage Reviewed-by: jjg Contributed-by: evgeniya.stepanova@oracle.com
langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java
langtools/test/com/sun/javadoc/testProfiles/TestProfilesConfiguration.java
langtools/test/com/sun/javadoc/testProfiles/pkg2/Class1Pkg2.java
langtools/test/com/sun/javadoc/testProfiles/pkg2/ClassError.java
langtools/test/com/sun/javadoc/testProfiles/pkg2/ClassException.java
langtools/test/com/sun/javadoc/testProfiles/pkgDeprecated/Class1PkgDeprecated.java
langtools/test/com/sun/javadoc/testProfiles/pkgDeprecated/package-info.java
langtools/test/com/sun/javadoc/testProfiles/profile-rtjar-includes.txt
--- a/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java	Fri Aug 30 16:38:54 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testProfiles/TestProfiles.java	Fri Aug 30 17:36:47 2013 -0700
@@ -25,7 +25,7 @@
  * @test
  * @bug      8006124 8009684 8016921 8023700
  * @summary  Test javadoc support for profiles.
- * @author   Bhavesh Patel
+ * @author   Bhavesh Patel, Evgeniya Stepanova
  * @library  ../lib/
  * @build    JavadocTester TestProfiles
  * @run main TestProfiles
@@ -38,8 +38,9 @@
     private static final String PACKAGE_BUG_ID = BUG_ID + "-2";
     //Javadoc arguments.
     private static final String[] ARGS1 = new String[]{
-        "-d", PROFILE_BUG_ID, "-sourcepath", SRC_DIR, "-Xprofilespath", SRC_DIR + FS
-        + "profile-rtjar-includes.txt", "pkg1", "pkg2", "pkg3", "pkg4", "pkg5"
+        "-d", PROFILE_BUG_ID, "-sourcepath", SRC_DIR, "-Xprofilespath",
+         SRC_DIR + FS + "profile-rtjar-includes.txt", "pkg1", "pkg2",
+         "pkg3", "pkg4", "pkg5", "pkgDeprecated"
     };
     private static final String[] ARGS2 = new String[]{
         "-d", PACKAGE_BUG_ID, "-sourcepath", SRC_DIR, "pkg1", "pkg2", "pkg3", "pkg4", "pkg5"
@@ -113,6 +114,49 @@
             "target=\"classFrame\">compact2</a></li>" + NL + "<li><a href=\"" +
             "compact3-summary.html\" target=\"classFrame\">compact3</a></li>" + NL +
             "</ul>"
+        },
+        //Test deprecated class in profiles
+        {PROFILE_BUG_ID + FS + "compact1-summary.html","<td class=\"colFirst\">"
+            + "<a href=\"pkg2/Class1Pkg2.html\" title=\"class in pkg2\">Class1Pkg2</a></td>"
+            + NL + "<td class=\"colLast\">Deprecated"
+        },
+        {PROFILE_BUG_ID + FS + "deprecated-list.html","<td class=\"colOne\">"
+            + "<a href=\"pkg2/Class1Pkg2.html\" title=\"class in pkg2\">pkg2.Class1Pkg2</a>"
+            + NL +"<div class=\"block\"><span class=\"italic\">Class1Pkg2. This class is deprecated</span></div>"
+        },
+        //Test deprecated package in profile
+        {PROFILE_BUG_ID + FS + "deprecated-list.html","<td class=\"colOne\">"
+            + "<a href=\"pkgDeprecated/package-summary.html\">pkgDeprecated</a>"
+            + NL +"<div class=\"block\"><span class=\"italic\">This package is <b>Deprecated</b>."
+            + " Use pkg1.</span></div>"
+        },
+        {PROFILE_BUG_ID + FS + "pkgDeprecated" + FS + "package-summary.html",
+            "<div class=\"deprecatedContent\"><span class=\"strong\">Deprecated.</span>"
+            + NL + "<div class=\"block\"><span class=\"italic\">This package is <b>Deprecated</b>."
+            + " Use pkg1.</span></div>"
+        },
+        // need to add teststring when JDK-8015496 will be fixed
+        //Test exception in profiles
+        {PROFILE_BUG_ID + FS + "compact1-summary.html","<table class=\"packageSummary\" "
+            + "border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
+            + "summary=\"Exception Summary table, listing exceptions, and an explanation\">"
+            + NL + "<caption><span>Exception Summary</span><span class=\"tabEnd\">"
+            + "&nbsp;</span></caption>" + NL + "<tr>" + NL + "<th class=\"colFirst\" "
+            + "scope=\"col\">Exception</th>" + NL + "<th class=\"colLast\" scope=\"col\">"
+            + "Description</th>" + NL + "</tr>" + NL + "<tbody>" + NL + "<tr class=\"altColor\">"
+            + NL + "<td class=\"colFirst\"><a href=\"pkg2/ClassException.html\""
+            + " title=\"class in pkg2\">ClassException</a></td>"
+        },
+        //Test errors in profiles
+        {PROFILE_BUG_ID + FS + "compact1-summary.html",
+            "<table class=\"packageSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
+            + "summary=\"Error Summary table, listing errors, and an explanation\">"
+            + NL + "<caption><span>Error Summary</span><span class=\"tabEnd\">&nbsp;"
+            + "</span></caption>" + NL + "<tr>" + NL + "<th class=\"colFirst\""
+            + " scope=\"col\">Error</th>" + NL + "<th class=\"colLast\" "
+            + "scope=\"col\">Description</th>" + NL + "</tr>" + NL + "<tbody>"
+            + NL + "<tr class=\"altColor\">" + NL + "<td class=\"colFirst\">"
+            + "<a href=\"pkg2/ClassError.html\" title=\"class in pkg2\">ClassError</a></td>"
         }
     };
     private static final String[][] PROFILES_NEGATED_TEST = {
@@ -125,6 +169,8 @@
         {PROFILE_BUG_ID + FS + "pkg4" + FS + "compact2-package-frame.html",
             "<li><a href=\"Anno1Pkg4.html\" title=\"annotation in pkg4\" "
             + "target=\"classFrame\">Anno1Pkg4</a></li>"
+        },
+        {PROFILE_BUG_ID + FS + "compact1-summary.html","<li>Use</li>"
         }
     };
     private static final String[][] PACKAGES_TEST = {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/TestProfilesConfiguration.java	Fri Aug 30 17:36:47 2013 -0700
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug      8006124 8009684 8015663
+ * @summary  Test javadoc options support for profiles.
+ * @author   Evgeniya Stepanova
+ * @library  ../lib/
+ * @build    JavadocTester TestProfilesConfiguration
+ * @run main TestProfilesConfiguration
+ */
+public class TestProfilesConfiguration extends JavadocTester {
+
+    //Test information.
+    private static final String BUG_ID = "8006124-8009684";
+    private static final String PROFILE_CONFIGURATION_BUG_ID = BUG_ID + "-3";
+    //Javadoc arguments.
+    private static final String[] ARGS3 = new String[]{
+        "-d", PROFILE_CONFIGURATION_BUG_ID, "-sourcepath", SRC_DIR, "-nocomment",
+        "-keywords", "-Xprofilespath", SRC_DIR + FS + "profile-rtjar-includes.txt",
+        "-doctitle", "Simple doctitle", "-use", "pkg3", "pkg1", "pkg2", "pkg4",
+        "pkg5", "-packagesheader", "Simple packages header","pkgDeprecated"
+    };
+    private static final String[][] PROFILES_CONFIGURATION_TEST = {
+        //-use option test string fo profile view page
+        {PROFILE_CONFIGURATION_BUG_ID + FS + "compact1-summary.html","<li>Use</li>"
+        },
+        //-doctitle option test string
+        {PROFILE_CONFIGURATION_BUG_ID + FS + "overview-summary.html",
+            "<div class=\"header\">" + NL + "<h1 class=\"title\">Simple doctitle</h1>"
+        },
+        //-packagesheader option test string fo profiles
+        {PROFILE_CONFIGURATION_BUG_ID + FS + "profile-overview-frame.html",
+            "<h1 title=\"Simple packages header\" class=\"bar\">Simple packages header</h1>"
+        },
+        //-keywords option test string for profiles
+        {PROFILE_CONFIGURATION_BUG_ID + FS + "compact1-summary.html",
+            "<meta name=\"keywords\" content=\"compact1 profile\">"
+        }
+    };
+    private static final String[][] PROFILES_CONFIGURATION_NEGATED_TEST = {
+        //-nocomments option test string
+        {PROFILE_CONFIGURATION_BUG_ID + FS + "compact1-summary.html",
+            "<div class=\"block\"><i>Class1Pkg2.</i></div>"
+        }
+    };
+
+    /**
+     * The entry point of the test.
+     *
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestProfilesConfiguration tester = new TestProfilesConfiguration();
+        run(tester, ARGS3, PROFILES_CONFIGURATION_TEST,
+        PROFILES_CONFIGURATION_NEGATED_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
--- a/langtools/test/com/sun/javadoc/testProfiles/pkg2/Class1Pkg2.java	Fri Aug 30 16:38:54 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg2/Class1Pkg2.java	Fri Aug 30 17:36:47 2013 -0700
@@ -24,7 +24,7 @@
 package pkg2;
 
 /**
- * Another test class.
+ * @deprecated Class1Pkg2. This class is deprecated
  *
  * @author Bhavesh Patel
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg2/ClassError.java	Fri Aug 30 17:36:47 2013 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg2;
+
+/**
+ * Simple error class.
+ *
+ * @author Evgeniya Stepanova
+ */
+public class ClassError extends Error {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkg2/ClassException.java	Fri Aug 30 17:36:47 2013 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg2;
+
+/**
+ * Simple exception class.
+ *
+ * @author Evgeniya Stepanova
+ */
+public class ClassException extends Exception {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkgDeprecated/Class1PkgDeprecated.java	Fri Aug 30 17:36:47 2013 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkgDeprecated;
+
+/**
+ * Simple deprecated class of deprecated package.
+ *
+ * @author Evgeniya Stepanova
+ */
+public class Class1PkgDeprecated {
+
+    public void method(int t) {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testProfiles/pkgDeprecated/package-info.java	Fri Aug 30 17:36:47 2013 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Deprecated package.
+ *
+ * @deprecated This package is <b>Deprecated</b>. Use pkg1.
+ */
+package pkgDeprecated;
--- a/langtools/test/com/sun/javadoc/testProfiles/profile-rtjar-includes.txt	Fri Aug 30 16:38:54 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testProfiles/profile-rtjar-includes.txt	Fri Aug 30 17:36:47 2013 -0700
@@ -1,5 +1,6 @@
 PROFILE_1_RTJAR_INCLUDE_PACKAGES := \
-    pkg2 
+    pkg2 \
+    pkgDeprecated
 
 PROFILE_1_RTJAR_INCLUDE_TYPES := \
     pkg3/Class1Pkg3.class