Package org.codehaus.aspectwerkz.reflect

Examples of org.codehaus.aspectwerkz.reflect.MethodInfo


                .getExpression().match(new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
    }

    // Tests: http://jira.codehaus.org/browse/AW-223
    public void testClassAttribute2() throws Exception {
        MethodInfo method = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers1", new Class[] {}));
        assertTrue(new ExpressionInfo("execution(void test.expression.*.*(..)) AND within(@Serializable *..*)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.EXECUTION, method, s_declaringType)));
        assertFalse(new ExpressionInfo("execution(void test.expression.*.*(..)) AND within(@FakeAnnotation *..*)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.EXECUTION, method, s_declaringType)));
    }
View Full Code Here


            new ExpressionContext(PointcutType.EXECUTION, method, s_declaringType)));
    }

    // ============ pointcut type tests =============
    public void testPointcutTypes() throws Exception {
        MethodInfo method = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers1", new Class[] {}));
        FieldInfo field = JavaFieldInfo.getFieldInfo(Target.class.getDeclaredField("modifier1"));
        assertTrue(new ExpressionInfo("execution(void test.expression.Target.modifiers1())", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.EXECUTION, method, null)));
        assertFalse(new ExpressionInfo("execution(void test.expression.Target.modifiers1())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, method, null)));
View Full Code Here

    }

    // ============ cflow type tests =============
    public void testFindCflowPointcut() throws Exception {
        MethodInfo method1 = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers1", new Class[] {}));
        MethodInfo method2 = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers2", new Class[] {}));
        MethodInfo method3 = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers3", new Class[] {}));
        s_namespace.addExpressionInfo("pc1", new ExpressionInfo(
            "execution(void test.expression.Target.modifiers2())",
            NAMESPACE));
        s_namespace.addExpressionInfo("pc2", new ExpressionInfo(
            "execution(void test.expression.Target.modifiers3())",
View Full Code Here

            "call(void test.expression.Target.modifiers1()) && execution(void test.expression.Target.modifiers1())",
            NAMESPACE).hasCflowPointcut());
    }

    public void testCflowTypes() throws Exception {
        MethodInfo method1 = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers1", new Class[] {}));
        MethodInfo method2 = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers2", new Class[] {}));
        MethodInfo method3 = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers3", new Class[] {}));
        s_namespace.addExpressionInfo("pc1", new ExpressionInfo(
            "execution(void test.expression.Target.modifiers2())",
            NAMESPACE));
        s_namespace.addExpressionInfo("pc2", new ExpressionInfo(
            "execution(void test.expression.Target.modifiers3())",
View Full Code Here

            "execution(void test.expression.Target.modifiers2()) AND NOT cflow(call(void test.expression.Target.modifiers1()))",
            NAMESPACE).getCflowExpression().match(new ExpressionContext(PointcutType.CALL, method1, null)));
    }

    public void testCflowBelowTypes() throws Exception {
        MethodInfo method1 = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers1", new Class[] {}));
        MethodInfo method2 = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers2", new Class[] {}));
        MethodInfo method3 = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers3", new Class[] {}));
        s_namespace.addExpressionInfo("pc1", new ExpressionInfo(
            "execution(void test.expression.Target.modifiers2())",
            NAMESPACE));
        s_namespace.addExpressionInfo("pc2", new ExpressionInfo(
            "execution(void test.expression.Target.modifiers3())",
View Full Code Here

    }

    // ============ within type tests =============
    public void testWithinType1() throws Exception {
        ClassInfo klass = JavaClassInfo.getClassInfo(Target.class);
        MethodInfo method = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers1", new Class[] {}));
        assertTrue(new ExpressionInfo(
            "execution(void test.expression.Target.modifiers1()) AND within(test.expression.Target)",
            NAMESPACE).getExpression().match(new ExpressionContext(PointcutType.EXECUTION, method, s_declaringType)));
        assertTrue(new ExpressionInfo(
            "call(void test.expression.Target.modifiers1()) AND within(test.expression.Target)",
View Full Code Here

            NAMESPACE).getExpression().match(new ExpressionContext(PointcutType.CALL, method, s_declaringType)));
    }

    public void testWithinType2() throws Exception {
        ClassInfo klass = JavaClassInfo.getClassInfo(Target.class);
        MethodInfo method = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers1", new Class[] {}));
        assertTrue(new ExpressionInfo("execution(void *..*.modifiers1()) AND within(test.expression.Target)", NAMESPACE)
                .getAdvisedClassFilterExpression().match(
                    new ExpressionContext(PointcutType.EXECUTION, method, s_declaringType)));
        assertTrue(new ExpressionInfo("execution(void *..*.modifiers1()) AND within(@Serializable *..*)", NAMESPACE)
                .getAdvisedClassFilterExpression().match(
View Full Code Here

            NAMESPACE).getAdvisedClassFilterExpression().match(
            new ExpressionContext(PointcutType.EXECUTION, method, s_declaringType)));
    }

    public void testWithinCodeType() throws Exception {
        MethodInfo method = JavaMethodInfo.getMethodInfo(Target.class.getDeclaredMethod("modifiers1", new Class[] {}));
        assertTrue(new ExpressionInfo(
            "execution(void test.expression.Target.modifiers1()) AND withincode(void test.expression.Target.modifiers1())",
            NAMESPACE).getExpression().match(new ExpressionContext(PointcutType.EXECUTION, method, method)));
        assertTrue(new ExpressionInfo(
            "call(void test.expression.Target.modifiers1()) AND withincode(void test.expression.Target.modifiers1())",
View Full Code Here

            return true;
        }
        if (!(o instanceof MethodInfo)) {
            return false;
        }
        MethodInfo methodInfo = (MethodInfo) o;
        if (!m_declaringType.getName().toString().equals(methodInfo.getDeclaringType().getName().toString())) {
            return false;
        }
        if (!m_member.getName().toString().equals(methodInfo.getName().toString())) {
            return false;
        }
        Class[] parameterTypes1 = ((Method) m_member).getParameterTypes();
        ClassInfo[] parameterTypes2 = methodInfo.getParameterTypes();
        if (parameterTypes1.length != parameterTypes2.length) {
            return false;
        }
        for (int i = 0; i < parameterTypes1.length; i++) {
            if (!parameterTypes1[i].getName().toString().equals(parameterTypes2[i].getName().toString())) {
View Full Code Here

            return true;
        }
        if (!(o instanceof MethodInfo)) {
            return false;
        }
        MethodInfo methodInfo = (MethodInfo) o;
        if (!m_declaringType.getName().toString().equals(methodInfo.getDeclaringType().getName().toString())) {
            return false;
        }
        if (!m_member.name.equals(methodInfo.getName().toString())) {
            return false;
        }
        ClassInfo[] parameterTypes = methodInfo.getParameterTypes();
        if (m_parameterTypes.length != parameterTypes.length) {
            return false;
        }
        for (int i = 0; i < m_parameterTypes.length; i++) {
            if (!m_parameterTypes[i].getName().toString().equals(parameterTypes[i].getName().toString())) {
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.reflect.MethodInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.