author | jjg |
Fri, 25 Apr 2014 13:08:41 -0700 | |
changeset 24217 | 25b12d4d4192 |
parent 24072 | e7549dcbc4af |
child 24399 | af1a0220d0fa |
permissions | -rw-r--r-- |
10 | 1 |
/* |
23971 | 2 |
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. |
10 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5520 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
10 | 22 |
*/ |
23 |
||
24 |
import java.io.File; |
|
25 |
||
26 |
/* |
|
27 |
* @test |
|
20238
a08610368936
8024096: some javadoc tests may contain false positive results
bpatel
parents:
14368
diff
changeset
|
28 |
* @bug 4258405 4973606 8024096 |
10 | 29 |
* @summary This test verifies that the doc-file directory does not |
30 |
* get overwritten when the sourcepath is equal to the destination |
|
31 |
* directory. |
|
32 |
* Also test that -docfilessubdirs and -excludedocfilessubdir both work. |
|
33 |
* @author jamieh |
|
34 |
* @library ../lib/ |
|
35 |
* @build JavadocTester |
|
36 |
* @build TestDocFileDir |
|
37 |
* @run main TestDocFileDir |
|
38 |
*/ |
|
39 |
||
40 |
public class TestDocFileDir extends JavadocTester { |
|
41 |
||
42 |
private static final String[][] TEST1 = { |
|
24072 | 43 |
{ "pkg/doc-files/testfile.txt", |
10 | 44 |
"This doc file did not get trashed."} |
45 |
}; |
|
46 |
||
20238
a08610368936
8024096: some javadoc tests may contain false positive results
bpatel
parents:
14368
diff
changeset
|
47 |
private static final String[] FILE_TEST2 = { |
24072 | 48 |
"pkg/doc-files/subdir-used1/testfile.txt", |
49 |
"pkg/doc-files/subdir-used2/testfile.txt" |
|
10 | 50 |
}; |
20238
a08610368936
8024096: some javadoc tests may contain false positive results
bpatel
parents:
14368
diff
changeset
|
51 |
private static final String[] FILE_NEGATED_TEST2 = { |
24072 | 52 |
"pkg/doc-files/subdir-excluded1/testfile.txt", |
53 |
"pkg/doc-files/subdir-excluded2/testfile.txt" |
|
10 | 54 |
}; |
55 |
||
56 |
private static final String[][] TEST0 = { |
|
23971 | 57 |
{"pkg/doc-files/testfile.txt", |
10 | 58 |
"This doc file did not get trashed."} |
59 |
}; |
|
60 |
||
61 |
//Output dir = Input Dir |
|
62 |
private static final String[] ARGS1 = |
|
63 |
new String[] { |
|
24072 | 64 |
"-d", OUTPUT_DIR + "-1", |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
5520
diff
changeset
|
65 |
"-sourcepath", |
24072 | 66 |
"blah" + File.pathSeparator + OUTPUT_DIR + "-1" + |
23971 | 67 |
File.pathSeparator + "blah", "pkg"}; |
10 | 68 |
|
69 |
//Exercising -docfilessubdirs and -excludedocfilessubdir |
|
70 |
private static final String[] ARGS2 = |
|
71 |
new String[] { |
|
24072 | 72 |
"-d", OUTPUT_DIR + "-2", |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
5520
diff
changeset
|
73 |
"-sourcepath", SRC_DIR, |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
5520
diff
changeset
|
74 |
"-docfilessubdirs", |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
5520
diff
changeset
|
75 |
"-excludedocfilessubdir", "subdir-excluded1:subdir-excluded2", |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
5520
diff
changeset
|
76 |
"pkg"}; |
10 | 77 |
|
78 |
//Output dir = "", Input dir = "" |
|
79 |
private static final String[] ARGS0 = |
|
23971 | 80 |
new String[] {"pkg/C.java"}; |
10 | 81 |
|
82 |
||
83 |
/** |
|
84 |
* The entry point of the test. |
|
85 |
* @param args the array of command line arguments. |
|
86 |
*/ |
|
87 |
public static void main(String[] args) { |
|
88 |
TestDocFileDir tester = new TestDocFileDir(); |
|
24217
25b12d4d4192
8040904: Ensure javadoc tests do not overwrite results within tests
jjg
parents:
24072
diff
changeset
|
89 |
tester.setCheckOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES); |
23971 | 90 |
copyDir(SRC_DIR + "/pkg", "."); |
24071 | 91 |
tester.run(ARGS0, TEST0, NO_TEST); |
24072 | 92 |
copyDir(SRC_DIR + "/pkg", OUTPUT_DIR + "-1"); |
24071 | 93 |
tester.run(ARGS1, TEST1, NO_TEST); |
24217
25b12d4d4192
8040904: Ensure javadoc tests do not overwrite results within tests
jjg
parents:
24072
diff
changeset
|
94 |
tester.setCheckOutputDirectoryCheck(DirectoryCheck.NONE); |
24065
fc4022e50129
8041150: Avoid silly use of static methods in JavadocTester
jjg
parents:
23971
diff
changeset
|
95 |
tester.run(ARGS2, NO_TEST, NO_TEST, FILE_TEST2, FILE_NEGATED_TEST2); |
10 | 96 |
tester.printSummary(); |
97 |
} |
|
98 |
} |