You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2015/12/30 18:01:38 UTC
svn commit: r1722380 -
/jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java
Author: fschumacher
Date: Wed Dec 30 17:01:38 2015
New Revision: 1722380
URL: http://svn.apache.org/viewvc?rev=1722380&view=rev
Log:
Extract yet another method to reduce complexity of generate.
Modified:
jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java
Modified: jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java?rev=1722380&r1=1722379&r2=1722380&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java Wed Dec 30 17:01:38 2015
@@ -271,29 +271,7 @@ public class ReportGenerator {
// Process configuration to build data exporters
for (Map.Entry<String, ExporterConfiguration> entry : configuration
.getExportConfigurations().entrySet()) {
- String exporterName = entry.getKey();
- ExporterConfiguration exporterConfiguration = entry.getValue();
-
- // Instantiate the class from the classname
- String className = exporterConfiguration.getClassName();
- try {
- Class<?> clazz = Class.forName(className);
- Object obj = clazz.newInstance();
- DataExporter exporter = (DataExporter) obj;
- exporter.setName(exporterName);
-
- // Export data
- exporter.export(sampleContext, testFile, configuration);
- } catch (ClassNotFoundException | IllegalAccessException
- | InstantiationException | ClassCastException ex) {
- String error = String.format(INVALID_CLASS_FMT, className);
- log.error(error, ex);
- throw new GenerationException(error, ex);
- } catch (ExportException ex) {
- String error = String.format(INVALID_EXPORT_FMT, exporterName);
- log.error(error, ex);
- throw new GenerationException(error, ex);
- }
+ exportData(sampleContext, entry.getKey(), entry.getValue());
}
log.debug("End of data exporting");
@@ -312,6 +290,31 @@ public class ReportGenerator {
}
+ private void exportData(SampleContext sampleContext, String exporterName,
+ ExporterConfiguration exporterConfiguration)
+ throws GenerationException {
+ // Instantiate the class from the classname
+ String className = exporterConfiguration.getClassName();
+ try {
+ Class<?> clazz = Class.forName(className);
+ Object obj = clazz.newInstance();
+ DataExporter exporter = (DataExporter) obj;
+ exporter.setName(exporterName);
+
+ // Export data
+ exporter.export(sampleContext, testFile, configuration);
+ } catch (ClassNotFoundException | IllegalAccessException
+ | InstantiationException | ClassCastException ex) {
+ String error = String.format(INVALID_CLASS_FMT, className);
+ log.error(error, ex);
+ throw new GenerationException(error, ex);
+ } catch (ExportException ex) {
+ String error = String.format(INVALID_EXPORT_FMT, exporterName);
+ log.error(error, ex);
+ throw new GenerationException(error, ex);
+ }
+ }
+
private ErrorsSummaryConsumer createErrorsSummaryConsumer() {
ErrorsSummaryConsumer errorsSummaryConsumer = new ErrorsSummaryConsumer();
errorsSummaryConsumer.setName(ERRORS_SUMMARY_CONSUMER_NAME);