[jboss-cvs] JBossAS SVN: r75982 - projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 17 20:00:00 EDT 2008


Author: flavia.rainone at jboss.com
Date: 2008-07-17 19:59:59 -0400 (Thu, 17 Jul 2008)
New Revision: 75982

Added:
   projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/MainJoinPointGraphTest.java
Log:
[JBAOP-508] Added the MainJoinPointGraphTest, that verifies the graph works as a whole.

Added: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/MainJoinPointGraphTest.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/MainJoinPointGraphTest.java	                        (rev 0)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/aop/joinpoint/graph/MainJoinPointGraphTest.java	2008-07-17 23:59:59 UTC (rev 75982)
@@ -0,0 +1,679 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.aop.joinpoint.graph;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.jboss.aop.Aspect;
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.ConByConInfo;
+import org.jboss.aop.ConByMethodInfo;
+import org.jboss.aop.ConstructionInfo;
+import org.jboss.aop.ConstructorInfo;
+import org.jboss.aop.FieldInfo;
+import org.jboss.aop.JoinPointInfo;
+import org.jboss.aop.MethodByConInfo;
+import org.jboss.aop.MethodByMethodInfo;
+import org.jboss.aop.MethodInfo;
+import org.jboss.aop.pointcut.Pointcut;
+import org.jboss.aop.pointcut.PointcutExpression;
+import org.jboss.aop.pointcut.Typedef;
+import org.jboss.aop.pointcut.TypedefExpression;
+
+/**
+ * Tests {@code MainJoinPointGraph}.
+ * 
+ * @author  <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
+public class MainJoinPointGraphTest extends FullScenarioBuilder
+{
+   public void testField1() throws Exception
+   {
+      assertExpression("get(static final * *->*)", pojo3AnyConstantRead);
+   }
+   
+   public void testField2() throws Exception
+   {
+      assertExpression("set(static final * *->*)");
+   }
+   
+   public void testField3() throws Exception
+   {
+      assertExpression("field(static final * *->*)", pojo3AnyConstantRead);
+   }
+   
+   @SuppressWarnings("deprecation")
+   public void testField4() throws Exception
+   {
+      assertExpression("field($instanceof{" + Pojo2.class.getName() + "} " +
+            this.getClass().getPackage().getName() + "..->*)", pojo2Pojo3Read,
+            pojo2Pojo3Write);
+   }
+   
+   @SuppressWarnings("deprecation")
+   public void testField5() throws Exception
+   {
+      assertExpression("set(* $instanceof{" + Pojo2.class.getName() + "}->*)",
+            pojo2Pojo3Write, pojo3IntFieldWrite, pojo3DumbFieldWrite,
+            pojo3FieldWrite);
+   }
+   
+   public void testCons1() throws Exception
+   {
+      assertExpression("construction(" + Pojo1.class.getName() + "->new())",
+            pojo1DefaultConstruction, pojo1DefaultConstruction1,
+            pojo1DefaultConstruction3);
+   }
+   
+   public void testCons2() throws Exception
+   {
+      assertExpression("construction(private " + Pojo1.class.getName() + "->new())",
+            pojo1DefaultConstruction, pojo1DefaultConstruction1,
+            pojo1DefaultConstruction3);
+   }
+   
+   public void testCons3() throws Exception
+   {
+      assertExpression("construction(public " + Pojo1.class.getName() + "->new())");
+   }
+   
+   public void testCons4() throws Exception
+   {
+      assertExpression("construction(" + Pojo1.class.getPackage().getName() +
+            "..->new())", pojo1DefaultConstruction, pojo1DefaultConstruction1,
+            pojo1DefaultConstruction3, pojo2DefaultConstruction,
+            pojo3DefaultConstruction, pojo4DefaultConstruction,
+            pojo5DefaultConstruction);
+   }
+   
+   public void testCons5() throws Exception
+   {
+      assertExpression("construction(" + Pojo1.class.getPackage().getName() +
+            "..->new(..))", pojo1DefaultConstruction, pojo1DefaultConstruction1,
+            pojo1DefaultConstruction3, pojo1IntConstruction,
+            pojo2DefaultConstruction, pojo2Pojo3Construction,
+            pojo2StringConstruction, pojo3DefaultConstruction,
+            pojo3IntLongConstruction, pojo3IntStringConstruction,
+            pojo4DefaultConstruction, pojo4IntConstruction, pojo5DefaultConstruction,
+            pojo5CollectionConstruction, pojo5Pojo3Construction,
+            annPojoMultiArgConstruction1, annPojoMultiArgConstruction2,
+            annPojoMultiArgConstruction3, annPojoMultiArgConstruction4,
+            annPojoMultiArgConstruction5, annPojoMultiArgConstruction5_2,
+            annPojoMultiArgConstruction6, annPojoMultiArgConstruction6_2,
+            annPojoMultiArgConstruction7,
+            dummyAnnotationPojo2DummyInterface2Construction,
+            anyAnnotationPojoIntConstruction);
+   }
+   
+   public void testConsExec1() throws Exception
+   {
+      Typedef typedef = new TypedefExpression("stringOrCollection",
+         "has(int *->length()) OR has(int *->size())");
+      AspectManager.instance().addTypedef(typedef);
+      assertExpression("execution($instanceof{@" + AnyAnnotation.class.getName() +
+            "}->new(..,$typedef{stringOrCollection},..))");
+   }
+   
+   public void testConsExec2() throws Exception
+   {
+      Typedef typedef = new TypedefExpression("stringOrCollection",
+         "has(int *->length()) OR has(int *->size())");
+      AspectManager.instance().addTypedef(typedef);
+      assertExpression("execution(*->new(..,$typedef{stringOrCollection},..))",
+            pojo2StringConstructorExec, pojo2StringConstructorExec2,
+            pojo2StringConstructorExec3, pojo3IntStringConstructorExec,
+            pojo5CollectionConstructorExec, annPojoMultiArgConstructor5Exec,
+            annPojoMultiArgConstructor5Exec2);
+   }
+   
+   public void testConsExec3() throws Exception
+   {
+      assertExpression("execution(private " + Pojo1.class.getName() + "->new())",
+            pojo1DefaultConstructorExec);
+   }
+   
+   public void testConsExec4() throws Exception
+   {
+      assertExpression("execution(*->new(.., @" + AnyAnnotation.class.getName() +
+            ",..))", annPojoMultiArgConstructor1Exec,
+            annPojoMultiArgConstructor5Exec, annPojoMultiArgConstructor5Exec2,
+            annPojoMultiArgConstructor6Exec, annPojoMultiArgConstructor6Exec1,
+            annPojoMultiArgConstructor6Exec3, annPojoMultiArgConstructor7Exec);
+   }
+   
+   public void testMethodExec1() throws Exception
+   {
+      assertExpression("execution(* *->*(.., @" + AnyAnnotation.class.getName() +
+            ",..))", annPojoMethod1Exec, annPojoMethod1Exec1, annPojoMethod1Exec3,
+            annPojoMethod5Exec, annPojoMethod5Exec1, annPojoMethod5Exec3,
+            annPojoMethod6Exec, annPojoMethod6Exec3, annPojoMethod7Exec,
+            annPojoMethod7Exec3);
+   }
+   
+   public void testMethodExec2() throws Exception
+   {
+      Typedef typedef = new TypedefExpression("annPojo", "class(*AnnPojo)");
+      AspectManager.instance().addTypedef(typedef);
+      assertExpression("execution(public !static !final void $typedef{annPojo}->" +
+            "method*(*, .., *))", annPojoMethod1Exec, annPojoMethod1Exec1,
+            annPojoMethod1Exec3, annPojoMethod4Exec, annPojoMethod4Exec1,
+            annPojoMethod6Exec, annPojoMethod6Exec3);
+   }
+   
+   public void testMethodExec3() throws Exception
+   {
+      Typedef typedef = new TypedefExpression("annPojo", "class(*AnnPojo)");
+      AspectManager.instance().addTypedef(typedef);
+      assertExpression("execution(public * $typedef{annPojo}->" +
+            "method*(*, .., *))",
+            annPojoMethod1Exec, annPojoMethod1Exec1, annPojoMethod1Exec3,
+            annPojoMethod2Exec, annPojoMethod2Exec1, annPojoMethod3Exec,
+            annPojoMethod3Exec1, annPojoMethod3Exec3, annPojoMethod4Exec,
+            annPojoMethod4Exec1, annPojoMethod5Exec, annPojoMethod5Exec1,
+            annPojoMethod5Exec3, annPojoMethod6Exec, annPojoMethod6Exec3);
+   }
+   
+   public void testMethodExec4() throws Exception
+   {
+      Typedef typedef = new TypedefExpression("annPojo", "class(*AnnPojo)");
+      AspectManager.instance().addTypedef(typedef);
+      assertExpression("execution(public * $typedef{annPojo}->" +
+            "method*(*, *, *, ..))",
+            annPojoMethod1Exec, annPojoMethod1Exec1, annPojoMethod1Exec3,
+            annPojoMethod2Exec, annPojoMethod2Exec1, annPojoMethod3Exec,
+            annPojoMethod3Exec1, annPojoMethod3Exec3, annPojoMethod4Exec,
+            annPojoMethod4Exec1, annPojoMethod5Exec, annPojoMethod5Exec1,
+            annPojoMethod5Exec3);
+   }
+   
+   public void testMethodExec5() throws Exception
+   {
+      Typedef typedef = new TypedefExpression("annPojo", "class(*AnnPojo)");
+      AspectManager.instance().addTypedef(typedef);
+      assertExpression("execution(public * $typedef{annPojo}->" +
+            "method*(.., *, *, *, *, ..))",
+            annPojoMethod2Exec, annPojoMethod2Exec1, annPojoMethod5Exec,
+            annPojoMethod5Exec1, annPojoMethod5Exec3);
+   }
+   
+   public void testCall1() throws Exception
+   {
+      assertExpression("call(* *->*(..))",
+            pojo1DefaultConstructor_pojo1PrivateMethod,
+            pojo1Method1_pojo1PrivateMethod,
+            pojo2StringConstructor_pojo5CalledByConMethod,
+            pojo2GetPojo2_pojo5CalledByMethod,
+            pojo2GetPojo2_pojo5CalledByMethod1, pojo2GetPojo3_pojo5CalledByMethod,
+            pojo4IntConstructor_pojo5CalledByConMethod,
+            pojo4CallMethod_pojo5CalledByMethodMethod,
+            pojo4CallMethod_pojo5CalledByMethodMethod1,
+            pojo5CollectionConstructor_pojo5CalledByCon,
+            pojo5CollectionConstructor_pojo5CalledByCon1,
+            annPojoMethod4_pojo5CalledByMethod, annPojoMethod4_pojo5CalledByMethod3);
+   }
+   
+   public void testCall2() throws Exception
+   {
+      assertExpression("call(*->new(..))",
+            pojo1DefaultConstructor_pojo1IntConstructor,
+            pojo1Method1_pojo1IntConstructor,
+            pojo2StringConstructor_pojo1IntConstructor,
+            pojo2StringConstructor_pojo2StringConstructor,
+            pojo2GetPojo2_pojo1IntConstructor, pojo2GetPojo2_pojo2StringConstructor,
+            pojo2GetPojo2_pojo2StringConstructor1, pojo2GetPojo3_pojo1IntConstructor,
+            pojo2GetPojo3_pojo2StringConstructor,
+            pojo3StringMethod_pojo1IntConstructor,
+            pojo3StringMethod_pojo1IntConstructor1,
+            pojo3StringMethod_pojo2StringConstructor,
+            pojo3StringMethod_pojo2StringConstructor1,
+            pojo4DefaultConstructor_pojo5CollectionConstructor,
+            pojo4IntConstructor_pojo5DefaultConstructor,
+            pojo4CallConstructor_pojo5Pojo3Constructor,
+            pojo4CallMethod_pojo5DefaultConstructor,
+            pojo5CollectionConstructor_pojo1IntConstructor,
+            pojo5CollectionConstructor_pojo1IntConstructor1,
+            pojo5CollectionConstructor_pojo2StringConstructor,
+            pojo5CollectionConstructor_pojo2StringConstructor1,
+            annPojoMultiArgConstructor2_pojo1IntConstructor,
+            annPojoMultiArgConstructor2_pojo1IntConstructor2,
+            annPojoMultiArgConstructor2_pojo2StringConstructor,
+            annPojoMultiArgConstructor2_pojo2StringConstructor2);
+   }
+   
+   public void testCall3() throws Exception
+   {
+      assertExpression("call(void @" + Aspect.class.getName() + "->calledBy*())",
+            pojo2StringConstructor_pojo5CalledByConMethod,
+            pojo2GetPojo2_pojo5CalledByMethod,
+            pojo2GetPojo2_pojo5CalledByMethod1, pojo2GetPojo3_pojo5CalledByMethod,
+            pojo4IntConstructor_pojo5CalledByConMethod,
+            pojo4CallMethod_pojo5CalledByMethodMethod,
+            pojo4CallMethod_pojo5CalledByMethodMethod1,
+            pojo5CollectionConstructor_pojo5CalledByCon,
+            pojo5CollectionConstructor_pojo5CalledByCon1,
+            annPojoMethod4_pojo5CalledByMethod, annPojoMethod4_pojo5CalledByMethod3);      
+   }
+   
+   public void testCall4() throws Exception
+   {
+      assertExpression("call(" + Pojo5.class.getName() + "->new())",
+            pojo4IntConstructor_pojo5DefaultConstructor,
+            pojo4CallMethod_pojo5DefaultConstructor);
+   }
+
+   public void testCallAndWithin1() throws Exception
+   {
+      assertExpression("call(void @" + Aspect.class.getName() + "->calledBy*()) " +
+            "AND within(@" + Deprecated.class.getName() + ")",
+            pojo2StringConstructor_pojo5CalledByConMethod,
+            pojo2GetPojo2_pojo5CalledByMethod,
+            pojo2GetPojo2_pojo5CalledByMethod1, pojo2GetPojo3_pojo5CalledByMethod);
+   }
+   
+   public void testCallAndWithin2() throws Exception
+   {
+      assertExpression("call(void @" + Aspect.class.getName() + "->calledBy*()) " +
+            "AND within($instanceof{@" + Deprecated.class.getName() + "})",
+            pojo2StringConstructor_pojo5CalledByConMethod,
+            pojo2GetPojo2_pojo5CalledByMethod,
+            pojo2GetPojo2_pojo5CalledByMethod1, pojo2GetPojo3_pojo5CalledByMethod,
+            pojo5CollectionConstructor_pojo5CalledByCon,
+            pojo5CollectionConstructor_pojo5CalledByCon1);
+   }
+   
+   public void testCallOrWithin() throws Exception
+   {
+      assertExpression("call(void @" + Aspect.class.getName() + "->calledBy*()) " +
+            "OR within($instanceof{@" + Deprecated.class.getName() + "})",
+            pojo2StringConstructor_pojo1IntConstructor,
+            pojo2StringConstructor_pojo2StringConstructor,
+            pojo2StringConstructor_pojo5CalledByConMethod,
+            pojo2GetPojo2_pojo1IntConstructor, pojo2GetPojo2_pojo2StringConstructor,
+            pojo2GetPojo2_pojo2StringConstructor1, pojo2GetPojo2_pojo5CalledByMethod,
+            pojo2GetPojo2_pojo5CalledByMethod1, pojo2GetPojo3_pojo1IntConstructor,
+            pojo2GetPojo3_pojo2StringConstructor, pojo2GetPojo3_pojo5CalledByMethod,
+            pojo3StringMethod_pojo1IntConstructor,
+            pojo3StringMethod_pojo1IntConstructor1,
+            pojo3StringMethod_pojo2StringConstructor,
+            pojo3StringMethod_pojo2StringConstructor1,
+            pojo4IntConstructor_pojo5CalledByConMethod,
+            pojo4CallMethod_pojo5CalledByMethodMethod,
+            pojo4CallMethod_pojo5CalledByMethodMethod1,
+            pojo5CollectionConstructor_pojo1IntConstructor,
+            pojo5CollectionConstructor_pojo1IntConstructor1,
+            pojo5CollectionConstructor_pojo2StringConstructor,
+            pojo5CollectionConstructor_pojo2StringConstructor1,
+            pojo5CollectionConstructor_pojo5CalledByCon,
+            pojo5CollectionConstructor_pojo5CalledByCon1,
+            annPojoMethod4_pojo5CalledByMethod, annPojoMethod4_pojo5CalledByMethod3);
+   }
+   
+   public void testComposition1() throws Exception
+   {
+      assertExpression("execution(*->new(..)) AND execution(* *->*(..))");
+   }
+   
+   public void testComposition2() throws Exception
+   {
+      assertExpression("execution(!static * *->*(..)) AND hasfield(" +
+            Pojo3.class.getName() + " *->*)", pojo2DoSomethingMethodExec,
+            pojo2DoSomethingMethodExec1, pojo2GetPojo3MethodExec,
+            pojo3VoidMethodExec, pojo3StringMethodExec, pojo3IntLongSomeMethodExec,
+            pojo3IntLongSomeMethodExec1, pojo3StringLongSomeMethodExec,
+            pojo3StringLongSomeMethodExec1, pojo5CalledByConExec,
+            pojo5CalledByConExec2, pojo5CalledByMethodExec);
+   }
+   
+   public void testComposition3() throws Exception
+   {
+      assertExpression("(field(int *->*) OR execution(*->new())) AND hasfield(" +
+            Pojo3.class.getName() + " *->pojo3)", pojo2DefaultConstructorExec,
+            pojo3IntFieldRead, pojo3IntFieldWrite, pojo3DefaultConstructorExec,
+            pojo5DefaultConstructorExec);
+   }
+   
+   public void testComposition4() throws Exception
+   {
+      assertExpression("execution(* "+ AnnPojo.class.getName() + "->method*(..)) " +
+            "AND (execution(* *->*(.., @" + AnyAnnotation.class.getName() + ", @" +
+            DummyAnnotation.class.getName() + ", ..)) OR execution(* *->*(.., @" +
+            DummyAnnotation.class.getName() + ", @" + AnyAnnotation.class.getName()
+            + ", ..)))", annPojoMethod1Exec, annPojoMethod1Exec1,
+            annPojoMethod1Exec3, annPojoMethod5Exec, annPojoMethod5Exec1,
+            annPojoMethod1Exec3, annPojoMethod6Exec, annPojoMethod6Exec3);
+   }
+   
+   public void testComposition5() throws Exception
+   {
+      assertExpression("execution(* "+ AnnPojo.class.getName() + "->method*(..)) " +
+            "AND (execution(* *->*(.., int, ..)) OR execution(* *->*(.., @" +
+            DummyAnnotation.class.getName() + ", @" + AnyAnnotation.class.getName()
+            + ", ..))) AND execution(* *->*(..) throws " +
+            IllegalArgumentException.class.getName() + ")", annPojoMethod4Exec,
+            annPojoMethod4Exec1);
+   }
+   
+   private void assertExpression(String expression, JoinPointInfo... infos) throws Exception
+   {
+      Pointcut pointcut = new PointcutExpression("exp", expression);
+      SearchKey searchKey = SearchKeyParser.parse(pointcut);
+      Collection<JoinPointInfo> result = MainJoinPointGraph.getInstance().search(searchKey);
+      Util.assertCollection(result, infos);
+      result = collectMatchedJoinPoints(pointcut);
+      Util.assertCollection(result, infos);
+   }
+   
+   private Collection<JoinPointInfo> collectMatchedJoinPoints(Pointcut pointcut)
+   {
+      Collection<JoinPointInfo> result = new ArrayList<JoinPointInfo>();
+      collect(pointcut, (FieldInfo) pojo1FieldRead, result);
+      collect(pointcut, (FieldInfo) pojo1FieldWrite, result);
+      collect(pointcut, (ConstructionInfo) pojo1DefaultConstruction, result);
+      collect(pointcut, (ConstructionInfo) pojo1DefaultConstruction1, result);
+      collect(pointcut, (ConstructionInfo) pojo1DefaultConstruction3, result);
+      collect(pointcut, (ConstructorInfo) pojo1DefaultConstructorExec, result);
+      collect(pointcut, (ConstructionInfo) pojo1IntConstruction, result);
+      collect(pointcut, (ConstructorInfo) pojo1IntConstructorExec, result);
+      collect(pointcut, (ConstructorInfo) pojo1IntConstructorExec2, result);
+      collect(pointcut, (MethodInfo) pojo1Method1Exec, result);
+      collect(pointcut, (MethodInfo) pojo1PrivateMethodExec, result);
+      collect(pointcut, (MethodInfo) pojo1PrivateMethodExec1, result);
+      collect(pointcut, (MethodInfo) pojo1PrivateMethodExec2, result);
+      collect(pointcut, (MethodInfo) pojo1PrivateMethodExec3, result);
+      collect(pointcut, (ConByConInfo) pojo1DefaultConstructor_pojo1IntConstructor,
+            result);
+      collect(pointcut, (MethodByConInfo) pojo1DefaultConstructor_pojo1PrivateMethod,
+            result);
+      collect(pointcut, (ConByMethodInfo) pojo1Method1_pojo1IntConstructor, result);
+      collect(pointcut, (MethodByMethodInfo) pojo1Method1_pojo1PrivateMethod, result);
+      collect(pointcut, (FieldInfo) pojo2Pojo3Read, result);
+      collect(pointcut, (FieldInfo) pojo2Pojo3Write, result);
+      collect(pointcut, (ConstructionInfo) pojo2Pojo3Construction, result);
+      collect(pointcut, (ConstructorInfo) pojo2Pojo3ConstructorExec, result);
+      collect(pointcut, (ConstructorInfo) pojo2Pojo3ConstructorExec1, result);
+      collect(pointcut, (ConstructionInfo) pojo2DefaultConstruction, result);
+      collect(pointcut, (ConstructorInfo) pojo2DefaultConstructorExec, result);
+      collect(pointcut, (ConstructionInfo) pojo2StringConstruction, result);
+      collect(pointcut, (ConstructorInfo) pojo2StringConstructorExec, result);
+      collect(pointcut, (ConstructorInfo) pojo2StringConstructorExec2, result);
+      collect(pointcut, (ConstructorInfo) pojo2StringConstructorExec3, result);
+      collect(pointcut, (MethodInfo) pojo2GetPojo2MethodExec, result);
+      collect(pointcut, (MethodInfo) pojo2GetPojo2MethodExec1, result);
+      collect(pointcut, (MethodInfo) pojo2DoSomethingMethodExec, result);
+      collect(pointcut, (MethodInfo) pojo2DoSomethingMethodExec1, result);
+      collect(pointcut, (MethodInfo) pojo2GetPojo3MethodExec, result);
+      collect(pointcut, (ConByConInfo) pojo2StringConstructor_pojo1IntConstructor,
+            result);
+      collect(pointcut, (ConByConInfo) pojo2StringConstructor_pojo2StringConstructor,
+            result);
+      collect(pointcut, (MethodByConInfo)
+            pojo2StringConstructor_pojo5CalledByConMethod, result);
+      collect(pointcut, (ConByMethodInfo) pojo2GetPojo2_pojo1IntConstructor, result);
+      collect(pointcut, (ConByMethodInfo) pojo2GetPojo2_pojo2StringConstructor,
+            result);
+      collect(pointcut, (ConByMethodInfo) pojo2GetPojo2_pojo2StringConstructor1,
+            result);
+      collect(pointcut, (MethodByMethodInfo) pojo2GetPojo2_pojo5CalledByMethod,
+            result);
+      collect(pointcut, (MethodByMethodInfo) pojo2GetPojo2_pojo5CalledByMethod1,
+            result);
+      collect(pointcut, (ConByMethodInfo) pojo2GetPojo3_pojo1IntConstructor, result);
+      collect(pointcut, (ConByMethodInfo) pojo2GetPojo3_pojo2StringConstructor,
+            result);
+      collect(pointcut, (MethodByMethodInfo) pojo2GetPojo3_pojo5CalledByMethod,
+            result);
+      collect(pointcut, (FieldInfo) pojo3IntFieldRead, result);
+      collect(pointcut, (FieldInfo) pojo3IntFieldWrite, result);
+      collect(pointcut, (FieldInfo) pojo3DumbFieldRead, result);
+      collect(pointcut, (FieldInfo) pojo3DumbFieldWrite, result);
+      collect(pointcut, (FieldInfo) pojo3AnyConstantRead, result);
+      collect(pointcut, (FieldInfo) pojo3FieldRead, result);
+      collect(pointcut, (FieldInfo) pojo3FieldWrite, result);
+      collect(pointcut, (ConstructionInfo) pojo3DefaultConstruction, result);
+      collect(pointcut, (ConstructorInfo) pojo3DefaultConstructorExec, result);
+      collect(pointcut, (ConstructionInfo) pojo3IntLongConstruction, result);
+      collect(pointcut, (ConstructorInfo) pojo3IntLongConstructorExec, result);
+      collect(pointcut, (ConstructionInfo) pojo3IntStringConstruction, result);
+      collect(pointcut, (ConstructorInfo) pojo3IntStringConstructorExec, result);
+      collect(pointcut, (MethodInfo) pojo3VoidMethodExec, result);
+      collect(pointcut, (MethodInfo) pojo3StringMethodExec, result);
+      collect(pointcut, (MethodInfo) pojo3IntLongSomeMethodExec, result);
+      collect(pointcut, (MethodInfo) pojo3IntLongSomeMethodExec1, result);
+      collect(pointcut, (MethodInfo) pojo3StringLongSomeMethodExec, result);
+      collect(pointcut, (MethodInfo) pojo3StringLongSomeMethodExec1, result);
+      collect(pointcut, (ConByMethodInfo) pojo3StringMethod_pojo1IntConstructor,
+            result);
+      collect(pointcut, (ConByMethodInfo) pojo3StringMethod_pojo1IntConstructor1,
+            result);
+      collect(pointcut, (ConByMethodInfo) pojo3StringMethod_pojo2StringConstructor,
+            result);
+      collect(pointcut, (ConByMethodInfo) pojo3StringMethod_pojo2StringConstructor1,
+            result);
+      collect(pointcut, (ConstructionInfo) pojo4DefaultConstruction, result);
+      collect(pointcut, (ConstructorInfo) pojo4DefaultConstructorExec, result);
+      collect(pointcut, (ConstructionInfo) pojo4IntConstruction, result);
+      collect(pointcut, (ConstructorInfo) pojo4IntConstructorExec, result);
+      collect(pointcut, (MethodInfo) pojo4CallConstructorMethodExec, result);
+      collect(pointcut, (MethodInfo) pojo4CallMethodMethodExec, result);
+      collect(pointcut, (ConByConInfo)
+            pojo4DefaultConstructor_pojo5CollectionConstructor, result);
+      collect(pointcut, (ConByConInfo) pojo4IntConstructor_pojo5DefaultConstructor,
+            result);
+      collect(pointcut, (MethodByConInfo) pojo4IntConstructor_pojo5CalledByConMethod,
+            result);
+      collect(pointcut, (ConByMethodInfo) pojo4CallConstructor_pojo5Pojo3Constructor,
+            result);
+      collect(pointcut, (ConByMethodInfo) pojo4CallMethod_pojo5DefaultConstructor,
+            result);
+      collect(pointcut, (MethodByMethodInfo)
+            pojo4CallMethod_pojo5CalledByMethodMethod, result);
+      collect(pointcut, (MethodByMethodInfo)
+            pojo4CallMethod_pojo5CalledByMethodMethod1, result);
+      collect(pointcut, (ConstructionInfo) pojo5DefaultConstruction, result);
+      collect(pointcut, (ConstructorInfo) pojo5DefaultConstructorExec, result);
+      collect(pointcut, (ConstructionInfo) pojo5CollectionConstruction, result);
+      collect(pointcut, (ConstructorInfo) pojo5CollectionConstructorExec, result);
+      collect(pointcut, (ConstructionInfo) pojo5Pojo3Construction, result);
+      collect(pointcut, (ConstructorInfo) pojo5Pojo3ConstructorExec, result);
+      collect(pointcut, (MethodInfo) pojo5CalledByConExec, result);
+      collect(pointcut, (MethodInfo) pojo5CalledByConExec2, result);
+      collect(pointcut, (MethodInfo) pojo5CalledByMethodExec, result);
+      collect(pointcut, (ConByConInfo)
+            pojo5CollectionConstructor_pojo1IntConstructor, result);
+      collect(pointcut, (ConByConInfo)
+            pojo5CollectionConstructor_pojo1IntConstructor1, result);
+      collect(pointcut, (ConByConInfo)
+            pojo5CollectionConstructor_pojo2StringConstructor, result);
+      collect(pointcut, (ConByConInfo)
+            pojo5CollectionConstructor_pojo2StringConstructor1, result);
+      collect(pointcut, (MethodByConInfo)
+            pojo5CollectionConstructor_pojo5CalledByCon, result);
+      collect(pointcut, (MethodByConInfo)
+            pojo5CollectionConstructor_pojo5CalledByCon1, result);
+      collect(pointcut, (ConstructionInfo) annPojoMultiArgConstruction1, result);
+      collect(pointcut, (ConstructorInfo) annPojoMultiArgConstructor1Exec, result);
+      collect(pointcut, (ConstructionInfo) annPojoMultiArgConstruction2, result);
+      collect(pointcut, (ConstructorInfo) annPojoMultiArgConstructor2Exec, result);
+      collect(pointcut, (ConstructionInfo) annPojoMultiArgConstruction3, result);
+      collect(pointcut, (ConstructorInfo) annPojoMultiArgConstructor3Exec, result);
+      collect(pointcut, (ConstructorInfo) annPojoMultiArgConstructor3Exec1, result);
+      collect(pointcut, (ConstructionInfo) annPojoMultiArgConstruction4, result);
+      collect(pointcut, (ConstructorInfo) annPojoMultiArgConstructor4Exec, result);
+      collect(pointcut, (ConstructorInfo) annPojoMultiArgConstructor4Exec2, result);
+      collect(pointcut, (ConstructionInfo) annPojoMultiArgConstruction5, result);
+      collect(pointcut, (ConstructionInfo) annPojoMultiArgConstruction5_2, result);
+      collect(pointcut, (ConstructorInfo) annPojoMultiArgConstructor5Exec, result);
+      collect(pointcut, (ConstructorInfo) annPojoMultiArgConstructor5Exec2, result);
+      collect(pointcut, (ConstructionInfo) annPojoMultiArgConstruction6, result);
+      collect(pointcut, (ConstructionInfo) annPojoMultiArgConstruction6_2, result);
+      collect(pointcut, (ConstructorInfo) annPojoMultiArgConstructor6Exec, result);
+      collect(pointcut, (ConstructorInfo) annPojoMultiArgConstructor6Exec1, result);
+      collect(pointcut, (ConstructorInfo) annPojoMultiArgConstructor6Exec3, result);
+      collect(pointcut, (ConstructionInfo) annPojoMultiArgConstruction7, result);
+      collect(pointcut, (ConstructorInfo) annPojoMultiArgConstructor7Exec, result);
+      collect(pointcut, (MethodInfo) annPojoMethod1Exec, result);
+      collect(pointcut, (MethodInfo) annPojoMethod1Exec1, result);
+      collect(pointcut, (MethodInfo) annPojoMethod1Exec3, result);
+      collect(pointcut, (MethodInfo) annPojoMethod2Exec, result);
+      collect(pointcut, (MethodInfo) annPojoMethod2Exec1, result);
+      collect(pointcut, (MethodInfo) annPojoMethod3Exec, result);
+      collect(pointcut, (MethodInfo) annPojoMethod3Exec1, result);
+      collect(pointcut, (MethodInfo) annPojoMethod3Exec3, result);
+      collect(pointcut, (MethodInfo) annPojoMethod4Exec, result);
+      collect(pointcut, (MethodInfo) annPojoMethod4Exec1, result);
+      collect(pointcut, (MethodInfo) annPojoMethod5Exec, result);
+      collect(pointcut, (MethodInfo) annPojoMethod5Exec1, result);
+      collect(pointcut, (MethodInfo) annPojoMethod5Exec3, result);
+      collect(pointcut, (MethodInfo) annPojoMethod6Exec, result);
+      collect(pointcut, (MethodInfo) annPojoMethod6Exec3, result);
+      collect(pointcut, (MethodInfo) annPojoMethod7Exec, result);
+      collect(pointcut, (MethodInfo) annPojoMethod7Exec3, result);
+      collect(pointcut, (ConByConInfo)
+            annPojoMultiArgConstructor2_pojo1IntConstructor, result);
+      collect(pointcut, (ConByConInfo)
+            annPojoMultiArgConstructor2_pojo1IntConstructor2, result);
+      collect(pointcut, (ConByConInfo)
+            annPojoMultiArgConstructor2_pojo2StringConstructor, result);
+      collect(pointcut, (ConByConInfo)
+            annPojoMultiArgConstructor2_pojo2StringConstructor2, result);
+      collect(pointcut, (MethodByMethodInfo) annPojoMethod4_pojo5CalledByMethod,
+            result);
+      collect(pointcut, (MethodByMethodInfo) annPojoMethod4_pojo5CalledByMethod3,
+            result);
+      collect(pointcut, (ConstructionInfo) anyAnnotationPojoIntConstruction, result);
+      collect(pointcut, (ConstructorInfo) anyAnnotationPojoIntConstructorExec,
+            result);
+      collect(pointcut, (MethodInfo) anyAnnotationPojoMethod1Exec, result);
+      collect(pointcut, (MethodInfo) anyAnnotationPojoMethod2Exec, result);
+      collect(pointcut, (MethodInfo) dummyAnnotationPojoMethodExec, result);
+      collect(pointcut, (MethodInfo) dummyAnnotationPojoInterfaceMethodExec, result);
+      collect(pointcut, (MethodInfo) dummyAnnotationPojoInterfaceMethodExec2,
+            result);
+      collect(pointcut, (MethodInfo) dummyAnnotationPojoInterfaceMethod2Exec,
+            result);
+      collect(pointcut, (MethodInfo) dummyAnnotationPojoInterfaceMethod2Exec1,
+            result);
+      collect(pointcut, (MethodInfo) dummyAnnotationPojoInterfaceMethod2Exec2,
+            result);
+      collect(pointcut, (ConstructionInfo)
+            dummyAnnotationPojo2DummyInterface2Construction, result);
+      collect(pointcut, (ConstructorInfo)
+            dummyAnnotationPojo2DummyInterface2ConstructorExec, result);
+      collect(pointcut, (MethodInfo) dummyAnnotationPojo2Method1Exec, result);
+      collect(pointcut, (MethodInfo) dummyAnnotationPojo2Method2Exec, result);
+      collect(pointcut, (MethodInfo) dummyAnnotationPojo2InterfaceMethodExec,
+            result);
+      collect(pointcut, (MethodInfo) dummyAnnotationPojo2InterfaceMethod2Exec,
+            result);
+      return result;
+   }
+   
+   private void collect(Pointcut pointcut, FieldInfo fieldInfo,
+         Collection<JoinPointInfo> infos)
+   {
+      if (fieldInfo.isRead() && pointcut.matchesGet(fieldInfo.getAdvisor(), fieldInfo.getField()))
+      {
+         infos.add(fieldInfo);
+      }
+      else if (!fieldInfo.isRead() && pointcut.matchesSet(fieldInfo.getAdvisor(),
+            fieldInfo.getField()))
+      {
+         infos.add(fieldInfo);
+      }
+   }
+   
+   private void collect(Pointcut pointcut, ConstructorInfo constructorInfo,
+         Collection<JoinPointInfo> infos)
+   {
+      if (pointcut.matchesExecution(constructorInfo.getAdvisor(), constructorInfo.getConstructor()))
+      {
+         infos.add(constructorInfo);
+      }
+   }
+   
+   private void collect(Pointcut pointcut, ConstructionInfo constructionInfo,
+         Collection<JoinPointInfo> infos)
+   {
+      if (pointcut.matchesConstruction(constructionInfo.getAdvisor(),
+            constructionInfo.getConstructor()))
+      {
+         infos.add(constructionInfo);
+      }
+   }
+   
+   private void collect(Pointcut pointcut, MethodInfo methodInfo,
+         Collection<JoinPointInfo> infos)
+   {
+      if (pointcut.matchesExecution(methodInfo.getAdvisor(),
+            methodInfo.getMethod())!= null)
+      {
+         infos.add(methodInfo);
+      }
+   }
+   
+   private void collect(Pointcut pointcut, ConByConInfo constructorCallInfo,
+         Collection<JoinPointInfo> infos)
+   {
+      if (pointcut.matchesCall(constructorCallInfo.getAdvisor(),
+            constructorCallInfo.getCallingConstructor(),
+            constructorCallInfo.getCalledClass(),
+            constructorCallInfo.getConstructor()))
+      {
+         infos.add(constructorCallInfo);
+      }
+   }
+   
+   private void collect(Pointcut pointcut, ConByMethodInfo constructorCallInfo,
+         Collection<JoinPointInfo> infos)
+   {
+      if (pointcut.matchesCall(constructorCallInfo.getAdvisor(),
+            constructorCallInfo.getCallingMethod(),
+            constructorCallInfo.getCalledClass(),
+            constructorCallInfo.getConstructor()))
+      {
+         infos.add(constructorCallInfo);
+      }
+   }
+   
+   private void collect(Pointcut pointcut, MethodByConInfo methodCallInfo,
+         Collection<JoinPointInfo> infos)
+   {
+      if (pointcut.matchesCall(methodCallInfo.getAdvisor(),
+            methodCallInfo.getCallingConstructor(), methodCallInfo.getCalledClass(),
+            methodCallInfo.getMethod()))
+      {
+         infos.add(methodCallInfo);
+      }
+   }
+   
+   private void collect(Pointcut pointcut, MethodByMethodInfo methodCallInfo,
+         Collection<JoinPointInfo> infos)
+   {
+      if (pointcut.matchesCall(methodCallInfo.getAdvisor(),
+            methodCallInfo.getCallingMethod(), methodCallInfo.getCalledClass(),
+            methodCallInfo.getMethod()))
+      {
+         infos.add(methodCallInfo);
+      }
+   }
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list