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 7.1KB

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