author | jjg |
Tue, 22 Apr 2014 17:41:11 -0700 | |
changeset 24071 | b0845717434e |
parent 24065 | fc4022e50129 |
child 24072 | e7549dcbc4af |
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 BUG_ID = "4258405-4973606"; |
|
43 |
||
44 |
private static final String[][] TEST1 = { |
|
23971 | 45 |
{BUG_ID + "-1/pkg/doc-files/testfile.txt", |
10 | 46 |
"This doc file did not get trashed."} |
47 |
}; |
|
48 |
||
20238
a08610368936
8024096: some javadoc tests may contain false positive results
bpatel
parents:
14368
diff
changeset
|
49 |
private static final String[] FILE_TEST2 = { |
23971 | 50 |
BUG_ID + "-2/pkg/doc-files/subdir-used1" + |
51 |
"/testfile.txt", |
|
52 |
BUG_ID + "-2/pkg/doc-files/subdir-used2" + |
|
53 |
"/testfile.txt" |
|
10 | 54 |
}; |
20238
a08610368936
8024096: some javadoc tests may contain false positive results
bpatel
parents:
14368
diff
changeset
|
55 |
private static final String[] FILE_NEGATED_TEST2 = { |
23971 | 56 |
BUG_ID + "-2/pkg/doc-files/subdir-excluded1" + |
57 |
"/testfile.txt", |
|
58 |
BUG_ID + "-2/pkg/doc-files/subdir-excluded2" + |
|
59 |
"/testfile.txt" |
|
10 | 60 |
}; |
61 |
||
62 |
private static final String[][] TEST0 = { |
|
23971 | 63 |
{"pkg/doc-files/testfile.txt", |
10 | 64 |
"This doc file did not get trashed."} |
65 |
}; |
|
66 |
||
67 |
//Output dir = Input Dir |
|
68 |
private static final String[] ARGS1 = |
|
69 |
new String[] { |
|
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
5520
diff
changeset
|
70 |
"-d", BUG_ID + "-1", |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
5520
diff
changeset
|
71 |
"-sourcepath", |
23971 | 72 |
"blah" + File.pathSeparator + BUG_ID + "-1" + |
73 |
File.pathSeparator + "blah", "pkg"}; |
|
10 | 74 |
|
75 |
//Exercising -docfilessubdirs and -excludedocfilessubdir |
|
76 |
private static final String[] ARGS2 = |
|
77 |
new String[] { |
|
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
5520
diff
changeset
|
78 |
"-d", BUG_ID + "-2", |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
5520
diff
changeset
|
79 |
"-sourcepath", SRC_DIR, |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
5520
diff
changeset
|
80 |
"-docfilessubdirs", |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
5520
diff
changeset
|
81 |
"-excludedocfilessubdir", "subdir-excluded1:subdir-excluded2", |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
5520
diff
changeset
|
82 |
"pkg"}; |
10 | 83 |
|
84 |
//Output dir = "", Input dir = "" |
|
85 |
private static final String[] ARGS0 = |
|
23971 | 86 |
new String[] {"pkg/C.java"}; |
10 | 87 |
|
88 |
||
89 |
/** |
|
90 |
* The entry point of the test. |
|
91 |
* @param args the array of command line arguments. |
|
92 |
*/ |
|
93 |
public static void main(String[] args) { |
|
94 |
TestDocFileDir tester = new TestDocFileDir(); |
|
23971 | 95 |
copyDir(SRC_DIR + "/pkg", "."); |
24071 | 96 |
tester.run(ARGS0, TEST0, NO_TEST); |
23971 | 97 |
copyDir(SRC_DIR + "/pkg", BUG_ID + "-1"); |
24071 | 98 |
tester.run(ARGS1, TEST1, NO_TEST); |
24065
fc4022e50129
8041150: Avoid silly use of static methods in JavadocTester
jjg
parents:
23971
diff
changeset
|
99 |
tester.run(ARGS2, NO_TEST, NO_TEST, FILE_TEST2, FILE_NEGATED_TEST2); |
10 | 100 |
tester.printSummary(); |
101 |
} |
|
102 |
||
103 |
/** |
|
104 |
* {@inheritDoc} |
|
105 |
*/ |
|
106 |
public String getBugId() { |
|
107 |
return BUG_ID; |
|
108 |
} |
|
109 |
||
110 |
/** |
|
111 |
* {@inheritDoc} |
|
112 |
*/ |
|
113 |
public String getBugName() { |
|
114 |
return getClass().getName(); |
|
115 |
} |
|
116 |
} |