本文整理了Java中org.apache.jmeter.threads.JMeterContext.getCurrentSampler()
方法的一些代码示例,展示了JMeterContext.getCurrentSampler()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMeterContext.getCurrentSampler()
方法的具体详情如下:
包路径:org.apache.jmeter.threads.JMeterContext
类名称:JMeterContext
方法名:getCurrentSampler
暂无
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
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$
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
public String execute() throws InvalidVariableException {
JMeterContext context = JMeterContextService.getContext();
SampleResult previousResult = context.getPreviousResult();
Sampler currentSampler = context.getCurrentSampler();
return execute(previousResult, currentSampler);
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
Sampler sampler = jmctx.getCurrentSampler();
bindings.put("sampler", sampler); // $NON-NLS-1$ (this name is fixed)
SampleResult prev = jmctx.getPreviousResult();
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components
@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) {
if (log.isWarnEnabled()) {
log.warn("Problem in BeanShell script. {}", e.toString());
}
}
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_http
log.debug(Thread.currentThread().getName() + " Running up named: " + getName());//$NON-NLS-1$
Sampler entry = getThreadContext().getCurrentSampler();
if (!(entry instanceof HTTPSamplerBase)) {
return;
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components
rd.append("SamplerProperties\n");
sb.append("SamplerProperties:\n");
formatPropertyIterator(sb, threadContext.getCurrentSampler().propertyIterator());
sb.append("\n");
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_http
public void process() {
JMeterContext context = getThreadContext();
Sampler sam = context.getCurrentSampler();
SampleResult res = context.getPreviousResult();
HTTPSamplerBase sampler;
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
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 = LoggerFactory.getLogger(getClass());
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);
}
代码示例来源:origin: kg.apc/jmeter-plugins-extras
Sampler sam = context.getCurrentSampler();
SampleResult res = context.getPreviousResult();
HTTPSamplerBase sampler;
代码示例来源:origin: undera/jmeter-plugins
/**
* Update the worker thread jmeter context with the main thread one
* @param isInit if true the context a full copy is done, if false only update is done
*/
private void syncContext(boolean isInit)
{
// jmeter context synchronisation
JMeterContext current = JMeterContextService.getContext();
JMeterContext ctx = this.getThreadContext();
if (isInit)
{
current.setCurrentSampler(ctx.getCurrentSampler());
current.setEngine(ctx.getEngine());
current.setRestartNextLoop(ctx.isRestartNextLoop());
current.setSamplingStarted(ctx.isSamplingStarted());
current.setThread(ctx.getThread());
current.setThreadGroup(ctx.getThreadGroup());
current.setThreadNum(ctx.getThreadNum());
}
current.setVariables(ctx.getVariables());
current.setPreviousResult(ctx.getPreviousResult());
//current.getSamplerContext().putAll(ctx.getSamplerContext());
}
代码示例来源:origin: undera/jmeter-plugins
/**
* Update the worker thread jmeter context with the main thread one
* @param isInit if true the context a full copy is done, if false only update is done
*/
private void syncContext(boolean isInit)
{
// jmeter context synchronisation
JMeterContext current = JMeterContextService.getContext();
JMeterContext ctx = this.getThreadContext();
if (isInit)
{
current.setCurrentSampler(ctx.getCurrentSampler());
current.setEngine(ctx.getEngine());
current.setRestartNextLoop(ctx.isRestartNextLoop());
current.setSamplingStarted(ctx.isSamplingStarted());
current.setThread(ctx.getThread());
current.setThreadGroup(ctx.getThreadGroup());
current.setThreadNum(ctx.getThreadNum());
}
current.setVariables(ctx.getVariables());
current.setPreviousResult(ctx.getPreviousResult());
//current.getSamplerContext().putAll(ctx.getSamplerContext());
}
@Override
代码示例来源:origin: kg.apc/jmeter-plugins-cmn-jmeter
/**
* Update the worker thread jmeter context with the main thread one
* @param isInit if true the context a full copy is done, if false only update is done
*/
private void syncContext(boolean isInit)
{
// jmeter context synchronisation
JMeterContext current = JMeterContextService.getContext();
JMeterContext ctx = this.getThreadContext();
if (isInit)
{
current.setCurrentSampler(ctx.getCurrentSampler());
current.setEngine(ctx.getEngine());
current.setRestartNextLoop(ctx.isRestartNextLoop());
current.setSamplingStarted(ctx.isSamplingStarted());
current.setThread(ctx.getThread());
current.setThreadGroup(ctx.getThreadGroup());
current.setThreadNum(ctx.getThreadNum());
}
current.setVariables(ctx.getVariables());
current.setPreviousResult(ctx.getPreviousResult());
//current.getSamplerContext().putAll(ctx.getSamplerContext());
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_http
@Override
public void process() {
JMeterContext ctx = getThreadContext();
Sampler sampler = ctx.getCurrentSampler();
if (!(sampler instanceof HTTPSamplerBase)) {// Ignore non-HTTP samplers
return;
内容来源于网络,如有侵权,请联系作者删除!