1 package test; 2 3 4 import alt.jiapi.InstrumentationDescriptor; 5 import alt.jiapi.Instrumentor; 6 import alt.jiapi.InstrumentorChain; 7 import alt.jiapi.JiapiException; 8 import alt.jiapi.instrumentor.*; 9 10 import alt.jiapi.util.ChainBuilder; 11 12 16 public class CBTest extends InstrumentorTest { 17 public static void main(String [] args) throws Exception { 18 CBTest gt = new CBTest(); 19 gt.run(args); 20 } 21 22 public CBTest() throws Exception { 23 String chainSpec = System.getProperty("chainSpec"); 24 if (chainSpec == null) { 25 throw new JiapiException("Missing -DchainSpec=<chainSpec>"); 26 } 27 28 String [] chainSpecs = tokenizeRules(chainSpec); 29 if (chainSpecs.length == 0) { 30 throw new JiapiException("Empty chainSpec"); 31 } 32 33 ChainBuilder cb = new ChainBuilder(); 34 InstrumentorChain chain = cb.createChain(chainSpecs[0]); 35 InstrumentationDescriptor id = new InstrumentationDescriptor(); 36 addInclusionRules(id, getInclusionRules()); 37 addExclusionRules(id, getExclusionRules()); 38 39 for (int i = 1; i < chainSpecs.length; i++) { 40 id.addChain(cb.createChain(chainSpecs[i])); 41 } 42 43 44 ctx.addInstrumentationDescriptor(id); 45 } 46 } 47 | Popular Tags |