[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[aspectj-users] Re: How to prevent AJDT from weaving some class?
- From: Benyi Wang <bewang.tech@xxxxxxxxx>
- Date: Thu, 20 May 2010 11:24:25 -0700
- Delivered-to: firstname.lastname@example.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=0OJPVKHPHe/bW2CP2nV42+XC9gLhVLKAejU7KlRwUl4=; b=cthzlyau7vtzgdDFeOgR6JuUCWII0oNPvFqlmXFhkdmlbZlUCxC4rVvBDr8lePVC5M /xmIwPP3B7k0piWPlfuIoTcsv+P/QvWNBwhzdi6+pRbXxsdmm1DHyCGtPAdEOAZ9UF3e X/oRE+NfYtoxE+Cz2K3uKm51dAtR98N603W5o=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=rU7NTLoImAcdisy3J1hOtOEBOCUkZzwzf/5vDZ+Wnbll1zumCx50JKzBJTNqTIPWsU 0x4hgj/UAvzCm2I31yj1JgdRSgzh9g6byKCeTl0EpdiqxaD1rBOFIun+VosPk9vSp9U9 sP6KyzcyADbzdt6aBjri+nkem/oWDDc+qeHJE=
Another big issue is about the mock object:
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>
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?