当前位置: 首页>>代码示例>>Java>>正文


Java AbstractTestElement类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:17,代码来源:ParallelSampler.java

示例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));
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:14,代码来源:Http2DefaultsGui.java

示例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()));
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:33,代码来源:JMeterThread.java

示例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();
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:10,代码来源:JMeterThread.java

示例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));	
}
 
开发者ID:groovenauts,项目名称:jmeter_oauth_plugin,代码行数:21,代码来源:OAuthConfigGui.java

示例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, ""));
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:10,代码来源:HttpDefaultsGui.java

示例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$
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:19,代码来源:ResultSaverGui.java

示例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()));
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:34,代码来源:JMeterThread.java

示例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();
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:11,代码来源:JMeterThread.java


注:本文中的org.apache.jmeter.testelement.AbstractTestElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。