1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
/*******************************************************************************
* Copyright (c) 2005 Contributors.
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v 2.0
* which accompanies this distribution and is available at
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
*
* Contributors:
* Alexandre Vasseur initial implementation
*******************************************************************************/
package org.aspectj.systemtest.ajc150.ataspectj;
import java.io.File;
import java.net.URL;
import org.aspectj.testing.XMLBasedAjcTestCase;
import org.aspectj.util.FileUtil;
import junit.framework.Test;
import org.aspectj.util.LangUtil;
/**
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
*/
public class AtAjLTWTests extends XMLBasedAjcTestCase {
public static Test suite() {
return XMLBasedAjcTestCase.loadSuite(org.aspectj.systemtest.ajc150.ataspectj.AtAjLTWTests.class);
}
protected URL getSpecFile() {
return getClassResource("ltw.xml");
}
public void testRunThemAllWithJavacCompiledAndLTW() {
runTest("RunThemAllWithJavacCompiledAndLTW");
}
public void testAjcLTWPerClauseTest_XterminateAfterCompilation() {
runTest("AjcLTW PerClauseTest -XterminateAfterCompilation");
}
public void testAjcLTWPerClauseTest_Xreweavable() {
runTest("AjcLTW PerClauseTest -Xreweavable");
}
public void testJavaCAjcLTWPerClauseTest() {
runTest("JavaCAjcLTW PerClauseTest");
}
public void testAjcLTWAroundInlineMungerTest_XterminateAfterCompilation() {
runTest("AjcLTW AroundInlineMungerTest -XterminateAfterCompilation");
}
public void testAjcLTWAroundInlineMungerTest_Xreweavable() {
runTest("AjcLTW AroundInlineMungerTest");
}
public void testAjcLTWAroundInlineMungerTest() {
runTest("AjcLTW AroundInlineMungerTest");
}
public void testAjcLTWAroundInlineMungerTest_XnoInline_Xreweavable() {
runTest("AjcLTW AroundInlineMungerTest -XnoInline -Xreweavable");
}
public void testAjcLTWAroundInlineMungerTest2() {
runTest("AjcLTW AroundInlineMungerTest2");
}
public void testLTWDumpNone() {
runTest("LTW DumpTest none");
File f = new File("_ajdump/ataspectj/DumpTest.class");
assertFalse(f.exists());
f = new File("_ajdump/_before/ataspectj/DumpTestTheDump.class");
assertFalse(f.exists());
f = new File("_ajdump/ataspectj/DumpTestTheDump.class");
assertFalse(f.exists());
}
public void testLTWDump() {
runTest("LTW DumpTest");
File f = new File("_ajdump/ataspectj/DumpTest.class");
assertFalse(f.exists());
f = new File("_ajdump/_before/ataspectj/DumpTestTheDump.class");
assertFalse(f.exists());
f = new File("_ajdump/ataspectj/DumpTestTheDump.class");
assertTrue(f.exists());
// tidy up...
f = new File("_ajdump");
FileUtil.deleteContents(f);
f.delete();
}
public void testLTWDumpBeforeAndAfter() {
runTest("LTW DumpTest before and after");
// before
File f = new File("_ajdump/_before/com/foo/bar");
CountingFilenameFilter cff = new CountingFilenameFilter(".class");
f.listFiles(cff);
assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount());
// after
f = new File("_ajdump/com/foo/bar");
cff = new CountingFilenameFilter(".class");
f.listFiles(cff);
assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount());
// tidy up...
f = new File("_ajdump");
FileUtil.deleteContents(f);
f.delete();
}
public void testLTWDumpClosure() {
runTest("LTW DumpTest closure");
File f = new File("_ajdump/ataspectj/DumpTestTheDump$AjcClosure1.class");
assertTrue("Missing dump file " + f.getAbsolutePath(), f.exists());
// tidy up...
f = new File("_ajdump");
FileUtil.deleteContents(f);
f.delete();
}
public void testLTWDumpProxy() {
runTest("LTW DumpTest proxy");
// The working directory is different because this test must be forked
File dir = new File("../tests/java5/ataspectj");
// Before Java 16, JDK proxies were given a virtual package name of 'com.sun.proxy'. Now the packages are numbered
// 'jdk.proxy[n]', i.e. 'jdk.proxy1', 'jdk.proxy2' etc. This makes the package-name-derived path name here less
// predictable. In our simple runtime scenario, we can be pretty sure than the counter starts at 1 because
// it is the first and only proxy we create.
//
// TODO: A better solution would be a recursive filtered search via Files.walk, ideally added as a recursive search
// option for CountingFilenameFilter.
String proxyDir = LangUtil.isVMGreaterOrEqual(16) ? "jdk/proxy1" : "com/sun/proxy";
File f = new File(dir, "_ajdump/_before/" + proxyDir);
CountingFilenameFilter cff = new CountingFilenameFilter(".class");
f.listFiles(cff);
assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount());
f = new File(dir, "_ajdump/" + proxyDir);
cff = new CountingFilenameFilter(".class");
f.listFiles(cff);
assertEquals(1, cff.getCount());
// tidy up...
f = new File(dir, "_ajdump");
FileUtil.deleteContents(f);
f.delete();
}
public void testLTWDumpJSP() {
runTest("LTW DumpTest JSP");
// The working directory is different because this test must be forked
File f = new File("_ajdump/_before/com/ibm/_jsp");
CountingFilenameFilter cff = new CountingFilenameFilter(".class");
f.listFiles(cff);
assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount());
f = new File("_ajdump/com/ibm/_jsp");
cff = new CountingFilenameFilter(".class");
f.listFiles(cff);
assertEquals(1, cff.getCount());
// tidy up...
f = new File("_ajdump");
FileUtil.deleteContents(f);
f.delete();
}
public void testAjcAspect1LTWAspect2_Xreweavable() {
runTest("Ajc Aspect1 LTW Aspect2 -Xreweavable");
}
public void testLTWLogSilent() {
runTest("LTW Log silent");
}
public void testLTWLogVerbose() {
runTest("LTW Log verbose");
}
public void testLTWLogVerboseAndShow() {
runTest("LTW Log verbose and showWeaveInfo");
}
public void testLTWLogMessageHandlerClass() {
runTest("LTW Log messageHandlerClass");
}
public void testLTWUnweavable() {
// actually test that we do LTW proxy and jit classes
runTest("LTW Unweavable");
}
public void testLTWDecp() {
runTest("LTW Decp");
}
public void testLTWDecp2() {
runTest("LTW Decp2");
}
public void testCompileTimeAspectsDeclaredToLTWWeaver() {
runTest("Compile time aspects declared to ltw weaver");
}
public void testConcreteAtAspect() {
runTest("Concrete@Aspect");
}
public void testConcreteAspect() {
runTest("ConcreteAspect");
}
public void testConcretePrecedenceAspect() {
runTest("ConcretePrecedenceAspect");
}
// public void testAspectOfWhenAspectNotInInclude() {
// runTest("AspectOfWhenAspectNotInInclude");
// }
//
// public void testAspectOfWhenAspectExcluded_pr152873() {
// runTest("AspectOfWhenAspectExcluded");
// }
public void testAspectOfWhenNonAspectExcluded_pr152873() {
runTest("AspectOfWhenNonAspectExcluded");
}
public void testAppContainer() {
runTest("AppContainer");
}
public void testCflowBelowStack() {
runTest("CflowBelowStack");
}
}
|