Package org.codehaus.aspectwerkz.expression

Examples of org.codehaus.aspectwerkz.expression.ExpressionContext


            new ExpressionContext(PointcutType.SET, type1, null)));
    }

    public void testFieldType2() throws Exception {
        assertFalse(new ExpressionInfo("set(int test.expression.Target.type2)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, type2, null)));
        assertTrue(new ExpressionInfo("set(* test.expression.Target.type2)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, type2, null)));
        assertFalse(new ExpressionInfo("set(Integer test.expression.Target.type2)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, type2, null)));
        assertFalse(new ExpressionInfo("set(int[] test.expression.Target.type2)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, type2, null)));
        assertTrue(new ExpressionInfo("set(int[][] test.expression.Target.type2)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, type2, null)));
    }
View Full Code Here


            new ExpressionContext(PointcutType.SET, type2, null)));
    }

    public void testFieldType3() throws Exception {
        assertTrue(new ExpressionInfo("set(String test.expression.Target.type3)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, type3, null)));
        assertTrue(new ExpressionInfo("set(java.lang.String test.expression.Target.type3)", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.SET, type3, null)));
        assertFalse(new ExpressionInfo("set(java.lang.string test.expression.Target.type3)", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.SET, type3, null)));
        assertTrue(new ExpressionInfo("set(java..* test.expression.Target.type3)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, type3, null)));
        assertTrue(new ExpressionInfo("set(java.*.String test.expression.Target.type3)", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.SET, type3, null)));
        assertTrue(new ExpressionInfo("set(java.lang.String* test.expression.Target.type3)", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.SET, type3, null)));
        assertTrue(new ExpressionInfo("set(* test.expression.Target.type3)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, type3, null)));
        assertFalse(new ExpressionInfo("set(StringBuffer test.expression.Target.type3)", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.SET, type3, null)));
        assertFalse(new ExpressionInfo("set(java.lang.StringBuffer test.expression.Target.type3)", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.SET, type3, null)));
        assertFalse(new ExpressionInfo("set(String[] test.expression.Target.type3)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, type3, null)));
        assertFalse(new ExpressionInfo("set(java.lang.String[] test.expression.Target.type3)", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.SET, type3, null)));
    }
View Full Code Here

                .getExpression().match(new ExpressionContext(PointcutType.SET, type3, null)));
    }

    public void testFieldType4() throws Exception {
        assertFalse(new ExpressionInfo("set(String test.expression.Target.type4)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, type4, null)));
        assertFalse(new ExpressionInfo("set(java.lang.String test.expression.Target.type4)", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.SET, type4, null)));
        assertTrue(new ExpressionInfo("set(String[] test.expression.Target.type4)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, type4, null)));
        assertTrue(new ExpressionInfo("set(java.lang.String[] test.expression.Target.type4)", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.SET, type4, null)));
        assertTrue(new ExpressionInfo("set(* test.expression.Target.type4)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, type4, null)));
        assertFalse(new ExpressionInfo("set(String[][] test.expression.Target.type4)", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.SET, type4, null)));
        assertFalse(new ExpressionInfo("set(int[] test.expression.Target.type4)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, type4, null)));
    }
View Full Code Here

    }

    // ============ field name test =============
    public void testFieldName() throws Exception {
        assertTrue(new ExpressionInfo("set(int test.expression.Target.__field$Name1)", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.SET, _field$Name1, null)));
        assertFalse(new ExpressionInfo("set(int test.expression.Target.field$Name1)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, _field$Name1, null)));
        assertTrue(new ExpressionInfo("set(int test.expression.Target.__*$Name*)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, _field$Name1, null)));
        assertTrue(new ExpressionInfo("set(int test.expression.Target.__field*)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, _field$Name1, null)));
        assertTrue(new ExpressionInfo("set(int test.expression.*.__field$Name1)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, _field$Name1, null)));
        assertTrue(new ExpressionInfo("set(int test..Target.__field$Name1)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, _field$Name1, null)));
        assertTrue(new ExpressionInfo("set(int test..*.__field$Name1)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, _field$Name1, null)));
        assertFalse(new ExpressionInfo("set(int test..*.__fieldName1)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, _field$Name1, null)));
        // AW-112 below
        assertTrue(new ExpressionInfo("within(test.expression.Target) && set(int __field$Name1)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, _field$Name1, null)));
        assertTrue(new ExpressionInfo("within(*.expression.Target) && set(int test..__field$Name1)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, _field$Name1, null)));

    }
View Full Code Here

    }

    // ============ field attribute test =============
    public void testFieldAttributes1() throws Exception {
        assertTrue(new ExpressionInfo("set(int test.expression.Target.attribute1)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.SET, attribute1, null)));
        assertTrue(new ExpressionInfo("set(@ReadOnly int test.expression.Target.attribute1)", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.SET, attribute1, null)));
        assertFalse(new ExpressionInfo("set(@Read int test.expression.Target.attribute1)", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.SET, attribute1, null)));
        assertFalse(new ExpressionInfo("set(@ReadOnly @ReadWrite int test.expression.Target.attribute1)", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.SET, attribute1, null)));
    }
View Full Code Here

    }

    // ============ class modifier test =============
    public void testClassModifier() throws Exception {
        assertTrue(new ExpressionInfo("within(test.expression.Target)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertTrue(new ExpressionInfo("within(public test.expression.Target)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertFalse(new ExpressionInfo("within(protected test.expression.Target)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertTrue(new ExpressionInfo("within(final public test.expression.Target)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));

        //        assertFalse(
        //                new ExpressionInfo( "within(abstract test.expression.Target)", NAMESPACE).
        //                getExpression().parse(new ExpressionContext( PointcutType.HANDLER, klass, klass))
        //
View Full Code Here

    }

    // ============ class type test =============
    public void testClassType() throws Exception {
        assertTrue(new ExpressionInfo("within(test.expression.Target)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.ANY, s_declaringType, s_declaringType)));
        assertTrue(new ExpressionInfo("within(*)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertTrue(new ExpressionInfo("within(..)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertTrue(new ExpressionInfo("within(public *)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertTrue(new ExpressionInfo("within(test.*.Target)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertTrue(new ExpressionInfo("within(test.expression.*)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertTrue(new ExpressionInfo("within(test.expression.Tar*)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertTrue(new ExpressionInfo("within(test.expression.T*et)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertTrue(new ExpressionInfo("within(test..*)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertTrue(new ExpressionInfo("within(*.expression.*)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertFalse(new ExpressionInfo("within(test.expression.target)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertFalse(new ExpressionInfo("within(test.expression.Targett)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertFalse(new ExpressionInfo("within(test.*.*.Target)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
    }
View Full Code Here

    public void testClassTypeEarlyFiltering() throws Exception {
        ExpressionNamespace.getNamespace(NAMESPACE).addExpressionInfo(
                "pcWithinForCall", new ExpressionInfo("within(test.expression.Target)", NAMESPACE));
        ExpressionInfo referenceToWithin = new ExpressionInfo("pcWithinForCall AND execution(* modifiers1(..))", NAMESPACE);
        assertTrue(referenceToWithin.getAdvisedClassFilterExpression().match(
                new ExpressionContext(PointcutType.EXECUTION, modifiers1, s_declaringType)));
        ExpressionNamespace.getNamespace(NAMESPACE).addExpressionInfo(
                "pcWithinForCall2", new ExpressionInfo("within(test.expression.TargetNOMATCH)", NAMESPACE));
        ExpressionInfo referenceToWithin2 = new ExpressionInfo("pcWithinForCall2 AND execution(* modifiers1(..))", NAMESPACE);
        assertFalse(referenceToWithin2.getAdvisedClassFilterExpression().match(
                new ExpressionContext(PointcutType.EXECUTION, modifiers1, s_declaringType)));
    }
View Full Code Here

    }

    // ============ class attribute test =============
    public void testClassAttribute1() throws Exception {
        assertTrue(new ExpressionInfo("within(test.expression.Target)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertTrue(new ExpressionInfo("within(@Serializable test.expression.Target)", NAMESPACE).getExpression().match(
            new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertTrue(new ExpressionInfo("within(@Serializable public final test.expression.Target)", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
        assertFalse(new ExpressionInfo("within(@Serializable @Dummy test.expression.Target)", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.HANDLER, s_declaringType, s_declaringType)));
    }
View Full Code Here

    // 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

TOP

Related Classes of org.codehaus.aspectwerkz.expression.ExpressionContext

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.