author | jjg |
Thu, 21 Feb 2019 14:03:57 -0800 | |
changeset 53879 | e7cb0348fa1c |
parent 53097 | 2e82ca64b25d |
child 53883 | f41793b5b83f |
permissions | -rw-r--r-- |
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
1 |
/* |
53879 | 2 |
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. |
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
4 |
* |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
8 |
* |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
13 |
* accompanied this code). |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
14 |
* |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
18 |
* |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
21 |
* questions. |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
22 |
*/ |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
23 |
|
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
24 |
/* |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
25 |
* @test |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
26 |
* @bug 5076751 |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
27 |
* @summary System properties documentation needed in javadocs |
53097 | 28 |
* @library /tools/lib ../../lib |
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
29 |
* @modules jdk.javadoc/jdk.javadoc.internal.tool |
53097 | 30 |
* @build javadoc.tester.* toolbox.ToolBox builder.ClassBuilder |
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
31 |
* @run main TestSystemPropertyTaglet |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
32 |
*/ |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
33 |
|
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
34 |
|
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
35 |
import java.nio.file.Path; |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
36 |
import java.nio.file.Paths; |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
37 |
|
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
38 |
import builder.ClassBuilder; |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
39 |
import builder.ClassBuilder.MethodBuilder; |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
40 |
import toolbox.ToolBox; |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
41 |
|
53097 | 42 |
import javadoc.tester.JavadocTester; |
43 |
||
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
44 |
public class TestSystemPropertyTaglet extends JavadocTester { |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
45 |
|
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
46 |
final ToolBox tb; |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
47 |
|
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
48 |
public static void main(String... args) throws Exception { |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
49 |
TestSystemPropertyTaglet tester = new TestSystemPropertyTaglet(); |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
50 |
tester.runTests(m -> new Object[]{Paths.get(m.getName())}); |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
51 |
} |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
52 |
|
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
53 |
TestSystemPropertyTaglet() { |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
54 |
tb = new ToolBox(); |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
55 |
} |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
56 |
|
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
57 |
@Test |
53097 | 58 |
public void test(Path base) throws Exception { |
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
59 |
Path srcDir = base.resolve("src"); |
52648
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
60 |
Path outDir = base.resolve("out"); |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
61 |
|
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
62 |
MethodBuilder method = MethodBuilder |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
63 |
.parse("public void func(A a) {}") |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
64 |
.setComments("test with {@systemProperty java.version}"); |
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
65 |
|
52648
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
66 |
new ClassBuilder(tb, "pkg.A") |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
67 |
.setComments("test with {@systemProperty user.name}") |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
68 |
.setModifiers("public", "class") |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
69 |
.addMembers(method) |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
70 |
.write(srcDir); |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
71 |
|
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
72 |
javadoc("-d", outDir.toString(), |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
73 |
"-sourcepath", srcDir.toString(), |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
74 |
"pkg"); |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
75 |
|
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
76 |
checkExit(Exit.OK); |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
77 |
|
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
78 |
checkOrder("pkg/A.html", |
53879 | 79 |
"<h1 title=\"Class A\" class=\"title\">Class A</h1>", |
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
80 |
"test with <code><a id=\"user.name\" class=\"searchTagResult\">user.name</a></code>", |
53879 | 81 |
"<h2>Method Detail</h2>", |
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
82 |
"test with <code><a id=\"java.version\" class=\"searchTagResult\">java.version</a></code>"); |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
83 |
|
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
84 |
checkOrder("index-all.html", |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
85 |
"<h2 class=\"title\">J</h2>", |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
86 |
"<dt><span class=\"searchTagLink\"><a href=\"pkg/A.html#java.version\">java.version</a>" |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
87 |
+ "</span> - Search tag in pkg.A</dt>\n<dd>System Property</dd>", |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
88 |
"<h2 class=\"title\">U</h2>", |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
89 |
"<dt><span class=\"searchTagLink\"><a href=\"pkg/A.html#user.name\">user.name</a></span>" |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
90 |
+ " - Search tag in pkg.A</dt>\n<dd>System Property</dd>"); |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
91 |
|
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
92 |
checkOutput("tag-search-index.js", true, |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
93 |
"{\"l\":\"java.version\",\"h\":\"pkg.A\",\"d\":\"System Property\"," |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
94 |
+ "\"u\":\"pkg/A.html#java.version\"}"); |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
95 |
|
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
96 |
checkOutput("tag-search-index.js", true, |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
97 |
"{\"l\":\"user.name\",\"h\":\"pkg.A\",\"d\":\"System Property\"," |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
98 |
+ "\"u\":\"pkg/A.html#user.name\"}"); |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
99 |
} |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
100 |
|
52648
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
101 |
@Test |
53097 | 102 |
public void testSystemProperytWithinATag(Path base) throws Exception { |
52648
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
103 |
Path srcDir = base.resolve("src"); |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
104 |
Path outDir = base.resolve("out"); |
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
105 |
|
52648
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
106 |
new ClassBuilder(tb, "pkg2.A") |
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
107 |
.setModifiers("public", "class") |
52648
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
108 |
.addMembers(MethodBuilder.parse("public void func(){}") |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
109 |
.setComments("a within a : <a href='..'>{@systemProperty user.name}</a>")) |
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
110 |
.write(srcDir); |
52648
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
111 |
|
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
112 |
javadoc("-d", outDir.toString(), |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
113 |
"-sourcepath", srcDir.toString(), |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
114 |
"pkg2"); |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
115 |
|
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
116 |
checkExit(Exit.OK); |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
117 |
|
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
118 |
checkOutput(Output.OUT, true, |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52487
diff
changeset
|
119 |
"warning: {@systemProperty} tag, which expands to <a>, within <a>"); |
52487
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
120 |
} |
5d1d07b72f15
5076751: System properties documentation needed in javadocs
pmuthuswamy
parents:
diff
changeset
|
121 |
} |