Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ajdt-dev] Re: How to prevent AJDT from weaving some class?

can you please raise a bug and attach your project.  I don't quite
follow you here, we can discuss it more in a bug.

Andy

On 20 May 2010 11:24, Benyi Wang <bewang.tech@xxxxxxxxx> wrote:
> Another big issue is about the mock object:
> expect(obj.addNewString("ABC")).andReturn("ABC");
> AJDT weaves the advice into this line, but the mock object doesn't work
> before replay(obj) is called. When you run the unit test, you will get null
> instead of "ABC".
> MyAspect: before adding new data
> MyAspect: add ABC and got null
> So the aspect doesn't work correctly for mock objects.
> On Thu, May 20, 2010 at 10:59 AM, Benyi Wang <bewang.tech@xxxxxxxxx> wrote:
>>
>> It seems that AJDT tries to weave all classes in a project by default.
>> I attached files in a test project.
>> When I use "call" for pointcuts of interface Addable in MyAspect, AJDT
>> tries to weave the interface calls of the mock object. Sometimes I don't
>> want the advices in my unit test code, for example, advices from the log
>> aspect.
>> How can I prevent AJDT from weaving junit test case classes?
>> I did a test in my Eclipse 3.5 with AJDT 2.0.2.
>> If I add aop.xml into project properties->AspectJ Builder->aop.xml
>> Management, some wired things happens:
>>
>> all aspectj advice markers are gone. You need to clean the project first,
>> otherwise you may see the markers are still there.
>> if you clean the project "Project->clean...", only the files under
>> src/main/java are compiled, src/test/java are not compiled.
>> remove aop.xml from aop.xml management, everything comes back.
>>
>> What's wrong in my project? Is this AJDT bug?
>> Thanks.
>> Ben
>
> _______________________________________________
> ajdt-dev mailing list
> ajdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/ajdt-dev
>
>


Back to the top