本文整理汇总了Java中org.apache.jmeter.testelement.AbstractTestElement类的典型用法代码示例。如果您正苦于以下问题:Java AbstractTestElement类的具体用法?Java AbstractTestElement怎么用?Java AbstractTestElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractTestElement类属于org.apache.jmeter.testelement包,在下文中一共展示了AbstractTestElement类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: threadFinished
import org.apache.jmeter.testelement.AbstractTestElement; //导入依赖的package包/类
@Override
public void threadFinished(JMeterThread thread) {
JMeterContextServiceAccessorParallel.incrNumberOfThreads();
try {
Field field = AbstractTestElement.class.getDeclaredField("threadContext");
field.setAccessible(true);
if (thread instanceof JMeterThreadParallel) {
JMeterThreadParallel pthr = (JMeterThreadParallel) thread;
for (TestElement te : pthr.getParallelCompiler().getKnownSamplers()) {
field.set(te, null);
}
}
} catch (IllegalAccessException | NoSuchFieldException e) {
log.warn("Failed to reset context", e);
}
}
示例2: configure
import org.apache.jmeter.testelement.AbstractTestElement; //导入依赖的package包/类
@Override
public void configure(TestElement el) {
super.configure(el);
AbstractTestElement http2Sampler = (AbstractTestElement) el;
http2RequestPanel.configure(el);
retrieveEmbeddedResources.setSelected(http2Sampler.getPropertyAsBoolean(HTTP2Request.EMBEDDED_RESOURCES));
useMD5.setSelected(http2Sampler.getPropertyAsBoolean(HTTP2Request.MD5, false));
embeddedRE.setText(http2Sampler.getPropertyAsString(HTTP2Request.EMBEDDED_URL_RE, ""));//$NON-NLS-1$
sourceIpAddr.setText(http2Sampler.getPropertyAsString(HTTP2Request.IP_SOURCE)); //$NON-NLS-1$
sourceIpType.setSelectedIndex(
http2Sampler.getPropertyAsInt(HTTP2Request.IP_SOURCE_TYPE,
HTTP2Request.SOURCE_TYPE_DEFAULT));
}
示例3: checkAssertions
import org.apache.jmeter.testelement.AbstractTestElement; //导入依赖的package包/类
private void checkAssertions(List<Assertion> assertions, SampleResult parent, JMeterContext threadContext) {
for (Assertion assertion : assertions) {
TestBeanHelper.prepare((TestElement) assertion);
if (assertion instanceof AbstractScopedAssertion){
AbstractScopedAssertion scopedAssertion = (AbstractScopedAssertion) assertion;
String scope = scopedAssertion.fetchScope();
if (scopedAssertion.isScopeParent(scope) || scopedAssertion.isScopeAll(scope) || scopedAssertion.isScopeVariable(scope)){
processAssertion(parent, assertion);
}
if (scopedAssertion.isScopeChildren(scope) || scopedAssertion.isScopeAll(scope)){
SampleResult[] children = parent.getSubResults();
boolean childError = false;
for (SampleResult childSampleResult : children) {
processAssertion(childSampleResult, assertion);
if (!childSampleResult.isSuccessful()) {
childError = true;
}
}
// If parent is OK, but child failed, add a message and flag the parent as failed
if (childError && parent.isSuccessful()) {
AssertionResult assertionResult = new AssertionResult(((AbstractTestElement)assertion).getName());
assertionResult.setResultForFailure("One or more sub-samples failed");
parent.addAssertionResult(assertionResult);
parent.setSuccessful(false);
}
}
} else {
processAssertion(parent, assertion);
}
}
threadContext.getVariables().put(LAST_SAMPLE_OK, Boolean.toString(parent.isSuccessful()));
}
示例4: runPreProcessors
import org.apache.jmeter.testelement.AbstractTestElement; //导入依赖的package包/类
private void runPreProcessors(List<PreProcessor> preProcessors) {
for (PreProcessor ex : preProcessors) {
if (log.isDebugEnabled()) {
log.debug("Running preprocessor: " + ((AbstractTestElement) ex).getName());
}
TestBeanHelper.prepare((TestElement) ex);
ex.process();
}
}
示例5: configure
import org.apache.jmeter.testelement.AbstractTestElement; //导入依赖的package包/类
/**
* Set the text, etc. in the UI.
*
* @param el
* contains the data to be displayed
*/
public void configure(TestElement el) {
setName(el.getName());
key.setText(el.getPropertyAsString(OAuthSampler.KEY));
useAuthHeader.setSelected(((AbstractTestElement) el).
getPropertyAsBoolean(OAuthSampler.USE_AUTH_HEADER));
urlEncode.setSelected(((AbstractTestElement) el).
getPropertyAsBoolean(OAuthSampler.URL_ENCODE));
signatureMethod.setText(
el.getPropertyAsString(OAuthSampler.SIGNATURE_METHOD));
secret.setText(el.getPropertyAsString(OAuthSampler.SECRET));
token.setText(el.getPropertyAsString(OAuthSampler.TOKEN));
tokenSecret.setText(el.getPropertyAsString(OAuthSampler.TOKEN_SECRET));
}
示例6: configure
import org.apache.jmeter.testelement.AbstractTestElement; //导入依赖的package包/类
@Override
public void configure(TestElement el) {
super.configure(el);
urlConfig.configure(el);
imageParser.setSelected(((AbstractTestElement) el).getPropertyAsBoolean(HTTPSamplerBase.IMAGE_PARSER));
concurrentDwn.setSelected(((AbstractTestElement) el).getPropertyAsBoolean(HTTPSamplerBase.CONCURRENT_DWN));
concurrentPool.setText(((AbstractTestElement) el).getPropertyAsString(HTTPSamplerBase.CONCURRENT_POOL));
embeddedRE.setText(((AbstractTestElement) el).getPropertyAsString(HTTPSamplerBase.EMBEDDED_URL_RE, ""));
}
示例7: modifyTestElement
import org.apache.jmeter.testelement.AbstractTestElement; //导入依赖的package包/类
/**
* Modifies a given TestElement to mirror the data in the gui components.
*
* @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
*/
@Override
public void modifyTestElement(TestElement te) {
super.configureTestElement(te);
te.setProperty(ResultSaver.FILENAME, filename.getText());
te.setProperty(ResultSaver.ERRORS_ONLY, errorsOnly.isSelected());
te.setProperty(ResultSaver.SKIP_AUTO_NUMBER, skipAutoNumber.isSelected());
te.setProperty(ResultSaver.SKIP_SUFFIX, skipSuffix.isSelected());
te.setProperty(ResultSaver.SUCCESS_ONLY, successOnly.isSelected());
te.setProperty(ResultSaver.ADD_TIMESTAMP, addTimestamp.isSelected(), false);
AbstractTestElement at = (AbstractTestElement) te;
at.setProperty(ResultSaver.VARIABLE_NAME, variableName.getText(),""); //$NON-NLS-1$
at.setProperty(ResultSaver.NUMBER_PAD_LENGTH, numberPadLength.getText(),""); //$NON-NLS-1$
}
示例8: checkAssertions
import org.apache.jmeter.testelement.AbstractTestElement; //导入依赖的package包/类
@SuppressWarnings("deprecation") // OK to call TestBeanHelper.prepare()
private void checkAssertions(List<Assertion> assertions, SampleResult parent, JMeterContext threadContext) {
for (Assertion assertion : assertions) {
TestBeanHelper.prepare((TestElement) assertion);
if (assertion instanceof AbstractScopedAssertion){
AbstractScopedAssertion scopedAssertion = (AbstractScopedAssertion) assertion;
String scope = scopedAssertion.fetchScope();
if (scopedAssertion.isScopeParent(scope) || scopedAssertion.isScopeAll(scope) || scopedAssertion.isScopeVariable(scope)){
processAssertion(parent, assertion);
}
if (scopedAssertion.isScopeChildren(scope) || scopedAssertion.isScopeAll(scope)){
SampleResult children[] = parent.getSubResults();
boolean childError = false;
for (int i=0;i <children.length; i++){
processAssertion(children[i], assertion);
if (!children[i].isSuccessful()){
childError = true;
}
}
// If parent is OK, but child failed, add a message and flag the parent as failed
if (childError && parent.isSuccessful()) {
AssertionResult assertionResult = new AssertionResult(((AbstractTestElement)assertion).getName());
assertionResult.setResultForFailure("One or more sub-samples failed");
parent.addAssertionResult(assertionResult);
parent.setSuccessful(false);
}
}
} else {
processAssertion(parent, assertion);
}
}
threadContext.getVariables().put(LAST_SAMPLE_OK, Boolean.toString(parent.isSuccessful()));
}
示例9: runPreProcessors
import org.apache.jmeter.testelement.AbstractTestElement; //导入依赖的package包/类
@SuppressWarnings("deprecation") // OK to call TestBeanHelper.prepare()
private void runPreProcessors(List<PreProcessor> preProcessors) {
for (PreProcessor ex : preProcessors) {
if (log.isDebugEnabled()) {
log.debug("Running preprocessor: " + ((AbstractTestElement) ex).getName());
}
TestBeanHelper.prepare((TestElement) ex);
ex.process();
}
}