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


Java SampleResult.getSubResults方法代码示例

本文整理汇总了Java中org.apache.jmeter.samplers.SampleResult.getSubResults方法的典型用法代码示例。如果您正苦于以下问题:Java SampleResult.getSubResults方法的具体用法?Java SampleResult.getSubResults怎么用?Java SampleResult.getSubResults使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.jmeter.samplers.SampleResult的用法示例。


在下文中一共展示了SampleResult.getSubResults方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sample

import org.apache.jmeter.samplers.SampleResult; //导入方法依赖的package包/类
@Test
public void sample() throws Exception {
    JMeterThread dummy = new JMeterThread(new HashTree(new GenericController()), null, null);
    JMeterContextService.getContext().setThread(dummy);
    JMeterThread thr = JMeterContextService.getContext().getThread();
    for (int n = 0; n < 1000; n++) {// we're doing good check here because of multi-threads
        log.debug("\n\n\nTry #" + n);
        EmulSampler.instances = 0;
        EmulSampler.count.set(0);
        ParallelSampler obj = new ParallelSampler();
        obj.threadStarted();
        obj.setGenerateParent(true);

        obj.addTestElement(getContextedSampler(thr));
        obj.addTestElement(getContextedSampler(thr));
        obj.addTestElement(getContextedSampler(thr));
        obj.addTestElement(getContextedSampler(thr));
        obj.addTestElement(getContextedSampler(thr));

        SampleResult res = obj.sample(null);
        assertEquals(5, EmulSampler.count.get());
        if (res.getSubResults().length < 5) {
            throw new AssertionError();
        }

        assertEquals(5, res.getSubResults().length);
    }
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:29,代码来源:ParallelSamplerTest.java

示例2: sampleOccurred

import org.apache.jmeter.samplers.SampleResult; //导入方法依赖的package包/类
/**
 * When a test result is received, display it and save it.
 *
 * @param event
 *            the sample event that was received
 */
@Override
public void sampleOccurred(SampleEvent event) {

	SampleResult result = event.getResult();

	//  Verify if it's an HTTPSampleResult
	if (result instanceof HTTP2SampleResult) {
		HTTP2SampleResult http2Result = (HTTP2SampleResult) result;

		if (!http2Result.isPendingResponse()) {						
			
			SampleResult[] subResults = result.getSubResults();
			
			//Look into childs to get the response of the message and the response of the secondary requests
			for (SampleResult child : subResults) {

				if (child instanceof HTTP2SampleResult) {
					http2Result = (HTTP2SampleResult) child;
					if (!http2Result.isSecondaryRequest()) {														
						SampleEvent evtChild = new SampleEvent(child, event.getThreadGroup());	
						
						// The method implements the same logic to save as method SampleOcurred of JMeter.
						saveLine(evtChild);
					}
				}
			}
			
			saveLine(event);
		}
	} else {
		// If it's not an HTTP2SampleResult follow the normal flow
		saveLine(event);
	}
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:41,代码来源:ResultCollector.java


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