| // Sample BeanShell Function initialisation file |
| |
| //print("Initialisation started"); |
| |
| import org.apache.jmeter.util.JMeterUtils; |
| |
| i = j = k = 0; // for counters |
| |
| getprop(p){// get a JMeter property |
| return JMeterUtils.getPropDefault(p,""); |
| } |
| |
| getprop(p,d){// get a JMeter property with default |
| return JMeterUtils.getPropDefault(p,d); |
| } |
| |
| setprop(p,v){// set a JMeter property |
| JMeterUtils.getJMeterProperties().setProperty(p, v); |
| } |
| |
| // Define routines to stop the test or the current thread |
| stopTest(){// Stop the JMeter test |
| org.apache.jmeter.engine.StandardJMeterEngine.stopEngine(); |
| } |
| |
| stopThread(){// Stop current JMeter thread |
| org.apache.jmeter.engine.StandardJMeterEngine.stopThread(Thread.currentThread().getName()); |
| } |
| |
| // Fix ampersands in a string |
| String fixAmps(s) { |
| return s.replaceAll("&","&"); |
| } |
| |
| //print("Initialisation complete"); |