1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/com/sun/javadoc/testDocFileDir/TestDocFileDir.java Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,124 @@ 1.4 +/* 1.5 + * Copyright 2002-2004 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + */ 1.26 + 1.27 +import java.io.File; 1.28 + 1.29 +/* 1.30 + * @test 1.31 + * @bug 4258405 4973606 1.32 + * @summary This test verifies that the doc-file directory does not 1.33 + * get overwritten when the sourcepath is equal to the destination 1.34 + * directory. 1.35 + * Also test that -docfilessubdirs and -excludedocfilessubdir both work. 1.36 + * @author jamieh 1.37 + * @library ../lib/ 1.38 + * @build JavadocTester 1.39 + * @build TestDocFileDir 1.40 + * @run main TestDocFileDir 1.41 + */ 1.42 + 1.43 +public class TestDocFileDir extends JavadocTester { 1.44 + 1.45 + private static final String BUG_ID = "4258405-4973606"; 1.46 + 1.47 + private static final String[][] TEST1 = { 1.48 + {BUG_ID + "-1" + FS + "pkg" + FS + "doc-files" + FS + "testfile.txt", 1.49 + "This doc file did not get trashed."} 1.50 + }; 1.51 + private static final String[][] NEGATED_TEST1 = NO_TEST; 1.52 + 1.53 + private static final String[][] TEST2 = { 1.54 + {BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-used1" + 1.55 + FS + "testfile.txt", 1.56 + "passed" 1.57 + }, 1.58 + {BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-used2" + 1.59 + FS + "testfile.txt", 1.60 + "passed" 1.61 + }, 1.62 + }; 1.63 + private static final String[][] NEGATED_TEST2 = { 1.64 + {BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-excluded1" + 1.65 + FS + "testfile.txt", 1.66 + "passed" 1.67 + }, 1.68 + {BUG_ID + "-2" + FS + "pkg" + FS + "doc-files" + FS + "subdir-excluded2" + 1.69 + FS + "testfile.txt", 1.70 + "passed" 1.71 + }, 1.72 + }; 1.73 + 1.74 + private static final String[][] TEST0 = { 1.75 + {"pkg" + FS + "doc-files" + FS + "testfile.txt", 1.76 + "This doc file did not get trashed."} 1.77 + }; 1.78 + private static final String[][] NEGATED_TEST0 = {}; 1.79 + 1.80 + //Output dir = Input Dir 1.81 + private static final String[] ARGS1 = 1.82 + new String[] { 1.83 + "-d", BUG_ID + "-1", "-sourcepath", 1.84 + "blah" + String.valueOf(File.pathSeparatorChar) + 1.85 + BUG_ID + "-1" + String.valueOf(File.pathSeparatorChar) + 1.86 + "blah", "pkg"}; 1.87 + 1.88 + //Exercising -docfilessubdirs and -excludedocfilessubdir 1.89 + private static final String[] ARGS2 = 1.90 + new String[] { 1.91 + "-d", BUG_ID + "-2", "-sourcepath", SRC_DIR, 1.92 + "-docfilessubdirs", "-excludedocfilessubdir", 1.93 + "subdir-excluded1:subdir-excluded2", "pkg"}; 1.94 + 1.95 + //Output dir = "", Input dir = "" 1.96 + private static final String[] ARGS0 = 1.97 + new String[] {"pkg" + FS + "C.java"}; 1.98 + 1.99 + 1.100 + /** 1.101 + * The entry point of the test. 1.102 + * @param args the array of command line arguments. 1.103 + */ 1.104 + public static void main(String[] args) { 1.105 + TestDocFileDir tester = new TestDocFileDir(); 1.106 + copyDir(SRC_DIR + FS + "pkg", "."); 1.107 + run(tester, ARGS0, TEST0, NEGATED_TEST0); 1.108 + copyDir(SRC_DIR + FS + "pkg", BUG_ID + "-1"); 1.109 + run(tester, ARGS1, TEST1, NEGATED_TEST1); 1.110 + run(tester, ARGS2, TEST2, NEGATED_TEST2); 1.111 + tester.printSummary(); 1.112 + } 1.113 + 1.114 + /** 1.115 + * {@inheritDoc} 1.116 + */ 1.117 + public String getBugId() { 1.118 + return BUG_ID; 1.119 + } 1.120 + 1.121 + /** 1.122 + * {@inheritDoc} 1.123 + */ 1.124 + public String getBugName() { 1.125 + return getClass().getName(); 1.126 + } 1.127 +}