Skip to content

Commit

Permalink
Merge branch 'master' into throughput_graph
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Pouzac committed Mar 6, 2014
2 parents a8efde4 + 7ce5946 commit b5d8d8f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ Usage Example
</property>
</remoteResources>

<!--
Specify custom date format for resources not supporting ISO8601.
Default IOS8601
-->
<remoteResourcesFromUntilDateFormat>HH:mm_yyyyMMdd</remoteResourcesFromUntilDateFormat>
<!--
List of writers that handle all output of the plugin.
Defaults to:
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/lazerycode/jmeter/analyzer/AnalyzeMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ public class AnalyzeMojo extends AbstractMojo {
@Parameter
private Properties remoteResources;

/**
* Parametrized format of from until date format e.g. Graphite renderer does not support
* ISO8601_FORMAT out of the box
*/
@Parameter(required = true, defaultValue = Environment.ISO8601_FORMAT)
private String remoteResourcesFromUntilDateFormat;


/**
* Template directory where custom freemarker templates are stored.
* Freemarker templates are used for all generated output. (CSV files, HTML files, console output)
Expand Down Expand Up @@ -227,13 +235,15 @@ private void initializeEnvironment() throws MojoExecutionException {

ENVIRONMENT.setMaxSamples(maxSamples);
ENVIRONMENT.setRemoteResources(remoteResources);
ENVIRONMENT.setRemoteResourcesFromUntilDateFormat(remoteResourcesFromUntilDateFormat);
ENVIRONMENT.setRequestGroups(requestGroups);
ENVIRONMENT.setTemplateDirectory(templateDirectory);
ENVIRONMENT.setTargetDirectory(targetDirectory);
ENVIRONMENT.initializeFreemarkerConfiguration();
ENVIRONMENT.setPreserveDirectories(preserveDirectories);
ENVIRONMENT.setLog(getLog());
ENVIRONMENT.setSampleNames(sampleNames);

}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.lazerycode.jmeter.analyzer;

import com.lazerycode.jmeter.analyzer.config.Environment;
import com.lazerycode.jmeter.analyzer.parser.AggregatedResponses;
import com.lazerycode.jmeter.analyzer.parser.JMeterResultParser;
import com.lazerycode.jmeter.analyzer.util.FileUtil;
Expand Down Expand Up @@ -51,7 +52,8 @@ public void analyze(Reader jmeterResult) throws IOException, TemplateException,
Properties remoteResources = ENVIRONMENT.getRemoteResources();
if (remoteResources != null) {
FileUtil.readResources(remoteResources, ENVIRONMENT.getTargetDirectory(),
resultDataFileRelativePath, testResults.values());
resultDataFileRelativePath, testResults.values(),
ENVIRONMENT.getRemoteResourcesFromUntilDateFormat());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public enum Environment {

public static final String ISO8601_FORMAT = "yyyyMMdd'T'HHmmssZ";




/**
* true, if charts should be generated
*/
Expand All @@ -53,6 +56,7 @@ public enum Environment {
*/
private File templateDirectory;
private Properties remoteResources;
private String remoteResourcesFromUntilDateFormat;
private Set<String> sampleNames;
private List<RequestGroup> requestGroups;
private int maxSamples = DEFAULT_MAXSAMPLES;
Expand All @@ -76,6 +80,7 @@ public void clear() {
this.maxSamples = 0;
this.configuration = null;
this.targetDirectory = null;
this.remoteResourcesFromUntilDateFormat = ISO8601_FORMAT;
}

public File getTargetDirectory() {
Expand Down Expand Up @@ -190,4 +195,15 @@ public List<Writer> getWriters() {
public void setWriters(List<Writer> writers) {
this.writers = writers;
}

public String getRemoteResourcesFromUntilDateFormat() {
return remoteResourcesFromUntilDateFormat;
}

public void setRemoteResourcesFromUntilDateFormat(
String remoteResourcesFromUntilDateFormat) {
this.remoteResourcesFromUntilDateFormat = remoteResourcesFromUntilDateFormat;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ public static File initializeFile(File dir, String name, String resultDataFileRe
* @throws IOException If reading fails
*/
public static void readResources(Properties remoteResources, File targetDir, String resultDataFileRelativePath,
Collection<AggregatedResponses> testResults) throws IOException {
Collection<AggregatedResponses> testResults, String fromuntilDateFormat) throws IOException {

long[] startEnd = getStartEnd(testResults);
long start = startEnd[0];
long end = startEnd[1];

SimpleDateFormat dateFormat = new SimpleDateFormat(ISO8601_FORMAT);
SimpleDateFormat dateFormat = new SimpleDateFormat(fromuntilDateFormat);
String fromString = urlEncode(dateFormat.format(new Date(start)));
String endString = urlEncode(dateFormat.format(new Date(end)));

Expand Down

0 comments on commit b5d8d8f

Please sign in to comment.