You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AtAjLTWTests.java 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. /*******************************************************************************
  2. * Copyright (c) 2005 Contributors.
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Eclipse Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * Alexandre Vasseur initial implementation
  11. *******************************************************************************/
  12. package org.aspectj.systemtest.ajc150.ataspectj;
  13. import java.io.File;
  14. import java.net.URL;
  15. import org.aspectj.testing.XMLBasedAjcTestCase;
  16. import org.aspectj.util.FileUtil;
  17. import junit.framework.Test;
  18. /**
  19. * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
  20. */
  21. public class AtAjLTWTests extends XMLBasedAjcTestCase {
  22. public static Test suite() {
  23. return XMLBasedAjcTestCase.loadSuite(org.aspectj.systemtest.ajc150.ataspectj.AtAjLTWTests.class);
  24. }
  25. protected URL getSpecFile() {
  26. return getClassResource("ltw.xml");
  27. }
  28. public void testRunThemAllWithJavacCompiledAndLTW() {
  29. runTest("RunThemAllWithJavacCompiledAndLTW");
  30. }
  31. public void testAjcLTWPerClauseTest_XterminateAfterCompilation() {
  32. runTest("AjcLTW PerClauseTest -XterminateAfterCompilation");
  33. }
  34. public void testAjcLTWPerClauseTest_Xreweavable() {
  35. runTest("AjcLTW PerClauseTest -Xreweavable");
  36. }
  37. public void testJavaCAjcLTWPerClauseTest() {
  38. runTest("JavaCAjcLTW PerClauseTest");
  39. }
  40. public void testAjcLTWAroundInlineMungerTest_XterminateAfterCompilation() {
  41. runTest("AjcLTW AroundInlineMungerTest -XterminateAfterCompilation");
  42. }
  43. public void testAjcLTWAroundInlineMungerTest_Xreweavable() {
  44. runTest("AjcLTW AroundInlineMungerTest");
  45. }
  46. public void testAjcLTWAroundInlineMungerTest() {
  47. runTest("AjcLTW AroundInlineMungerTest");
  48. }
  49. public void testAjcLTWAroundInlineMungerTest_XnoInline_Xreweavable() {
  50. runTest("AjcLTW AroundInlineMungerTest -XnoInline -Xreweavable");
  51. }
  52. public void testAjcLTWAroundInlineMungerTest2() {
  53. runTest("AjcLTW AroundInlineMungerTest2");
  54. }
  55. public void testLTWDumpNone() {
  56. runTest("LTW DumpTest none");
  57. File f = new File("_ajdump/ataspectj/DumpTest.class");
  58. assertFalse(f.exists());
  59. f = new File("_ajdump/_before/ataspectj/DumpTestTheDump.class");
  60. assertFalse(f.exists());
  61. f = new File("_ajdump/ataspectj/DumpTestTheDump.class");
  62. assertFalse(f.exists());
  63. }
  64. public void testLTWDump() {
  65. runTest("LTW DumpTest");
  66. File f = new File("_ajdump/ataspectj/DumpTest.class");
  67. assertFalse(f.exists());
  68. f = new File("_ajdump/_before/ataspectj/DumpTestTheDump.class");
  69. assertFalse(f.exists());
  70. f = new File("_ajdump/ataspectj/DumpTestTheDump.class");
  71. assertTrue(f.exists());
  72. // tidy up...
  73. f = new File("_ajdump");
  74. FileUtil.deleteContents(f);
  75. f.delete();
  76. }
  77. public void testLTWDumpBeforeAndAfter() {
  78. runTest("LTW DumpTest before and after");
  79. // before
  80. File f = new File("_ajdump/_before/com/foo/bar");
  81. CountingFilenameFilter cff = new CountingFilenameFilter(".class");
  82. f.listFiles(cff);
  83. assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount());
  84. // after
  85. f = new File("_ajdump/com/foo/bar");
  86. cff = new CountingFilenameFilter(".class");
  87. f.listFiles(cff);
  88. assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount());
  89. // tidy up...
  90. f = new File("_ajdump");
  91. FileUtil.deleteContents(f);
  92. f.delete();
  93. }
  94. public void testLTWDumpClosure() {
  95. runTest("LTW DumpTest closure");
  96. File f = new File("_ajdump/ataspectj/DumpTestTheDump$AjcClosure1.class");
  97. assertTrue("Missing dump file " + f.getAbsolutePath(), f.exists());
  98. // tidy up...
  99. f = new File("_ajdump");
  100. FileUtil.deleteContents(f);
  101. f.delete();
  102. }
  103. public void testLTWDumpProxy() {
  104. runTest("LTW DumpTest proxy");
  105. // The working directory is different because this test must be forked
  106. File dir = new File("../tests/java5/ataspectj");
  107. File f = new File(dir, "_ajdump/_before/com/sun/proxy");
  108. CountingFilenameFilter cff = new CountingFilenameFilter(".class");
  109. f.listFiles(cff);
  110. assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount());
  111. f = new File(dir, "_ajdump/com/sun/proxy");
  112. cff = new CountingFilenameFilter(".class");
  113. f.listFiles(cff);
  114. assertEquals(1, cff.getCount());
  115. // tidy up...
  116. f = new File(dir, "_ajdump");
  117. FileUtil.deleteContents(f);
  118. f.delete();
  119. }
  120. public void testLTWDumpJSP() {
  121. runTest("LTW DumpTest JSP");
  122. // The working directory is different because this test must be forked
  123. File f = new File("_ajdump/_before/com/ibm/_jsp");
  124. CountingFilenameFilter cff = new CountingFilenameFilter(".class");
  125. f.listFiles(cff);
  126. assertEquals("Expected dump file in " + f.getAbsolutePath(), 1, cff.getCount());
  127. f = new File("_ajdump/com/ibm/_jsp");
  128. cff = new CountingFilenameFilter(".class");
  129. f.listFiles(cff);
  130. assertEquals(1, cff.getCount());
  131. // tidy up...
  132. f = new File("_ajdump");
  133. FileUtil.deleteContents(f);
  134. f.delete();
  135. }
  136. public void testAjcAspect1LTWAspect2_Xreweavable() {
  137. runTest("Ajc Aspect1 LTW Aspect2 -Xreweavable");
  138. }
  139. public void testLTWLogSilent() {
  140. runTest("LTW Log silent");
  141. }
  142. public void testLTWLogVerbose() {
  143. runTest("LTW Log verbose");
  144. }
  145. public void testLTWLogVerboseAndShow() {
  146. runTest("LTW Log verbose and showWeaveInfo");
  147. }
  148. public void testLTWLogMessageHandlerClass() {
  149. runTest("LTW Log messageHandlerClass");
  150. }
  151. public void testLTWUnweavable() {
  152. // actually test that we do LTW proxy and jit classes
  153. runTest("LTW Unweavable");
  154. }
  155. public void testLTWDecp() {
  156. runTest("LTW Decp");
  157. }
  158. public void testLTWDecp2() {
  159. runTest("LTW Decp2");
  160. }
  161. public void testCompileTimeAspectsDeclaredToLTWWeaver() {
  162. runTest("Compile time aspects declared to ltw weaver");
  163. }
  164. public void testConcreteAtAspect() {
  165. runTest("Concrete@Aspect");
  166. }
  167. public void testConcreteAspect() {
  168. runTest("ConcreteAspect");
  169. }
  170. public void testConcretePrecedenceAspect() {
  171. runTest("ConcretePrecedenceAspect");
  172. }
  173. // public void testAspectOfWhenAspectNotInInclude() {
  174. // runTest("AspectOfWhenAspectNotInInclude");
  175. // }
  176. //
  177. // public void testAspectOfWhenAspectExcluded_pr152873() {
  178. // runTest("AspectOfWhenAspectExcluded");
  179. // }
  180. public void testAspectOfWhenNonAspectExcluded_pr152873() {
  181. runTest("AspectOfWhenNonAspectExcluded");
  182. }
  183. public void testAppContainer() {
  184. runTest("AppContainer");
  185. }
  186. public void testCflowBelowStack() {
  187. runTest("CflowBelowStack");
  188. }
  189. }