30
30
* jdk.javadoc/jdk.javadoc.internal.tool
31
31
* jdk.compiler/com.sun.tools.javac.api
32
32
* jdk.compiler/com.sun.tools.javac.main
33
- * @build javadoc.tester.*
33
+ * @build toolbox.ToolBox javadoc.tester.*
34
34
* @run main TestLinkPlatform
35
35
*/
36
36
@@ -55,8 +55,8 @@ public class TestLinkPlatform extends JavadocTester {
55
55
final static String NEW_PLATFORM_URL = "https://docs.oracle.com/en/java/javase/%d/docs/api/java.base/java/lang/Object.html" ;
56
56
final static String PRE_PLATFORM_URL = "https://download.java.net/java/early_access/jdk%d/docs/api/java.base/java/lang/Object.html" ;
57
57
58
- final static String NON_MODULAR_CUSTOM_PLATFORM_URL = "https://some.domain/docs /%d/api/java/lang/Object.html" ;
59
- final static String MODULAR_CUSTOM_PLATFORM_URL = "https://some.domain/docs /%d/api/java.base/java/lang/Object.html" ;
58
+ final static String NON_MODULAR_CUSTOM_PLATFORM_URL = "https://example.com /%d/api/java/lang/Object.html" ;
59
+ final static String MODULAR_CUSTOM_PLATFORM_URL = "https://example.com /%d/api/java.base/java/lang/Object.html" ;
60
60
61
61
final static int EARLIEST_VERSION = 7 ;
62
62
final static int LATEST_VERSION = Integer .parseInt (SourceVersion .latest ().name ().substring (8 ));
@@ -113,13 +113,14 @@ private void testPlatformLinkWithSupportedVersions(Path base, String versionOpti
113
113
114
114
@ Test
115
115
public void testPlatformLinkWithCustomPropertyURL (Path base ) throws Exception {
116
+ Path customProps = writeCustomProperties (base );
116
117
for (int version = EARLIEST_VERSION ; version <= LATEST_VERSION ; version ++) {
117
118
Path out = base .resolve ("out_" + version );
118
119
119
120
javadoc ("-d" , out .toString (),
120
121
"-sourcepath" , packageSrc .toString (),
121
122
"--release" , Integer .toString (version ),
122
- "--link-platform-properties" , "file:" + testSrc ( "linkplatform.properties" ),
123
+ "--link-platform-properties" , customProps . toUri (). toString ( ),
123
124
"p.q" );
124
125
125
126
checkExit (Exit .OK );
@@ -134,13 +135,14 @@ public void testPlatformLinkWithCustomPropertyURL(Path base) throws Exception {
134
135
135
136
@ Test
136
137
public void testPlatformLinkWithCustomPropertyFile (Path base ) throws Exception {
138
+ Path customProps = writeCustomProperties (base );
137
139
for (int version = EARLIEST_VERSION ; version <= LATEST_VERSION ; version ++) {
138
140
Path out = base .resolve ("out_" + version );
139
141
140
142
javadoc ("-d" , out .toString (),
141
143
"-sourcepath" , packageSrc .toString (),
142
144
"--release" , Integer .toString (version ),
143
- "--link-platform-properties" , testSrc ( "linkplatform.properties" ),
145
+ "--link-platform-properties" , customProps . toString ( ),
144
146
"p.q" );
145
147
146
148
checkExit (Exit .OK );
@@ -153,6 +155,17 @@ public void testPlatformLinkWithCustomPropertyFile(Path base) throws Exception {
153
155
}
154
156
}
155
157
158
+ private Path writeCustomProperties (Path base ) throws IOException {
159
+ ToolBox tb = new ToolBox ();
160
+ StringBuilder sb = new StringBuilder ();
161
+ for (int version = EARLIEST_VERSION ; version <= LATEST_VERSION ; version ++) {
162
+ sb .append (String .format ("doclet.platform.docs.%1$d= https://example.com/%1$d/api/\n " , version ));
163
+ }
164
+ Path path = base .resolve ("linkplatform.properties" );
165
+ tb .writeFile (path , sb .toString ());
166
+ return path ;
167
+ }
168
+
156
169
@ Test
157
170
public void testPlatformLinkWithInvalidPropertyFile (Path base ) throws Exception {
158
171
for (int version = EARLIEST_VERSION ; version <= LATEST_VERSION ; version ++) {
0 commit comments