Package org.codehaus.aspectwerkz.pointcut

Examples of org.codehaus.aspectwerkz.pointcut.ExecutionPointcut


                // TODO: joinPoint.getSystem() should return a LIST with systems, how-to handle that?
                if (joinPoint.getSystem().isAttribDef()) {
                    AttribDefSystem system = (AttribDefSystem)joinPoint.getSystem();

                    ExecutionPointcut methodPointcut = joinPoint.getPointcuts()[m_currentPointcutIndex];
                    IndexTuple index = methodPointcut.getAdviceIndex(m_currentAdviceIndex);
                    int aspectIndex = index.getAspectIndex();
                    int methodIndex = index.getMethodIndex();
                    result = system.getAspect(aspectIndex).___AW_invokeAdvice(methodIndex, joinPoint);
                }
                else {
View Full Code Here


        m_logString = "";
        reorderAdvicesTestMethod();
        assertEquals("before1 before2 invocation after2 after1 ", m_logString);

        // get the pointcut by name (can also be retrieved by method meta-data)
        ExecutionPointcut pointcut = SystemLoader.getSystem("tests").
                getAspectMetaData(ASPECT_NAME).
                getExecutionPointcut("pc1");

        // get the advices
        List advices = pointcut.getAdviceIndexTuples();
        NameIndexTuple tuple1 = (NameIndexTuple)advices.get(0);
        NameIndexTuple tuple2 = (NameIndexTuple)advices.get(1);

        // reorder the advices
        advices.set(0, tuple2);
        advices.set(1, tuple1);

        // set the reordered advices
        pointcut.setAdviceIndexTuples(advices);
    }
View Full Code Here

        methodMetaData.setName("addAdviceTestMethod");
        methodMetaData.setParameterTypes(new String[]{});
        methodMetaData.setReturnType("void");
        methodMetaData.setExceptionTypes(new String[]{});

        ExecutionPointcut methodPointcut = (ExecutionPointcut)SystemLoader.getSystem("tests").
                getAspectMetaData(ASPECT_NAME).
                getExecutionPointcuts(m_classMetaData, methodMetaData).get(0);

        methodPointcut.addAdvice("advice2");

        m_logString = "";
        addAdviceTestMethod();
        assertEquals("before1 before2 invocation after2 after1 ", m_logString);

        // remove it for other tests
        methodPointcut.removeAdvice("advice2");
    }
View Full Code Here

        methodMetaData.setName("removeAdviceTestMethod");
        methodMetaData.setParameterTypes(new String[]{});
        methodMetaData.setReturnType("void");
        methodMetaData.setExceptionTypes(new String[]{});

        ExecutionPointcut methodPointcut = (ExecutionPointcut)SystemLoader.getSystem("tests").
                getAspectMetaData(ASPECT_NAME).
                getExecutionPointcuts(m_classMetaData, methodMetaData).get(0);

        List advices = methodPointcut.getAdviceIndexTuples();

        NameIndexTuple adviceTuple = (NameIndexTuple)advices.remove(0);
        methodPointcut.setAdviceIndexTuples(advices);

        m_logString = "";
        removeAdviceTestMethod();
        assertEquals("before2 invocation after2 ", m_logString);

        // restore it for other tests
        advices.add(0, adviceTuple);
        methodPointcut.setAdviceIndexTuples(advices);
    }
View Full Code Here

            methodMetaData.setParameterTypes(new String[]{});
            methodMetaData.setReturnType("void");
            methodMetaData.setExceptionTypes(new String[]{});

            // get an existing pointcut
            ExecutionPointcut methodPointcut = (ExecutionPointcut)SystemLoader.getSystem("tests").
                    getAspectMetaData(ASPECT_NAME).
                    getExecutionPointcuts(m_classMetaData, methodMetaData).
                    get(0);

            // add the new advice to the pointcut
            methodPointcut.addAdvice("newAdvice");

            // check that it is executed
            m_logString = "";
            createAspectTestMethod();
            assertEquals("before2 beforeNew invocation afterNew after2 ", m_logString);

            //remove it for other tests
            methodPointcut.removeAdvice("newAdvice");
        }
        catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.pointcut.ExecutionPointcut

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.