Package org.codehaus.aspectwerkz.intercept

Examples of org.codehaus.aspectwerkz.intercept.AroundAdvice


    public void testAddAndRemoveAround() {
        LOG = "";
        adviseWithAround2();
        assertEquals("adviseWithAround2 ", LOG);

        final AroundAdvice advice = new AroundAdvice() {
            public Object invoke(JoinPoint jp) throws Throwable {
                InterceptTest.log("around1_pre_execution ");
                Object result = jp.proceed();
                InterceptTest.log("around1_post_execution ");
                return result;
            }
        };
        ((Advisable) this).aw_addAdvice(
                "execution(* test.intercept.execution.InterceptTest.adviseWithAround2(..))",
                advice
        );

        LOG = "";
        adviseWithAround2();
        assertEquals("around1_pre_execution adviseWithAround2 around1_post_execution ", LOG);

        ((Advisable) this).aw_removeAdvice(
                "execution(* test.intercept.execution.InterceptTest.adviseWithAround2(..))",
                advice.getClass()
        );

        LOG = "";
        adviseWithAround2();
        assertEquals("adviseWithAround2 ", LOG);
View Full Code Here


        adviseWithAroundStack();
        assertEquals("adviseWithAroundStack ", LOG);

        ((Advisable) this).aw_addAdvice(
                "execution(* test.intercept.execution.InterceptTest.adviseWithAroundStack(..))",
                new AroundAdvice() {
                    public Object invoke(JoinPoint jp) throws Throwable {
                        InterceptTest.log("around2_pre_execution ");
                        Object result = jp.proceed();
                        InterceptTest.log("around2_post_execution ");
                        return result;
                    }
                }
        );

        LOG = "";
        adviseWithAroundStack();
        assertEquals("around2_pre_execution adviseWithAroundStack around2_post_execution ", LOG);

        ((Advisable) this).aw_addAdvice(
                "execution(* test.intercept.execution.InterceptTest.adviseWithAroundStack(..))",
                new AroundAdvice() {
                    public Object invoke(JoinPoint jp) throws Throwable {
                        InterceptTest.log("around3_pre_execution ");
                        Object result = jp.proceed();
                        InterceptTest.log("around3_post_execution ");
                        return result;
View Full Code Here

        callee.adviseWithAround();
        assertEquals("adviseWithAround ", LOG);

        ((Advisable) this).aw_addAdvice(
                "call(* test.intercept.call.Callee.adviseWithAround(..))",
                new AroundAdvice() {
                    public Object invoke(JoinPoint jp) throws Throwable {
                        InterceptTest.log("around1_pre_call ");
                        Object result = jp.proceed();
                        InterceptTest.log("around1_post_call ");
                        return result;
View Full Code Here

        callee.adviseWithAround2();
        assertEquals("adviseWithAround2 ", LOG);

        ((Advisable) this).aw_addAdvice(
                "call(* test.intercept.call.Callee.adviseWithAround2(..))",
                new AroundAdvice() {
                    public Object invoke(JoinPoint jp) throws Throwable {
                        InterceptTest.log("around1_pre_call ");
                        Object result = jp.proceed();
                        InterceptTest.log("around1_post_call ");
                        return result;
View Full Code Here

        callee.adviseWithAroundStack();
        assertEquals("adviseWithAroundStack ", LOG);

        ((Advisable) this).aw_addAdvice(
                "call(* test.intercept.call.Callee.adviseWithAroundStack(..))",
                new AroundAdvice() {
                    public Object invoke(JoinPoint jp) throws Throwable {
                        InterceptTest.log("around2_pre_call ");
                        Object result = jp.proceed();
                        InterceptTest.log("around2_post_call ");
                        return result;
                    }
                }
        );

        LOG = "";
        callee.adviseWithAroundStack();
        assertEquals("around2_pre_call adviseWithAroundStack around2_post_call ", LOG);

        ((Advisable) this).aw_addAdvice(
                "call(* test.intercept.call.Callee.adviseWithAroundStack(..))",
                new AroundAdvice() {
                    public Object invoke(JoinPoint jp) throws Throwable {
                        InterceptTest.log("around3_pre_call ");
                        Object result = jp.proceed();
                        InterceptTest.log("around3_post_call ");
                        return result;
View Full Code Here

        // adding around interceptor using Advisble API
        System.out.println("\nINFO:: ------ adding an around per instance interceptor on the fly -----");
        ((Advisable) traceMe1).aw_addAdvice(
                "execution(* *.step3())",
                new AroundAdvice() {
                    public Object invoke(JoinPoint jp) throws Throwable {
                        System.out.println("Interceptor::ENTERING - step3()");
                        Object result = jp.proceed();
                        System.out.println("Interceptor::EXITING - step3()");
                        return result;
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.intercept.AroundAdvice

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.