Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the ability to open a JMX file into Jmeter GUI (only within the '... #111

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/main/java/com/lazerycode/jmeter/JMeterGUIMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;

import java.io.File;
import java.io.IOException;

/**
Expand All @@ -15,6 +17,12 @@
@Mojo(name = "gui")
public class JMeterGUIMojo extends JMeterAbstractMojo {

/**
* Convenient to open a test file into the GUI after it is loaded.
*/
@Parameter
private File guiTestFile;

/**
* Load the JMeter GUI
*
Expand Down Expand Up @@ -49,4 +57,10 @@ public void execute() throws MojoExecutionException, MojoFailureException {
getLog().error(e.getMessage());
}
}

@Override
protected void initialiseJMeterArgumentsArray(boolean disableGUI) throws MojoExecutionException {
super.initialiseJMeterArgumentsArray(disableGUI);
testArgs.setTestFile(guiTestFile);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
public class JMeterArgumentsArray {

private final String jMeterHome;
private final boolean disableTests;
private boolean disableTests;

private final TreeSet<JMeterCommandLineArguments> argumentList = new TreeSet<JMeterCommandLineArguments>();
private DateTimeFormatter dateFormat = ISODateTimeFormat.basicDate();
Expand Down Expand Up @@ -153,7 +153,7 @@ public void setResultFileOutputFormatIsCSV(boolean isCSVFormat) {
}

public void setTestFile(File value) {
if (isNotSet(value) || disableTests) return;
if (isNotSet(value)) return;
testFile = value.getAbsolutePath();
if (timestampResults) {
//TODO investigate when timestamp is generated.
Expand All @@ -171,6 +171,7 @@ public void setTestFile(File value) {
}
argumentList.add(TESTFILE_OPT);
argumentList.add(LOGFILE_OPT);
disableTests = false;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ public void validateDefaultCommandLineOutputWithGUIEnabled() throws Exception {
JMeterArgumentsArray testArgs = new JMeterArgumentsArray(enableGUI, "target/jmeter/");
testArgs.setTestFile(new File(this.testFile.toURI()));

assertThat(testArgs.getResultsLogFileName(),
is(equalTo(null)));
assertThat(UtilityFunctions.humanReadableCommandLineOutput(testArgs.buildArgumentsArray()),
is(equalTo("-d target/jmeter/")));
is(equalTo("-t " + testFilePath + " -l " + testArgs.getResultsLogFileName() + " -d target/jmeter/")));
}

@Test
Expand Down