Results 1 to 3 of 3

Thread: How do I test the pointcuts

  1. #1
    Join Date
    Jun 2007
    Posts
    15

    Default How do I test the pointcuts

    I have written an aspect to audit trail some functions in my web services. To test this aspect, I can write a JUnit to cover the recordUserAccess function,
    How can I unit test how many functions this adviser is being applied to. I want to test this against the functions which I really want to audit. What might happen
    is that as project progresses more functions could sneekily get the adviser, just because they happen to match the expression.

    <aop:config>
    <aop:aspect ref="auditor">
    <aop:after-returning
    method="recordUserAccess"
    pointcut="execution(* com.mycompany.someproject.service.webservice.*WebS ervice.get*(..)) and args(adviserId)" />
    </aop:aspect>
    </aop:config>

    Also, I would not want to copy the expression in a unit test, may be some how excess this pointcut using some Id and test it. Is this possible?
    Regards,
    Ashish Jamthe

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,629

    Default

    If you would use SpringIDE it shows you in a handy window which methods get advised by your pointcut.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Jun 2007
    Posts
    15

    Default

    Thanks for the tip. No, We use IntelliJ IDEA 6.0. I was looking for a JUnit kind of test which could be run under cruize.

    Regards,
    Ashish Jamthe

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •