Here is the actual code:

aspect GuavaAspect{
        
        public boolean trackState;
        declare precedence : GuavaAspect, *;    
        protected pointcut traceMethods() :(execution(*
junit.framework.TestCase+.*(..))&&!cflow(within(GuavaAspect)));
        protected pointcut traceMethods2() :(execution(* *(..)) &&
!cflow(within(GuavaAspect)));
        
        before() : traceMethods2() {
                        if(trackState){
                                //do something here
                        }
                } 
        before() : traceMethods() {
                Signature sig = thisJoinPointStaticPart.getSignature();
                String testCaseName=sig.getName();
                if(testCaseName.length()>=4){
                        String test=testCaseName.substring(0, 4);
                        if(test.equals("test")){                
                                trackState=true;
                        }
                }
        }
        after()  : traceMethods(){
                trackState=false;
                Signature sig = thisJoinPointStaticPart.getSignature();
                String testCaseName=sig.getName();
                if(testCaseName.length()>=4){
                        String test=testCaseName.substring(0, 4);
                        if(test.equals("test")){                
                                try{
                                        //write to file
                                }
                                catch(Exception e){
                                        e.printStackTrace();
                                }
                        }
                }
        }
        }               
        

We are trying to use this to track the test cases that are run in:

https://github.com/google/guava

project. (under guava-tests directory) Any help would be really great!



--
View this message in context: 
http://aspectj.2085585.n4.nabble.com/Is-It-Possible-For-Two-PointCut-To-Go-Infinite-Loop-tp4651983p4651986.html
Sent from the AspectJ - users mailing list archive at Nabble.com.
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to