Package test

Source Code of test.ExceptionEventTest

package test;

import alt.jiapi.event.ExceptionEventProducer;
import alt.jiapi.event.ExceptionListener;
import alt.jiapi.event.ExceptionEvent;
import alt.jiapi.*;

/**
* This class is mainly used to test Jiapi event model.
* In addition to that, it servers as an example to using
* Jiapi event model.
*/
public class ExceptionEventTest extends InstrumentorTest implements ExceptionListener {
    public static void main(String [] args) throws Exception {
        ExceptionEventTest ft = new ExceptionEventTest();
        ft.run(args);
    }

    public ExceptionEventTest() throws JiapiException {
        InstrumentationDescriptor id = new InstrumentationDescriptor();
        ctx.addInstrumentationDescriptor(id);

        addInclusionRules(id, getInclusionRules());
        addExclusionRules(id, getExclusionRules());

        ExceptionEventProducer fep =
            new ExceptionEventProducer(id, System.getProperty("resolution", "*"));

        fep.addExceptionListener(this);
    }

    // ---  Interface FieldListener ---
    public void exceptionCaught(ExceptionEvent event) {
        Object target = event.getTarget();
        String __target = null;
        if (target != null) {
            __target = target.getClass().toString();
        }

        System.out.println("Exception caught : " + event + "::" +
                           __target);
    }


    // Default test case name
    public String defaultClassName() {
        return "test.ExceptionTest";
    }
}
TOP

Related Classes of test.ExceptionEventTest

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.