/*
* Copyright (c) 2016, 2022, 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 8157349 8185985 8194953 8214738
* @summary test copy of doc-files, and its contents for HTML meta content.
* @library ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
* @build javadoc.tester.*
* @run main TestCopyFiles
*/
import javadoc.tester.JavadocTester;
public class TestCopyFiles extends JavadocTester {
public static void main(String... args) throws Exception {
var tester = new TestCopyFiles();
tester.runTests();
}
@Test
public void testDocFilesInModulePackages() {
javadoc("-d", "modules-out",
"-top", "phi-TOP-phi",
"-bottom", "phi-BOTTOM-phi",
"-header", "phi-HEADER-phi",
"-footer", "phi-FOOTER-phi",
"-windowtitle", "phi-WINDOW-TITLE-phi",
"--module-source-path", testSrc("modules"),
"--module", "acme.mdle");
checkExit(Exit.OK);
checkOrder("acme.mdle/p/doc-files/inpackage.html",
"""
"Hello World" (phi-WINDOW-TITLE-phi)""",
"phi-TOP-phi",
// check top navbar
"phi-HEADER-phi",
"""
Module""",
"""
Package""",
"""
Tree""",
"""
Deprecated""",
"""
Index""",
"""
In a named module acme.module and named package p
.""",
"
p
.""",
"p
."""
);
}
@Test
public void testDocFilesInModulePackagesWithRecursiveCopyWithExclusion() {
javadoc("-d", "modules-out-recursive-with-exclusion",
"-docfilessubdirs",
"-excludedocfilessubdir", "sub-dir",
"--module-source-path", testSrc("modules"),
"--module", "acme.mdle");
checkExit(Exit.OK);
checkOutput("acme.mdle/p/doc-files/inpackage.html", true,
"""
In a named module acme.module and named package p
."""
);
}
@Test
public void testDocFilesInPackages() {
javadoc("-d", "packages-out",
"-sourcepath", testSrc("packages"),
"p1");
checkExit(Exit.OK);
checkOutput("p1/doc-files/inpackage.html", true,
"A named package in an unnamed module"
);
}
@Test
public void testDocFilesInPackagesWithRecursiveCopy() {
javadoc("-d", "packages-out-recursive",
"-docfilessubdirs",
"-sourcepath", testSrc("packages"),
"p1");
checkExit(Exit.OK);
checkOutput("p1/doc-files/inpackage.html", true,
"A named package in an unnamed module"
);
checkOutput("p1/doc-files/sub-dir/SubReadme.html", true,
"