本文整理汇总了Java中org.apache.jmeter.threads.JMeterContext.getCurrentSampler方法的典型用法代码示例。如果您正苦于以下问题:Java JMeterContext.getCurrentSampler方法的具体用法?Java JMeterContext.getCurrentSampler怎么用?Java JMeterContext.getCurrentSampler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jmeter.threads.JMeterContext
的用法示例。
在下文中一共展示了JMeterContext.getCurrentSampler方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
@Override
public void process(){
final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter();
if (bshInterpreter == null) {
log.error("BeanShell not found");
return;
}
JMeterContext jmctx = JMeterContextService.getContext();
Sampler sam = jmctx.getCurrentSampler();
try {
// Add variables for access to context and variables
bshInterpreter.set("sampler", sam);//$NON-NLS-1$
processFileOrScript(bshInterpreter);
} catch (JMeterException e) {
log.warn("Problem in BeanShell script "+e);
}
}
示例2: getCurrentSampler
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
public Sampler getCurrentSampler() {
if (engine == null) {
return null;
}
JMeterContext threadContext = engine.getThreadContext();
return threadContext.getCurrentSampler();
}
示例3: execute
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
public String execute() {
if (isDynamic || permanentResults == null) {
JMeterContext context = JMeterContextService.getContext();
SampleResult previousResult = context.getPreviousResult();
Sampler currentSampler = context.getCurrentSampler();
return execute(previousResult, currentSampler);
}
return permanentResults; // $NON-NLS-1$
}
示例4: populateBindings
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
/**
* Populate variables to be passed to scripts
* @param bindings Bindings
*/
protected void populateBindings(Bindings bindings) {
final String label = getName();
final String fileName = getFilename();
final String scriptParameters = getParameters();
// Use actual class name for log
final Logger logger = LoggerFactory.getLogger(JSR223TestElement.class);
bindings.put("log", logger); // $NON-NLS-1$ (this name is fixed)
bindings.put("Label", label); // $NON-NLS-1$ (this name is fixed)
bindings.put("FileName", fileName); // $NON-NLS-1$ (this name is fixed)
bindings.put("Parameters", scriptParameters); // $NON-NLS-1$ (this name is fixed)
String [] args=JOrphanUtils.split(scriptParameters, " ");//$NON-NLS-1$
bindings.put("args", args); // $NON-NLS-1$ (this name is fixed)
// Add variables for access to context and variables
JMeterContext jmctx = JMeterContextService.getContext();
bindings.put("ctx", jmctx); // $NON-NLS-1$ (this name is fixed)
JMeterVariables vars = jmctx.getVariables();
bindings.put("vars", vars); // $NON-NLS-1$ (this name is fixed)
Properties props = JMeterUtils.getJMeterProperties();
bindings.put("props", props); // $NON-NLS-1$ (this name is fixed)
// For use in debugging:
bindings.put("OUT", System.out); // $NON-NLS-1$ (this name is fixed)
// Most subclasses will need these:
Sampler sampler = jmctx.getCurrentSampler();
bindings.put("sampler", sampler); // $NON-NLS-1$ (this name is fixed)
SampleResult prev = jmctx.getPreviousResult();
bindings.put("prev", prev); // $NON-NLS-1$ (this name is fixed)
}
示例5: initManager
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
protected void initManager(BSFManager mgr) throws BSFException{
final String label = getName();
final String fileName = getFilename();
final String scriptParameters = getParameters();
// Use actual class name for log
// final Logger logger = LoggingManager.getLoggerForShortName(getClass().getName());
mgr.declareBean("log", log, Logger.class); // $NON-NLS-1$
mgr.declareBean("Label",label, String.class); // $NON-NLS-1$
mgr.declareBean("FileName",fileName, String.class); // $NON-NLS-1$
mgr.declareBean("Parameters", scriptParameters, String.class); // $NON-NLS-1$
String [] args=JOrphanUtils.split(scriptParameters, " ");//$NON-NLS-1$
mgr.declareBean("args",args,args.getClass());//$NON-NLS-1$
// Add variables for access to context and variables
JMeterContext jmctx = JMeterContextService.getContext();
JMeterVariables vars = jmctx.getVariables();
Properties props = JMeterUtils.getJMeterProperties();
mgr.declareBean("ctx", jmctx, jmctx.getClass()); // $NON-NLS-1$
mgr.declareBean("vars", vars, vars.getClass()); // $NON-NLS-1$
mgr.declareBean("props", props, props.getClass()); // $NON-NLS-1$
// For use in debugging:
mgr.declareBean("OUT", System.out, PrintStream.class); // $NON-NLS-1$
// Most subclasses will need these:
Sampler sampler = jmctx.getCurrentSampler();
mgr.declareBean("sampler", sampler, Sampler.class);
SampleResult prev = jmctx.getPreviousResult();
mgr.declareBean("prev", prev, SampleResult.class);
}
示例6: execute
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
public String execute() {
if (isDynamic) {
JMeterContext context = JMeterContextService.getContext();
SampleResult previousResult = context.getPreviousResult();
Sampler currentSampler = context.getCurrentSampler();
return execute(previousResult, currentSampler);
}
return permanentResults; // $NON-NLS-1$
}
示例7: populateBindings
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
/**
* Populate variables to be passed to scripts
* @param bindings Bindings
*/
protected void populateBindings(Bindings bindings) {
final String label = getName();
final String fileName = getFilename();
final String scriptParameters = getParameters();
// Use actual class name for log
final Logger logger = LoggingManager.getLoggerForShortName(getClass().getName());
bindings.put("log", logger);
bindings.put("Label", label);
bindings.put("FileName", fileName);
bindings.put("Parameters", scriptParameters);
String [] args=JOrphanUtils.split(scriptParameters, " ");//$NON-NLS-1$
bindings.put("args", args);
// Add variables for access to context and variables
JMeterContext jmctx = JMeterContextService.getContext();
bindings.put("ctx", jmctx);
JMeterVariables vars = jmctx.getVariables();
bindings.put("vars", vars);
Properties props = JMeterUtils.getJMeterProperties();
bindings.put("props", props);
// For use in debugging:
bindings.put("OUT", System.out);
// Most subclasses will need these:
Sampler sampler = jmctx.getCurrentSampler();
bindings.put("sampler", sampler);
SampleResult prev = jmctx.getPreviousResult();
bindings.put("prev", prev);
}
示例8: initManager
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
protected void initManager(BSFManager mgr) throws BSFException{
final String label = getName();
final String fileName = getFilename();
final String scriptParameters = getParameters();
// Use actual class name for log
final Logger logger = LoggingManager.getLoggerForShortName(getClass().getName());
mgr.declareBean("log", logger, Logger.class); // $NON-NLS-1$
mgr.declareBean("Label",label, String.class); // $NON-NLS-1$
mgr.declareBean("FileName",fileName, String.class); // $NON-NLS-1$
mgr.declareBean("Parameters", scriptParameters, String.class); // $NON-NLS-1$
String [] args=JOrphanUtils.split(scriptParameters, " ");//$NON-NLS-1$
mgr.declareBean("args",args,args.getClass());//$NON-NLS-1$
// Add variables for access to context and variables
JMeterContext jmctx = JMeterContextService.getContext();
JMeterVariables vars = jmctx.getVariables();
Properties props = JMeterUtils.getJMeterProperties();
mgr.declareBean("ctx", jmctx, jmctx.getClass()); // $NON-NLS-1$
mgr.declareBean("vars", vars, vars.getClass()); // $NON-NLS-1$
mgr.declareBean("props", props, props.getClass()); // $NON-NLS-1$
// For use in debugging:
mgr.declareBean("OUT", System.out, PrintStream.class); // $NON-NLS-1$
// Most subclasses will need these:
Sampler sampler = jmctx.getCurrentSampler();
mgr.declareBean("sampler", sampler, Sampler.class);
SampleResult prev = jmctx.getPreviousResult();
mgr.declareBean("prev", prev, SampleResult.class);
}
示例9: execute
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
public String execute() throws InvalidVariableException {
JMeterContext context = JMeterContextService.getContext();
SampleResult previousResult = context.getPreviousResult();
Sampler currentSampler = context.getCurrentSampler();
return execute(previousResult, currentSampler);
}