本文整理汇总了Java中org.apache.jmeter.reporters.ResultCollector类的典型用法代码示例。如果您正苦于以下问题:Java ResultCollector类的具体用法?Java ResultCollector怎么用?Java ResultCollector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResultCollector类属于org.apache.jmeter.reporters包,在下文中一共展示了ResultCollector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testHandleSamples
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
@Test
public void testHandleSamples() throws Exception {
JMeterUtils.setProperty("sense.delay", "10000");
LoadosophiaClient client = new LoadosophiaClient();
client.setOnlineInitiated(true);
client.setResultCollector(new ResultCollector());
client.setFileName("");
StatusNotifierCallbackTest.StatusNotifierCallbackImpl notifierCallback = new StatusNotifierCallbackTest.StatusNotifierCallbackImpl();
client.setInformer(notifierCallback);
client.setApiClient(new LoadosophiaAPIClientEmul(notifierCallback));
List<SampleResult> list = new LinkedList<>();
list.add(new SampleResult(System.currentTimeMillis(), 1));
list.add(new SampleResult(System.currentTimeMillis() + 1000, 1));
list.add(new SampleResult(System.currentTimeMillis() + 2000, 1));
long start = System.currentTimeMillis();
client.handleSampleResults(list, null);
long end = System.currentTimeMillis();
assertTrue((end - start) > 9999);
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:23,代码来源:LoadosophiaClientTest.java
示例2: testStop
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
@Test
public void testStop() throws Exception {
LoadosophiaClient client = new LoadosophiaClient();
client.setOnlineInitiated(true);
client.setResultCollector(new ResultCollector());
client.setFileName("");
StatusNotifierCallbackTest.StatusNotifierCallbackImpl notifierCallback = new StatusNotifierCallbackTest.StatusNotifierCallbackImpl();
client.setInformer(notifierCallback);
client.setApiClient(new LoadosophiaAPIClientEmul(notifierCallback));
client.teardownTest(null);
String results = notifierCallback.getBuffer().toString();
assertTrue(results.contains("Failed to upload results to BM.Sense, see log for detais"));
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:17,代码来源:LoadosophiaClientTest.java
示例3: getLastSamplerResultTab
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
public Component getLastSamplerResultTab() {
lastSamplerResult = new ViewResultsFullVisualizer() {
@Override
public TestElement createTestElement() {
this.collector = new ResultCollector() {
@Override
public void sampleOccurred(SampleEvent event) {
lastSamplerResult.clearData();
getVisualizer().add(event.getResult());
}
};
this.modifyTestElement(this.collector);
return collector;
}
};
lastSamplerResult.setName("Last Sampler Result");
try {
Field mainSplitField = lastSamplerResult.getClass().getSuperclass().getDeclaredField("mainSplit");
mainSplitField.setAccessible(true);
return (Component) mainSplitField.get(lastSamplerResult);
} catch (Throwable ex) {
log.warn("Failed to find 'mainSplit' field in visualizer");
return lastSamplerResult;
}
}
开发者ID:Blazemeter,项目名称:jmeter-debugger,代码行数:26,代码来源:DebuggerDialogBase.java
示例4: addJTLResultsCollector
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
private void addJTLResultsCollector() {
ResultCollector resultCollector = new ResultCollector();
resultCollector.setProperty(TestElement.GUI_CLASS, "org.apache.jmeter.visualizers.ViewResultsFullVisualizer");
resultCollector.setProperty(TestElement.TEST_CLASS, "org.apache.jmeter.reporters.ResultCollector");
resultCollector.setProperty(TestElement.NAME, "View Results Tree");
resultCollector.setProperty(TestElement.ENABLED, true);
resultCollector.setProperty("ResultCollector.error_logging", false);
SampleSaveConfiguration sampleSaveConfiguration = new SampleSaveConfiguration();
sampleSaveConfiguration.setAsXml(true);
sampleSaveConfiguration.setFieldNames(false);
sampleSaveConfiguration.setResponseData(true);
sampleSaveConfiguration.setResponseHeaders(true);
sampleSaveConfiguration.setFileName(true);
sampleSaveConfiguration.setSampleCount(true);
sampleSaveConfiguration.setEncoding(true);
sampleSaveConfiguration.setRequestHeaders(true);
sampleSaveConfiguration.setMessage(true);
sampleSaveConfiguration.setSamplerData(true);
sampleSaveConfiguration.setHostname(true);
sampleSaveConfiguration.setFieldNames(true);
resultCollector.setSaveConfig(sampleSaveConfiguration);
resultCollector.setProperty("filename", getFileName("jtl"));
testPlanTree.add(testPlan, resultCollector);
}
开发者ID:lithiumtech,项目名称:mineraloil-jmeter,代码行数:25,代码来源:JMeterRunner.java
示例5: executePlan
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
private Map<String, String> executePlan(int numLoops, int numThreads, int rampUp) throws IOException {
HashTree testPlanTree = new HashTree();
HTTPSamplerProxy httpSampler = makeSampler();
LoopController loopController = new LoopController();
loopController.setLoops(numLoops);
loopController.addTestElement(httpSampler);
loopController.setFirst(true);
loopController.initialize();
ThreadGroup threadGroup = new ThreadGroup();
threadGroup.setNumThreads(numThreads);
threadGroup.setRampUp(rampUp);
threadGroup.setSamplerController(loopController);
TestPlan testPlan = new TestPlan("JMeter regression test");
HashTree tpConfig = testPlanTree.add(testPlan);
HashTree tgConfig = tpConfig.add(threadGroup);
tgConfig.add(httpSampler);
Summariser summer = new Summariser("summary");
ResultCollector logger = new ResultCollector(summer);
tgConfig.add(logger);
jmeter.configure(testPlanTree);
jmeter.run();
return extractTotals(summer);
}
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:30,代码来源:ConverterLoadTest.java
示例6: setupSaving
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
private void setupSaving() throws IOException {
log.debug("Set up saving with " + this);
String dir = getStoreDir();
File tmpFile;
try {
if (dir == null || dir.trim().isEmpty()) {
tmpFile = File.createTempFile("Sense_", ".jtl");
} else {
File storeDir = new File(dir);
storeDir.mkdirs();
tmpFile = File.createTempFile("Sense_", ".jtl", storeDir);
}
} catch (IOException ex) {
informUser("Unable to create temp file: " + ex.getMessage());
informUser("Try to set another directory in the above field.");
throw ex;
}
fileName = tmpFile.getAbsolutePath();
tmpFile.delete(); // IMPORTANT! this is required to have CSV headers
informUser("Storing results for upload to Sense: " + fileName);
resultCollector.setFilename(fileName);
// OMG, I spent 2 days finding that setting properties in testStarted
// marks them temporary, though they cleared in some places.
// So we do dirty(?) hack here...
clearTemporary(getProperty(ResultCollector.FILENAME));
SampleSaveConfiguration conf = resultCollector.getSaveConfig();
JMeterPluginsUtils.doBestCSVSetup(conf);
resultCollector.setSaveConfig(conf);
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:33,代码来源:LoadosophiaUploader.java
示例7: flush
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
private void flush() {
// FIXME: trying to handle safe upgrade, needs to be removed in the future
// @see https://issues.apache.org/bugzilla/show_bug.cgi?id=56807
try {
Class<ResultCollector> c = ResultCollector.class;
Method m = c.getDeclaredMethod("flushFile");
m.setAccessible(true);
m.invoke(resultCollector);
log.info("Successfully flushed results file");
} catch (NoSuchMethodException ex) {
log.warn("Cannot flush results file since you are using old version of JMeter, consider upgrading to latest. Currently the results may be incomplete.");
} catch (InvocationTargetException | IllegalAccessException e) {
log.error("Failed to flush file", e);
}
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:16,代码来源:LoadosophiaClient.java
示例8: DebuggerDialog
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
public DebuggerDialog() {
super();
start.addActionListener(new StartDebugging());
stop.addActionListener(new StopDebugging());
step.addActionListener(new StepOver());
pauseContinue.addActionListener(new PauseContinue());
tgCombo.addItemListener(new ThreadGroupChoiceChanged());
lastResultListener = (ResultCollector) lastSamplerResult.createTestElement();
}
开发者ID:Blazemeter,项目名称:jmeter-debugger,代码行数:10,代码来源:DebuggerDialog.java
示例9: ReportGenerator
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
/**
* Instantiates a new report generator.
*
* @param resultsFile
* the test results file
* @param resultCollector
* Can be null, used if generation occurs at end of test
* @throws ConfigurationException when loading configuration from file fails
*/
public ReportGenerator(String resultsFile, ResultCollector resultCollector)
throws ConfigurationException {
if (!CSV_OUTPUT_FORMAT) {
throw new IllegalArgumentException(
"Report generation requires csv output format, check 'jmeter.save.saveservice.output_format' property");
}
LOG.info("ReportGenerator will use for Parsing the separator:'"+CSV_DEFAULT_SEPARATOR+"'");
File file = new File(resultsFile);
if (resultCollector == null) {
if (!(file.isFile() && file.canRead())) {
throw new IllegalArgumentException(String.format(
"Cannot read test results file : %s", file));
}
LOG.info("Will only generate report from results file:"
+ resultsFile);
} else {
if (file.exists() && file.length() > 0) {
throw new IllegalArgumentException("Results file:"
+ resultsFile + " is not empty");
}
LOG.info("Will generate report at end of test from results file:"
+ resultsFile);
}
this.resultCollector = resultCollector;
this.testFile = file;
final Properties merged = new Properties();
File rgp = new File(JMeterUtils.getJMeterBinDir(), REPORTGENERATOR_PROPERTIES);
if(LOG.isInfoEnabled()) {
LOG.info("Reading report generator properties from:"+rgp.getAbsolutePath());
}
merged.putAll(loadProps(rgp));
if(LOG.isInfoEnabled()) {
LOG.info("Merging with JMeter properties");
}
merged.putAll(JMeterUtils.getJMeterProperties());
configuration = ReportGeneratorConfiguration.loadFromProperties(merged);
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:49,代码来源:ReportGenerator.java
示例10: addSummaryReport
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
private void addSummaryReport() {
ResultCollector collector = new ResultCollector();
collector.setProperty(TestElement.GUI_CLASS, "org.apache.jmeter.visualizers.SummaryReport");
collector.setProperty(TestElement.TEST_CLASS, "org.apache.jmeter.visualizers.ResultCollector");
collector.setProperty(TestElement.NAME, "summary");
collector.setProperty(TestElement.ENABLED, true);
collector.setSaveConfig(getSampleSaveConfiguration());
collector.setFilename(getFileName("summary", "xml"));
collector.setProperty("interval_grouping", 1000);
collector.setProperty("graph_aggregated", false);
collector.setProperty("include_checkbox_state", false);
collector.setProperty("exclude_checkbox_state", false);
testPlanTree.add(testPlan, collector);
}
开发者ID:lithiumtech,项目名称:mineraloil-jmeter,代码行数:15,代码来源:JMeterRunner.java
示例11: loadData
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
/**
* The implementation loads a single .jtl file and cleans up the
* ResultCollector.
*/
@Override
public void loadData() {
if (this.getDataSource() != null) {
ResultCollector rc = new ResultCollector();
rc.setFilename(this.getDataSource());
rc.setListener(this);
rc.loadExistingFile();
// we clean up the ResultCollector to make sure there's
// no slow leaks
rc.clear();
rc.setListener(null);
}
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:18,代码来源:JTLData.java
示例12: processSamples
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
public static void processSamples(String filename, Visualizer visualizer, ResultCollector rc)
throws SAXException, IOException, ConfigurationException
{
DefaultConfigurationBuilder cfgbuilder = new DefaultConfigurationBuilder();
Configuration savedSamples = cfgbuilder.buildFromFile(filename);
Configuration[] samples = savedSamples.getChildren();
final boolean errorsOnly = rc.isErrorLogging();
final boolean successOnly = rc.isSuccessOnlyLogging();
for (int i = 0; i < samples.length; i++) {
SampleResult result = OldSaveService.getSampleResult(samples[i]);
if (ResultCollector.isSampleWanted(result.isSuccessful(), errorsOnly, successOnly)) {
visualizer.add(result);
}
}
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:16,代码来源:OldSaveService.java
示例13: modifyTestElement
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
@Override
public void modifyTestElement(TestElement c) {
configureTestElement((AbstractListenerElement) c);
if (c instanceof ResultCollector) {
ResultCollector rc = (ResultCollector) c;
rc.setErrorLogging(errorLogging.isSelected());
rc.setSuccessOnlyLogging(successOnlyLogging.isSelected());
rc.setFilename(getFile());
collector = rc;
}
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:12,代码来源:AbstractVisualizer.java
示例14: createTestElement
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
/**
* Makes MailerVisualizer storable.
*/
@Override
public TestElement createTestElement() {
ResultCollector model = getModel();
if (model == null) {
model = new MailerResultCollector();
setModel(model);
}
modifyTestElement(model);
return model;
}
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:14,代码来源:MailerVisualizer.java
示例15: setModel
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
@Override
protected void setModel(ResultCollector collector) {
// TODO Auto-generated method stub
super.setModel(collector);
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:6,代码来源:SimpleDataWriter.java
示例16: getResultCollector
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
public ResultCollector getResultCollector() {
return resultCollector;
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:4,代码来源:LoadosophiaClient.java
示例17: setResultCollector
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
public void setResultCollector(ResultCollector resultCollector) {
this.resultCollector = resultCollector;
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:4,代码来源:LoadosophiaClient.java
示例18: testGetAndSet
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
@Test
public void testGetAndSet() throws Exception {
LoadosophiaClient client = new LoadosophiaClient();
LoadosophiaUploader informer = new LoadosophiaUploader();
client.setInformer(informer);
assertEquals(informer, client.getInformer());
LoadosophiaAPIClient apiClient = new LoadosophiaAPIClient(null, null, null, null, null, null);
client.setApiClient(apiClient);
assertEquals(apiClient, client.getApiClient());
ResultCollector collector = new ResultCollector();
client.setResultCollector(collector);
assertEquals(collector, client.getResultCollector());
String address = "ADDRESS";
client.setAddress(address);
assertEquals(address, client.getAddress());
String fileName = "tmpFile.txt";
client.setFileName(fileName);
assertEquals(fileName, client.getFileName());
String project = "DAFULT_PROJECT";
client.setProject(project);
assertEquals(project, client.getProject());
String title = "DAFULT_TITLE";
client.setTitle(title);
assertEquals(title, client.getTitle());
String color = "red";
client.setColor(color);
assertEquals(color, client.getColor());
client.setOnlineInitiated(true);
assertTrue(client.isOnlineInitiated());
client.setOnlineInitiated(false);
assertFalse(client.isOnlineInitiated());
}
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:42,代码来源:LoadosophiaClientTest.java
示例19: requestsAreSubmitted
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
@When("^(.+) requests are submitted for endpoints$")
public void requestsAreSubmitted(final Integer loops,
final List<Endpoint> endpoints) {
// Set status vars - number of endpoints and a CPU sampler
this.samplersCount = endpoints.size() + 1;
// Create JMeter engine
StandardJMeterEngine jmeter = new StandardJMeterEngine();
// Init JMeter engine
// TODO Refactor config
JMeterUtils.setJMeterHome("JMETER_HOME");
JMeterUtils.loadJMeterProperties("JMETER_HOME/bin/jmeter.properties");
JMeterUtils.initLocale();
// Build samplers, use path for name of the sampler
Stream<HTTPSampler> httpSamplers = endpoints.stream().map(endpoint -> {
HTTPSampler httpSampler = new HTTPSampler();
httpSampler.setName(endpoint.getPath());
httpSampler.setDomain(endpoint.getDomain());
httpSampler.setPort(endpoint.getPort());
httpSampler.setPath(endpoint.getPath());
httpSampler.setMethod(endpoint.getMethod());
return httpSampler;
});
// Build a CPU sampler
CpuSampler cpuSampler = new CpuSampler();
cpuSampler.setName("cpu");
// Loop Controller
LoopController loopController = new LoopController();
loopController.setName("Default Loop Controller");
loopController.setLoops(loops);
loopController.setFirst(true);
loopController.initialize();
// Thread Group
org.apache.jmeter.threads.ThreadGroup threadGroup = new ThreadGroup();
threadGroup.setName("Default Thread Group");
threadGroup.setNumThreads(1);
threadGroup.setRampUp(1);
threadGroup.setSamplerController(loopController);
// Create results collector
ResultCollector logger = new ResultCollector();
logger.setName("Default Results Collector");
logger.setFilename("metrics.csv");
// Create a test structure
HashTree testPlanTree = new HashTree();
// Add Test Plan
TestPlan testPlan = new TestPlan("Sample R integration test plan");
testPlanTree.add(testPlan);
// Hang off Thread Group off Test Plan
HashTree threadGroupHashTree = testPlanTree.add(testPlan, threadGroup);
// Add samplers
threadGroupHashTree.add(httpSamplers.toArray());
threadGroupHashTree.add(cpuSampler);
// Add logger
testPlanTree.add(testPlan, logger);
// Run Test Plan
jmeter.configure(testPlanTree);
jmeter.run();
threadGroup.waitThreadsStopped();
}
开发者ID:cadmiumkitty,项目名称:cucumber-jmeter-r-integration,代码行数:73,代码来源:DataScienceLabDemoTestPerformanceAnomaliesSteps.java
示例20: ResultCollectorHelper
import org.apache.jmeter.reporters.ResultCollector; //导入依赖的package包/类
public ResultCollectorHelper(ResultCollector resultCollector, Visualizer visualizer) {
this.visualizer = visualizer;
this.errorsOnly = resultCollector.isErrorLogging();
this.successOnly = resultCollector.isSuccessOnlyLogging();
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:6,代码来源:ResultCollectorHelper.java
注:本文中的org.apache.jmeter.reporters.ResultCollector类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论