author | akulyakh |
Thu, 21 May 2015 11:41:04 -0700 | |
changeset 30730 | d3ce7619db2c |
parent 22447 | 364fe5d83775 |
child 33920 | bd731341c405 |
permissions | -rw-r--r-- |
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
1 |
/* |
19924
d45df0a53e20
8024434: problem running javadoc tests in samevm mode on Windows
jjg
parents:
14549
diff
changeset
|
2 |
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
4 |
* |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
8 |
* |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
13 |
* accompanied this code). |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
14 |
* |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
18 |
* |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
21 |
* questions. |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
22 |
*/ |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
23 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
24 |
import java.io.File; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
25 |
import java.io.IOException; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
26 |
import java.lang.annotation.Annotation; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
27 |
import java.lang.annotation.Retention; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
28 |
import java.lang.annotation.RetentionPolicy; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
29 |
import java.lang.reflect.InvocationTargetException; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
30 |
import java.lang.reflect.Method; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
31 |
import java.net.URI; |
19924
d45df0a53e20
8024434: problem running javadoc tests in samevm mode on Windows
jjg
parents:
14549
diff
changeset
|
32 |
import java.nio.file.DirectoryStream; |
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
33 |
import java.nio.file.Files; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
34 |
import java.nio.file.Path; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
35 |
import java.util.Arrays; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
36 |
import java.util.HashSet; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
37 |
import java.util.Set; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
38 |
import java.util.TreeSet; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
39 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
40 |
import javax.tools.JavaFileObject; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
41 |
import javax.tools.SimpleJavaFileObject; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
42 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
43 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
44 |
/* |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
45 |
* Superclass with utility methods for API tests. |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
46 |
*/ |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
47 |
class APITest { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
48 |
protected APITest() { } |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
49 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
50 |
/** Marker annotation for test cases. */ |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
51 |
@Retention(RetentionPolicy.RUNTIME) |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
52 |
@interface Test { } |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
53 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
54 |
/** Invoke all methods annotated with @Test. */ |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
55 |
protected void run() throws Exception { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
56 |
for (Method m: getClass().getDeclaredMethods()) { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
57 |
Annotation a = m.getAnnotation(Test.class); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
58 |
if (a != null) { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
59 |
testCount++; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
60 |
testName = m.getName(); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
61 |
System.err.println("test: " + testName); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
62 |
try { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
63 |
m.invoke(this, new Object[] { }); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
64 |
} catch (InvocationTargetException e) { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
65 |
Throwable cause = e.getCause(); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
66 |
throw (cause instanceof Exception) ? ((Exception) cause) : e; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
67 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
68 |
System.err.println(); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
69 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
70 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
71 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
72 |
if (testCount == 0) |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
73 |
error("no tests found"); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
74 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
75 |
StringBuilder summary = new StringBuilder(); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
76 |
if (testCount != 1) |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
77 |
summary.append(testCount).append(" tests"); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
78 |
if (errorCount > 0) { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
79 |
if (summary.length() > 0) summary.append(", "); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
80 |
summary.append(errorCount).append(" errors"); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
81 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
82 |
System.err.println(summary); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
83 |
if (errorCount > 0) |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
84 |
throw new Exception(errorCount + " errors found"); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
85 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
86 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
87 |
/** |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
88 |
* Create a directory in which to store generated doc files. |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
89 |
* Avoid using the default (current) directory, so that we can |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
90 |
* be sure that javadoc is writing in the intended location, |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
91 |
* not a default location. |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
92 |
*/ |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
93 |
protected File getOutDir() { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
94 |
File dir = new File(testName); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
95 |
dir.mkdirs(); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
96 |
return dir; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
97 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
98 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
99 |
/** |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
100 |
* Create a directory in which to store generated doc files. |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
101 |
* Avoid using the default (current) directory, so that we can |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
102 |
* be sure that javadoc is writing in the intended location, |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
103 |
* not a default location. |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
104 |
*/ |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
105 |
protected File getOutDir(String path) { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
106 |
File dir = new File(testName, path); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
107 |
dir.mkdirs(); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
108 |
return dir; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
109 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
110 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
111 |
protected JavaFileObject createSimpleJavaFileObject() { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
112 |
return createSimpleJavaFileObject("pkg/C", "package pkg; public class C { }"); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
113 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
114 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
115 |
protected JavaFileObject createSimpleJavaFileObject(final String binaryName, final String content) { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
116 |
return new SimpleJavaFileObject( |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
117 |
URI.create("myfo:///" + binaryName + ".java"), JavaFileObject.Kind.SOURCE) { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
118 |
@Override |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
119 |
public CharSequence getCharContent(boolean ignoreEncoding) { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
120 |
return content; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
121 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
122 |
}; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
123 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
124 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
125 |
protected void checkFiles(File dir, Set<String> expectFiles) { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
126 |
Set<File> files = new HashSet<File>(); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
127 |
listFiles(dir, files); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
128 |
Set<String> foundFiles = new HashSet<String>(); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
129 |
URI dirURI = dir.toURI(); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
130 |
for (File f: files) |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
131 |
foundFiles.add(dirURI.relativize(f.toURI()).getPath()); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
132 |
checkFiles(foundFiles, expectFiles, dir); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
133 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
134 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
135 |
protected void checkFiles(Path dir, Set<String> expectFiles) throws IOException { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
136 |
Set<Path> files = new HashSet<Path>(); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
137 |
listFiles(dir, files); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
138 |
Set<String> foundFiles = new HashSet<String>(); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
139 |
for (Path f: files) { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
140 |
foundFiles.add(dir.relativize(f).toString().replace(f.getFileSystem().getSeparator(), "/")); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
141 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
142 |
checkFiles(foundFiles, expectFiles, dir); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
143 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
144 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
145 |
private void checkFiles(Set<String> foundFiles, Set<String> expectFiles, Object where) { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
146 |
if (!foundFiles.equals(expectFiles)) { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
147 |
Set<String> missing = new TreeSet<String>(expectFiles); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
148 |
missing.removeAll(foundFiles); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
149 |
if (!missing.isEmpty()) |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
150 |
error("the following files were not found in " + where + ": " + missing); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
151 |
Set<String> unexpected = new TreeSet<String>(foundFiles); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
152 |
unexpected.removeAll(expectFiles); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
153 |
if (!unexpected.isEmpty()) |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
154 |
error("the following unexpected files were found in " + where + ": " + unexpected); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
155 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
156 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
157 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
158 |
protected void listFiles(File dir, Set<File> files) { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
159 |
for (File f: dir.listFiles()) { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
160 |
if (f.isDirectory()) |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
161 |
listFiles(f, files); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
162 |
else if (f.isFile()) |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
163 |
files.add(f); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
164 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
165 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
166 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
167 |
private void listFiles(Path dir, Set<Path> files) throws IOException { |
19924
d45df0a53e20
8024434: problem running javadoc tests in samevm mode on Windows
jjg
parents:
14549
diff
changeset
|
168 |
try (DirectoryStream<Path> ds = Files.newDirectoryStream(dir)) { |
d45df0a53e20
8024434: problem running javadoc tests in samevm mode on Windows
jjg
parents:
14549
diff
changeset
|
169 |
for (Path f: ds) { |
d45df0a53e20
8024434: problem running javadoc tests in samevm mode on Windows
jjg
parents:
14549
diff
changeset
|
170 |
if (Files.isDirectory(f)) |
d45df0a53e20
8024434: problem running javadoc tests in samevm mode on Windows
jjg
parents:
14549
diff
changeset
|
171 |
listFiles(f, files); |
d45df0a53e20
8024434: problem running javadoc tests in samevm mode on Windows
jjg
parents:
14549
diff
changeset
|
172 |
else if (Files.isRegularFile(f)) |
d45df0a53e20
8024434: problem running javadoc tests in samevm mode on Windows
jjg
parents:
14549
diff
changeset
|
173 |
files.add(f); |
d45df0a53e20
8024434: problem running javadoc tests in samevm mode on Windows
jjg
parents:
14549
diff
changeset
|
174 |
} |
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
175 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
176 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
177 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
178 |
protected void error(String msg) { |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
179 |
System.err.println("Error: " + msg); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
180 |
errorCount++; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
181 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
182 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
183 |
protected int testCount; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
184 |
protected int errorCount; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
185 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
186 |
protected String testName; |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
187 |
|
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
188 |
/** |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
189 |
* Standard files generated by processing a documented class pkg.C. |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
190 |
*/ |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
191 |
protected static Set<String> standardExpectFiles = new HashSet<String>(Arrays.asList( |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
192 |
"allclasses-frame.html", |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
193 |
"allclasses-noframe.html", |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
194 |
"constant-values.html", |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
195 |
"deprecated-list.html", |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
196 |
"help-doc.html", |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
197 |
"index-all.html", |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
198 |
"index.html", |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
199 |
"overview-tree.html", |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
200 |
"package-list", |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
201 |
"pkg/C.html", |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
202 |
"pkg/package-frame.html", |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
203 |
"pkg/package-summary.html", |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
204 |
"pkg/package-tree.html", |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14545
diff
changeset
|
205 |
"script.js", |
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
206 |
"stylesheet.css" |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
207 |
)); |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
208 |
} |
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
diff
changeset
|
209 |