本文整理汇总了Java中org.apache.jmeter.threads.JMeterContext.isSamplingStarted方法的典型用法代码示例。如果您正苦于以下问题:Java JMeterContext.isSamplingStarted方法的具体用法?Java JMeterContext.isSamplingStarted怎么用?Java JMeterContext.isSamplingStarted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jmeter.threads.JMeterContext
的用法示例。
在下文中一共展示了JMeterContext.isSamplingStarted方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStringValue
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
/**
* Executes the function (and caches the value for the duration of the test
* iteration) if the property is a running version. Otherwise, the raw
* string representation of the function is provided.
*
* @see JMeterProperty#getStringValue()
*/
@Override
public String getStringValue() {
JMeterContext ctx = JMeterContextService.getContext();// Expensive, so
// do
// once
if (!isRunningVersion() /*|| !ctx.isSamplingStarted()*/) {
log.debug("Not running version, return raw function string");
return function.getRawParameters();
}
if(!ctx.isSamplingStarted()) {
return function.execute();
}
log.debug("Running version, executing function");
int iter = ctx.getVariables() != null ? ctx.getVariables().getIteration() : -1;
if (iter < testIteration) {
testIteration = -1;
}
if (iter > testIteration || cacheValue == null) {
testIteration = iter;
cacheValue = function.execute();
}
return cacheValue;
}
示例2: add
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
/**
* Add a cookie.
*
* @param c cookie to be added
*/
public void add(Cookie c) {
String cv = c.getValue();
String cn = c.getName();
removeMatchingCookies(c); // Can't have two matching cookies
if (DELETE_NULL_COOKIES && (null == cv || cv.length()==0)) {
if (log.isDebugEnabled()) {
log.debug("Dropping cookie with null value " + c.toString());
}
} else {
if (log.isDebugEnabled()) {
log.debug("Add cookie to store " + c.toString());
}
getCookies().addItem(c);
if (SAVE_COOKIES) {
JMeterContext context = getThreadContext();
if (context.isSamplingStarted()) {
context.getVariables().put(COOKIE_NAME_PREFIX+cn, cv);
}
}
}
}
示例3: add
import org.apache.jmeter.threads.JMeterContext; //导入方法依赖的package包/类
/**
* Add a cookie.
*/
public void add(Cookie c) {
String cv = c.getValue();
String cn = c.getName();
removeMatchingCookies(c); // Can't have two matching cookies
if (DELETE_NULL_COOKIES && (null == cv || cv.length()==0)) {
if (log.isDebugEnabled()) {
log.debug("Dropping cookie with null value " + c.toString());
}
} else {
if (log.isDebugEnabled()) {
log.debug("Add cookie to store " + c.toString());
}
getCookies().addItem(c);
if (SAVE_COOKIES) {
JMeterContext context = getThreadContext();
if (context.isSamplingStarted()) {
context.getVariables().put(COOKIE_NAME_PREFIX+cn, cv);
}
}
}
}