Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] How to test complex pointcut patterns?

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


Back to the top