[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[aspectj-users] How to test complex pointcut patterns?
- From: maly.velky@xxxxxxxx
- Date: Fri, 25 Sep 2009 13:16:04 +0200 (CEST)
- Delivered-to: firstname.lastname@example.org
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=email.cz; h=To:Date:Reply-To:From:Received:Subject:Content-Transfer-Encoding:Content-Type:Mime-Version:Message-Id:X-Abuse:X-Seznam-User:X-QM-Mark; b=VBCqEh15qGFOUa47eJEEx63YzfQcjnYiD0+t0IXySgdBa378ZgmfvhmKmKoy96kA4 fwr/IcZE1JCcXSOICn08vuvcZggBWmB60DKf9PQMObM/PSt+QpsNLXRwKV4tduWSYJV Vll3quMbgRCqM2bc7Ko6gRWru1uLDbBkhkiHhO8=
Hello, are there please some tools for testing complex pointcut expressions, like the following one (taken from aop.xml):
(portletEntryMethods() AND !cflowbelow(portletEntryMethods())) || (call(* javax.xml.soap.SOAPConnection.call(..)) AND within(com.tonbeller.jpivot.xmla.XMLA_SOAP)) || (within(com.tonbeller..*) AND (execution(* XMLA_SOAP.discover(..)) || execution(* XMLA_SOAP.executeQuery(..)) || execution(* XMLA_Model.lookup*(..)) || execution(* XMLA_Model.initCubeMetaData(..)) || execution(* XMLA_Model.getResult(..)) || execution(* XMLA_Result.handle*(..)) || execution(* XMLA_QueryAdapter.afterExecute(..)) || execution(* RendererTag.doEndTag(..)) || execution(* TableComponent.render(..)) || execution(* *.doEndTag(..)) ))
(The pointcut is so complex because it's a specification of an abstract pointcut in aop.xml, in an aspect class I'd split it into multiple poincuts.)
The problem with such a complex pattern is that when it fails to match some expected join point then you have no idea which part of it is wrong. There is of course the laborious manual process of splitting it into individual, simple pointcuts and testing them then trying their combinations... . But it's just too time-consuming.
I wonder if there is:
A) either an interactive pattern-testing tool like the jEdit plugin 'RE Tester' for testing regular expression (checking the pattern against classes on the classpath)
B) or a tool that would again check the pattern against a set of classes and provided detailed information about the matching process with useful reports like "the subpatern ... didn't match due to the condition 'within(com.tonbeller..*)' for there is no sub-package of 'com.tonbeller' and there is also no package 'com.tonbeller'". Such a tool would make writing correct expressions much easier.
What do you use for getting your pointcut patterns right?
Thank you very much!
Best Regards, Jakub Holy