Package test

Source Code of test.MCITest

package test;

import alt.jiapi.InstrumentationDescriptor;
import alt.jiapi.Instrumentor;
import alt.jiapi.InstrumentorChain;
import alt.jiapi.JiapiException;
import alt.jiapi.instrumentor.*;

/**
* Class description. MCITest
* @author Mika Riekkinen
*/
public class MCITest extends InstrumentorTest {
    public static void main(String [] args) throws Exception {
        MCITest mci = new MCITest();
        mci.run(args);
    }

    public MCITest() throws JiapiException {
        InstrumentorChain chain = new InstrumentorChain();

        Instrumentor dispatcher = new MethodDispatcherInstrumentor();
        Instrumentor si = new GrepInstrumentor(new MethodCallStrategy());
        TailInstrumentor after = new TailInstrumentor();
        MethodCallInstrumentor mci = new MethodCallInstrumentor(this);

        chain.add(dispatcher);
        chain.add(si);     // Split (method call)
        chain.add(after)// BEFORE, AFTER or AROUND
        chain.add(mci);    // make a method call

        InstrumentationDescriptor id = new InstrumentationDescriptor();
        addInclusionRules(id, getInclusionRules());
        addExclusionRules(id, getExclusionRules());
        id.addChain(chain);

        ctx.addInstrumentationDescriptor(id);
    }

    // Overriding hookMethod(String, String)
    public void hookMethod(Object _this, String m) {
        System.out.println("Just called " + m);
    }
}
TOP

Related Classes of test.MCITest

TOP
Copyright © 2018 www.massapi.com. 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.