本文整理汇总了Java中org.apache.jmeter.testelement.TestStateListener类的典型用法代码示例。如果您正苦于以下问题:Java TestStateListener类的具体用法?Java TestStateListener怎么用?Java TestStateListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TestStateListener类属于org.apache.jmeter.testelement包,在下文中一共展示了TestStateListener类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notifyTestListenersOfEnd
import org.apache.jmeter.testelement.TestStateListener; //导入依赖的package包/类
private void notifyTestListenersOfEnd(SearchByClass<TestStateListener> testListeners) {
log.info("Notifying test listeners of end of test");
for (TestStateListener tl : testListeners.getSearchResults()) {
try {
if (host == null) {
tl.testEnded();
} else {
tl.testEnded(host);
}
} catch (Exception e) {
log.warn("Error encountered during shutdown of "+tl.toString(),e);
}
}
if (host != null) {
log.info("Test has ended on host "+host);
long now=System.currentTimeMillis();
System.out.println("Finished the test on host " + host + " @ "+new Date(now)+" ("+now+")"
+(exitAfterTest ? " - exit requested." : ""));
if (exitAfterTest){
exit();
}
}
active=false;
}
示例2: RemoteSampleListenerImpl
import org.apache.jmeter.testelement.TestStateListener; //导入依赖的package包/类
public RemoteSampleListenerImpl(Object listener) throws RemoteException {
super(DEFAULT_LOCAL_PORT);
if (listener instanceof TestStateListener) {
testListener = (TestStateListener) listener;
} else {
testListener = null;
}
if (listener instanceof SampleListener) {
sampleListener = (SampleListener) listener;
} else {
sampleListener = null;
}
}
示例3: notifyTestListenersOfStart
import org.apache.jmeter.testelement.TestStateListener; //导入依赖的package包/类
private void notifyTestListenersOfStart(SearchByClass<TestStateListener> testListeners) {
for (TestStateListener tl : testListeners.getSearchResults()) {
if (tl instanceof TestBean) {
TestBeanHelper.prepare((TestElement) tl);
}
if (host == null) {
tl.testStarted();
} else {
tl.testStarted(host);
}
}
}
示例4: notifyTestListenersOfStart
import org.apache.jmeter.testelement.TestStateListener; //导入依赖的package包/类
/**
* This will notify test listeners directly within the Proxy that the 'test'
* (here meaning the proxy recording) has started.
*/
private void notifyTestListenersOfStart() {
JMeterTreeModel treeModel = GuiPackage.getInstance().getTreeModel();
JMeterTreeNode myNode = treeModel.getNodeOf(this);
Enumeration<JMeterTreeNode> kids = myNode.children();
while (kids.hasMoreElements()) {
JMeterTreeNode subNode = kids.nextElement();
if (subNode.isEnabled()) {
TestElement testElement = subNode.getTestElement();
if (testElement instanceof TestStateListener) {
((TestStateListener) testElement).testStarted();
}
}
}
}
示例5: notifyTestListenersOfEnd
import org.apache.jmeter.testelement.TestStateListener; //导入依赖的package包/类
/**
* This will notify test listeners directly within the Proxy that the 'test'
* (here meaning the proxy recording) has ended.
*/
private void notifyTestListenersOfEnd() {
JMeterTreeModel treeModel = GuiPackage.getInstance().getTreeModel();
JMeterTreeNode myNode = treeModel.getNodeOf(this);
Enumeration<JMeterTreeNode> kids = myNode.children();
while (kids.hasMoreElements()) {
JMeterTreeNode subNode = kids.nextElement();
if (subNode.isEnabled()) {
TestElement testElement = subNode.getTestElement();
if (testElement instanceof TestStateListener) { // TL - TE
((TestStateListener) testElement).testEnded();
}
}
}
}
示例6: notifyTestListenersOfStart
import org.apache.jmeter.testelement.TestStateListener; //导入依赖的package包/类
@SuppressWarnings("deprecation") // Deliberate use of deprecated method
private void notifyTestListenersOfStart(SearchByClass<TestStateListener> testListeners) {
for (TestStateListener tl : testListeners.getSearchResults()) {
if (tl instanceof TestBean) {
TestBeanHelper.prepare((TestElement) tl);
}
if (host == null) {
tl.testStarted();
} else {
tl.testStarted(host);
}
}
}
示例7: testStarted
import org.apache.jmeter.testelement.TestStateListener; //导入依赖的package包/类
@Override
public void testStarted() {
if (wrapped instanceof TestStateListener) {
((TestStateListener) wrapped).testStarted();
}
}
示例8: testEnded
import org.apache.jmeter.testelement.TestStateListener; //导入依赖的package包/类
@Override
public void testEnded() {
if (wrapped instanceof TestStateListener) {
((TestStateListener) wrapped).testEnded();
}
}
示例9: register
import org.apache.jmeter.testelement.TestStateListener; //导入依赖的package包/类
public static synchronized void register(TestStateListener tl) {
testList.add(tl);
}
示例10: makeFunction
import org.apache.jmeter.testelement.TestStateListener; //导入依赖的package包/类
/**
* Compile a string into a function or SimpleVariable.
*
* Called by {@link #compileString(String)} when that has detected "${".
*
* Calls {@link CompoundVariable#getNamedFunction(String)} if it detects:
* '(' - start of parameter list
* '}' - end of function call
*
* @param reader points to input after the "${"
* @return the function or variable object (or a String)
* @throws InvalidVariableException when evaluation of variables fail
*/
Object makeFunction(StringReader reader) throws InvalidVariableException {
char[] current = new char[1];
char previous = ' '; // TODO - why use space?
StringBuilder buffer = new StringBuilder();
Object function;
try {
while (reader.read(current) == 1) {
if (current[0] == '\\') {
if (reader.read(current) == 0) {
break;
}
previous = ' ';
buffer.append(current[0]);
} else if (current[0] == '(' && previous != ' ') {
String funcName = buffer.toString();
function = CompoundVariable.getNamedFunction(funcName);
if (function instanceof Function) {
((Function) function).setParameters(parseParams(reader));
if (reader.read(current) == 0 || current[0] != '}') {
reader.reset();// set to start of string
char []cb = new char[100];
int nbRead = reader.read(cb);
throw new InvalidVariableException
("Expected } after "+funcName+" function call in "+new String(cb, 0, nbRead));
}
if (function instanceof TestStateListener) {
StandardJMeterEngine.register((TestStateListener) function);
}
return function;
} else { // Function does not exist, so treat as per missing variable
buffer.append(current[0]);
}
} else if (current[0] == '}') {// variable, or function with no parameter list
function = CompoundVariable.getNamedFunction(buffer.toString());
if (function instanceof Function){// ensure that setParameters() is called.
((Function) function).setParameters(new LinkedList<CompoundVariable>());
}
buffer.setLength(0);
return function;
} else {
buffer.append(current[0]);
previous = current[0];
}
}
} catch (IOException e) {
log.error("Error parsing function: " + buffer.toString(), e);
return null;
}
log.warn("Probably an invalid function string: " + buffer.toString());
return buffer.toString();
}
示例11: makeFunction
import org.apache.jmeter.testelement.TestStateListener; //导入依赖的package包/类
/**
* Compile a string into a function or SimpleVariable.
*
* Called by {@link #compileString(String)} when that has detected "${".
*
* Calls {@link CompoundVariable#getNamedFunction(String)} if it detects:
* '(' - start of parameter list
* '}' - end of function call
*
* @param reader points to input after the "${"
* @return the function or variable object (or a String)
*/
Object makeFunction(StringReader reader) throws InvalidVariableException {
char[] current = new char[1];
char previous = ' '; // TODO - why use space?
StringBuilder buffer = new StringBuilder();
Object function;
try {
while (reader.read(current) == 1) {
if (current[0] == '\\') {
if (reader.read(current) == 0) {
break;
}
previous = ' ';
buffer.append(current[0]);
continue;
} else if (current[0] == '(' && previous != ' ') {
String funcName = buffer.toString();
function = CompoundVariable.getNamedFunction(funcName);
if (function instanceof Function) {
((Function) function).setParameters(parseParams(reader));
if (reader.read(current) == 0 || current[0] != '}') {
reader.reset();// set to start of string
char []cb = new char[100];
int nbRead = reader.read(cb);
throw new InvalidVariableException
("Expected } after "+funcName+" function call in "+new String(cb, 0, nbRead));
}
if (function instanceof TestStateListener) {
StandardJMeterEngine.register((TestStateListener) function);
}
return function;
} else { // Function does not exist, so treat as per missing variable
buffer.append(current[0]);
}
continue;
} else if (current[0] == '}') {// variable, or function with no parameter list
function = CompoundVariable.getNamedFunction(buffer.toString());
if (function instanceof Function){// ensure that setParameters() is called.
((Function) function).setParameters(new LinkedList<CompoundVariable>());
}
buffer.setLength(0);
return function;
} else {
buffer.append(current[0]);
previous = current[0];
}
}
} catch (IOException e) {
log.error("Error parsing function: " + buffer.toString(), e);
return null;
}
log.warn("Probably an invalid function string: " + buffer.toString());
return buffer.toString();
}