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.

ltw-tests.xml 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <!-- Load-time weaving tests -->
  2. <ajc-test dir="ltw"
  3. title="Ensure 1st aspect is rewoven when weaving 2nd aspect"
  4. keywords="reweavable">
  5. <compile
  6. files="Main.java, Aspect1.aj"
  7. outjar="main1.jar"
  8. options="-showWeaveInfo"
  9. >
  10. <message kind="weave" text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
  11. </compile>
  12. <compile
  13. classpath="main1.jar"
  14. files="Aspect2.aj"
  15. outjar="aspect2.jar"
  16. options="-showWeaveInfo"
  17. >
  18. </compile>
  19. <run class="Main" ltw="aop-ltwreweavable.xml">
  20. <stdout>
  21. <line text="Main.main"/>
  22. <line text="Main.test1"/>
  23. <line text="Main.test2"/>
  24. </stdout>
  25. <stderr>
  26. <line text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
  27. <line text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)"/>
  28. <line text="Aspect1.before_test1"/>
  29. <line text="Aspect2.before_test2"/>
  30. </stderr>
  31. </run>
  32. </ajc-test>
  33. <ajc-test dir="ltw"
  34. title="Ensure valid aop.xml file is generated"
  35. keywords="-outxml">
  36. <compile
  37. files="Main.java"
  38. outjar="main.jar"
  39. >
  40. </compile>
  41. <compile
  42. classpath="main.jar"
  43. files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj"
  44. outxmlfile="META-INF/aop.xml"
  45. >
  46. </compile>
  47. <run class="Main" ltw="">
  48. <stdout>
  49. <line text="Main.main"/>
  50. <line text="Main.test1"/>
  51. <line text="Main.test2"/>
  52. </stdout>
  53. <stderr>
  54. <line text="Aspect1.before_test1"/>
  55. <line text="Aspect2.before_test2"/>
  56. <line text="pakkage.Aspect3.before_test2"/>
  57. </stderr>
  58. </run>
  59. </ajc-test>
  60. <ajc-test dir="ltw"
  61. title="Ensure valid aop.xml is generated for -outjar"
  62. keywords="-outxml">
  63. <compile
  64. files="Main.java"
  65. outjar="main.jar"
  66. >
  67. </compile>
  68. <compile
  69. classpath="main.jar"
  70. files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj"
  71. outjar="aspects.jar"
  72. options="-outxml"
  73. >
  74. </compile>
  75. <run class="Main" ltw="">
  76. <stdout>
  77. <line text="Main.main"/>
  78. <line text="Main.test1"/>
  79. <line text="Main.test2"/>
  80. </stdout>
  81. <stderr>
  82. <line text="Aspect1.before_test1"/>
  83. <line text="Aspect2.before_test2"/>
  84. <line text="pakkage.Aspect3.before_test2"/>
  85. </stderr>
  86. </run>
  87. </ajc-test>
  88. <ajc-test dir="ltw"
  89. title="Ensure no weaving without visible aop.xml"
  90. keywords="reweavable">
  91. <compile
  92. files="TestMain.java, Main.java"
  93. >
  94. </compile>
  95. <run class="TestMain" ltw="">
  96. <stdout>
  97. <line text="Main.main"/>
  98. <line text="Main.test1"/>
  99. <line text="Main.test2"/>
  100. </stdout>
  101. <stderr>
  102. <line text="info register classloader org.aspectj.weaver.loadtime.WeavingURLClassLoader"/>
  103. <line text="info no configuration found. Disabling weaver for class loader org.aspectj.weaver.loadtime.WeavingURLClassLoader"/>
  104. </stderr>
  105. </run>
  106. </ajc-test>
  107. <ajc-test dir="ltw"
  108. title="Define concrete sub-aspect using aop.xml"
  109. keywords="aop.xml">
  110. <compile
  111. files="Main.java"
  112. outjar="main.jar"
  113. >
  114. </compile>
  115. <compile
  116. classpath="main1.jar"
  117. files="AbstractSuperAspect.aj"
  118. outjar="aspect.jar"
  119. >
  120. </compile>
  121. <run class="Main" ltw="aop-defineaspect.xml">
  122. <stdout>
  123. <line text="Main.main"/>
  124. <line text="Main.test1"/>
  125. <line text="Main.test2"/>
  126. </stdout>
  127. <stderr>
  128. <line text="AbstractSuperAspect.before_test1"/>
  129. </stderr>
  130. </run>
  131. </ajc-test>
  132. <ajc-test dir="ltw"
  133. title="Use abstract aspect for ITD using aop.xml"
  134. keywords="abstract aspect, ITD">
  135. <compile
  136. files="TestITDMethod.java"
  137. >
  138. </compile>
  139. <compile
  140. files="AbstractAspect.aj"
  141. >
  142. <message kind="warning" text="this affected type is not exposed to the weaver: TestITDMethod"/>
  143. </compile>
  144. <run class="TestITDMethod" options="test" ltw="aop-abstractaspect.xml">
  145. <stdout>
  146. <line text="TestITDMethod.main"/>
  147. </stdout>
  148. <stderr>
  149. <line text="weaveinfo Type 'TestITDMethod' (TestITDMethod.java) has intertyped method from 'AbstractAspect' (AbstractAspect.aj:'void TestITDMethod.test()')"/>
  150. <line text="AbstractAspect_TestITDMethod.test"/>
  151. </stderr>
  152. </run>
  153. </ajc-test>
  154. <ajc-test dir="ltw"
  155. title="Ensure a subset of inherited aspects is used for weaving"
  156. keywords="aspects, include">
  157. <compile
  158. files="Main.java"
  159. outjar="main.jar"
  160. >
  161. </compile>
  162. <compile
  163. classpath="main.jar"
  164. files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj"
  165. outjar="aspects.jar"
  166. options="-outxml"
  167. >
  168. </compile>
  169. <run class="Main" ltw="aop-aspectsinclude.xml">
  170. <stdout>
  171. <line text="Main.main"/>
  172. <line text="Main.test1"/>
  173. <line text="Main.test2"/>
  174. </stdout>
  175. <stderr>
  176. <line text="pakkage.Aspect3.before_test2"/>
  177. </stderr>
  178. </run>
  179. </ajc-test>
  180. <ajc-test dir="ltw"
  181. title="Ensure weaver lint warning issued when an aspect is not used for weaving"
  182. keywords="aspects, include, lint">
  183. <compile
  184. files="Main.java"
  185. outjar="main.jar"
  186. >
  187. </compile>
  188. <compile
  189. classpath="main.jar"
  190. files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj"
  191. outjar="aspects.jar"
  192. options="-outxml"
  193. >
  194. </compile>
  195. <run class="Main" ltw="aop-aspectsincludewithlintwarning.xml">
  196. <stdout>
  197. <line text="Main.main"/>
  198. <line text="Main.test1"/>
  199. <line text="Main.test2"/>
  200. </stdout>
  201. <stderr>
  202. <line text="warning aspect Aspect1 exluded for class loader org.aspectj.weaver.loadtime.WeavingURLClassLoader [Xlint:aspectExcludedByConfiguration]"/>
  203. <line text="warning aspect Aspect2 exluded for class loader org.aspectj.weaver.loadtime.WeavingURLClassLoader [Xlint:aspectExcludedByConfiguration]"/>
  204. <line text="pakkage.Aspect3.before_test2"/>
  205. </stderr>
  206. </run>
  207. </ajc-test>