Package org.codehaus.aspectwerkz.expression

Examples of org.codehaus.aspectwerkz.expression.ExpressionInfo


        //FIXME: systemDef should link a namespace, + remove static hashmap in Namespace (uuid clash in parallel CL)
        ExpressionNamespace systemNamespace = ExpressionNamespace.getNamespace(definition.getUuid());
        for (Iterator iterator = globalPointcuts.iterator(); iterator.hasNext();) {
            PointcutInfo pointcutInfo = (PointcutInfo) iterator.next();
            systemNamespace.addExpressionInfo(
                    pointcutInfo.name, new ExpressionInfo(pointcutInfo.expression, systemNamespace.getName())
            );
        }

        // parse the global deployment scopes definitions
        parseDeploymentScopeDefs(systemElement, definition);
View Full Code Here


    }

    // ============ constructor signature test =============
    public void testConstructor() throws Exception {
        assertTrue(
                new ExpressionInfo("call(test.expression.Target.new())", NAMESPACE).getExpression().match(
                        new ExpressionContext(PointcutType.CALL, constructorNoArgPublic, null)
                )
        );
        assertFalse(
                new ExpressionInfo("call(test.expression.Target.new(String))", NAMESPACE).getExpression().match(
                        new ExpressionContext(PointcutType.CALL, constructorNoArgPublic, null)
                )
        );
        assertTrue(
                new ExpressionInfo("call(test.expression.Target.new())", NAMESPACE).getExpression().match(
                        new ExpressionContext(PointcutType.CALL, constructorNoArgPublic, null)
                )
        );
        assertFalse(
                new ExpressionInfo("call(test.expression.Target.new(String))", NAMESPACE).getExpression().match(
                        new ExpressionContext(PointcutType.CALL, constructorNoArgPublic, null)
                )
        );
        //AW-112 below
        assertTrue(
                new ExpressionInfo("within(test.expression.Target) && execution(new())", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.EXECUTION, constructorNoArgPublic, null))
        );
        assertTrue(
                new ExpressionInfo("within(test..*) && execution(*.expression.Target.new())", NAMESPACE).getExpression()
                .match(
                        new ExpressionContext(
                                PointcutType.EXECUTION,
                                constructorNoArgPublic,
                                constructorNoArgPublic.getDeclaringType()
                        )
                )
        );
        assertTrue(
                new ExpressionInfo("within(test..*.*) && execution(*.expression.Target.new())", NAMESPACE).getExpression()
                .match(
                        new ExpressionContext(
                                PointcutType.EXECUTION,
                                constructorNoArgPublic,
                                constructorNoArgPublic.getDeclaringType()
View Full Code Here

    }

    // ============ constructor modifiers test =============
    public void testConstructorModifiers1() throws Exception {
        assertTrue(
                new ExpressionInfo("call(public test.expression.Target.new())", NAMESPACE).getExpression().match(
                        new ExpressionContext(PointcutType.CALL, constructorNoArgPublic, null)
                )
        );
        assertFalse(
                new ExpressionInfo("call(private test.expression.Target.new())", NAMESPACE).getExpression().match(
                        new ExpressionContext(PointcutType.CALL, constructorNoArgPublic, null)
                )
        );
    }
View Full Code Here

    }

    //  ============ constructor annotations test =============
    public void testConstructorAnnotations1() throws Exception {
        assertTrue(
                new ExpressionInfo("call(@Requires test.expression.Target.new())", NAMESPACE).getExpression().match(
                        new ExpressionContext(PointcutType.CALL, constructorNoArgPublic, null)
                )
        );
        assertFalse(
                new ExpressionInfo("call(@RequiresNew test.expression.Target.new())", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.CALL, constructorNoArgPublic, null))
        );
        assertTrue(
                new ExpressionInfo("execution(@Requires test.expression.Target.new())", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.EXECUTION, constructorNoArgPublic, null))
        );
        assertFalse(
                new ExpressionInfo("execution(@RequiresNew test.expression.Target.new())", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.EXECUTION, constructorNoArgPublic, null))
        );
    }
View Full Code Here

        );
    }

    public void testConstructorAnnotations2() throws Exception {
        assertTrue(
                new ExpressionInfo("execution(@Requires *..*.new(..))", NAMESPACE).getExpression().match(
                        new ExpressionContext(PointcutType.EXECUTION, constructorNoArgPublic, null)
                )
        );
        try {
            // should fail - we are specifying a return type for ctor
            assertTrue(
                    new ExpressionInfo("execution(@Requires * new(..))", NAMESPACE).getExpression().match(
                            new ExpressionContext(PointcutType.EXECUTION, constructorNoArgPublic, null)
                    )
            );
            fail("Should fail - specified return type for ctor");
        } catch (DefinitionException e) {
            ;//test ok
        }

        assertFalse(
                new ExpressionInfo("execution(@RequiresNew *..*.new(..))", NAMESPACE).getExpression().match(
                        new ExpressionContext(PointcutType.EXECUTION, constructorNoArgPublic, null)
                )
        );
        assertTrue(
                new ExpressionInfo("call(@Requires *..*.new(..))", NAMESPACE).getExpression().match(
                        new ExpressionContext(PointcutType.CALL, constructorNoArgPublic, null)
                )
        );
        assertFalse(
                new ExpressionInfo("call(@RequiresNew *..*.new(..))", NAMESPACE).getExpression().match(
                        new ExpressionContext(PointcutType.CALL, constructorNoArgPublic, null)
                )
        );
    }
View Full Code Here

    }

    // ============ method modifiers test =============
    public void testMethodModifiers1() throws Exception {
        assertFalse(
                new ExpressionInfo("call(public void test.expression.Target.modifiers1())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers1, null))
        );
        assertTrue(
                new ExpressionInfo("call(void test.expression.Target.modifiers1())", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.CALL, modifiers1, null))
        );
        assertFalse(
                new ExpressionInfo("call(static final void test.expression.Target.modifiers1())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers1, null))
        );
    }
View Full Code Here

        );
    }

    public void testMethodModifiers2() throws Exception {
        assertTrue(
                new ExpressionInfo("call(public void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null))
        );
        assertTrue(
                new ExpressionInfo("call(void test.expression.Target.modifiers2())", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.CALL, modifiers2, null))
        );
        assertFalse(
                new ExpressionInfo("call(static final void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null))
        );
        assertFalse(
                new ExpressionInfo("call(public static final void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null))
        );
        assertTrue(
                new ExpressionInfo("call(public static void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null))
        );
    }
View Full Code Here

        );
    }

    public void testMethodModifiers3() throws Exception {
        assertFalse(
                new ExpressionInfo("call(public void test.expression.Target.modifiers3())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers3, null))
        );
        assertTrue(
                new ExpressionInfo("call(void test.expression.Target.modifiers3())", NAMESPACE).getExpression()
                .match(new ExpressionContext(PointcutType.CALL, modifiers3, null))
        );
        assertTrue(
                new ExpressionInfo("call(static final void test.expression.Target.modifiers3())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers3, null))
        );
        assertFalse(
                new ExpressionInfo("call(public static native void test.expression.Target.modifiers3())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers3, null))
        );
        assertFalse(
                new ExpressionInfo("call(public static void test.expression.Target.modifiers3())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers3, null))
        );
        assertTrue(
                new ExpressionInfo("call(synchronized void test.expression.Target.modifiers3())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers3, null))
        );
        assertTrue(
                new ExpressionInfo(
                        "call(protected native synchronized void test.expression.Target.modifiers3())",
                        NAMESPACE
                ).getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers3, null))
        );
        assertTrue(
                new ExpressionInfo("call(native protected void test.expression.Target.modifiers3())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers3, null))
        );
    }
View Full Code Here

    }

    public void testMethodModifiers4() throws Exception {
        ClassInfo otherType = JavaClassInfo.getClassInfo(String.class);
        assertFalse(
                new ExpressionInfo("call(public * test.expression.*.*(..)) && within(test.expression.*)", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers4, s_declaringType))
        );
        assertTrue(
                new ExpressionInfo("call(private * test.expression.*.*(..)) && within(test.expression.*)", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers4, s_declaringType))
        );
        assertFalse(
                new ExpressionInfo(
                        "call(protected * test.expression.*.*(..)) && within(test.expression.*)",
                        NAMESPACE
                ).getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers4, s_declaringType))
        );
        assertFalse(
                new ExpressionInfo(
                        "call(protected * test.expression.*.*(..)) && within(test.expression.*)",
                        NAMESPACE
                ).getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers4, otherType))
        );
        assertTrue(
                new ExpressionInfo(
                        "call(private * test.expression.*.*(..)) && within(java.lang.String)",
                        NAMESPACE
                ).getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers4, otherType))
        );
    }
View Full Code Here

        );
    }

    public void testMethodModifiers5() throws Exception {
        assertFalse(
                new ExpressionInfo("call(!public void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null))
        );
        assertFalse(
                new ExpressionInfo("call(!public void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null))
        );
        assertTrue(
                new ExpressionInfo("call(!private void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null))
        );
        assertTrue(
                new ExpressionInfo("call(!private static void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null))
        );
        assertFalse(
                new ExpressionInfo("call(public !static void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null))
        );
        assertFalse(
                new ExpressionInfo("call(public !static void test.expression.Target.modifiers2())", NAMESPACE)
                .getExpression().match(new ExpressionContext(PointcutType.CALL, modifiers2, null))
        );
    }
View Full Code Here

TOP

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

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.