// Path: src/main/java/com/lazerycode/jmeter/configuration/JMeterCommandLineArguments.java
// public enum JMeterCommandLineArguments {
// 
// 	PROXY_PASSWORD("a"),            //DOCUMENTED
// 	JMETER_HOME_OPT("d"),           //ALWAYS_SET - The JMeter dir structure is created by the plugin.
// 	REPORT_AT_END_OPT("e"),         //DOCUMENTED
// 	HELP_OPT("h"),                  //NOT_USED - Prints help information and exits.
// 	REPORT_GENERATING_OPT("g"),     //NOT_USED - We always generate reports in the verify phase.
// 	SERVER_OPT("s"),                //AUTOMATICALLY_SET - This is used hwne JMeter is started in server mode.
// 	JMLOGFILE_OPT("j"),             //ALWAYS_SET - Test name is used for logfile name (<testname>.log).
// 	LOGFILE_OPT("l"),               //ALWAYS_SET - Test name is used for logfile name (<testname>.jtl).
// 	NONGUI_OPT("n"),                //DOCUMENTED
// 	REPORT_OUTPUT_FOLDER_OPT("o"),  //DOCUMENTED
// 	PROPFILE_OPT("p"),              //NOT_USED - We place the jmeter.properties in the correct place on the filesystem.
// 	PROPFILE2_OPT("q"),             //DOCUMENTED
// 	REMOTE_OPT("r"),                //DOCUMENTED
// 	TESTFILE_OPT("t"),              //ALWAYS_SET - This is how we pass our test file list over to JMeter.
// 	PROXY_USERNAME("u"),            //DOCUMENTED
// 	VERSION_OPT("v"),               //NOT_USED - Prints version information and exits.
// 	SYSTEM_PROPERTY("D"),           //DOCUMENTED
// 	JMETER_GLOBAL_PROP("G"),        //DOCUMENTED
// 	PROXY_HOST("H"),                //DOCUMENTED
// 	JMETER_PROPERTY("J"),           //DOCUMENTED
// 	LOGLEVEL("L"),                  //DOCUMENTED
// 	NONPROXY_HOSTS("N"),            //DOCUMENTED
// 	PROXY_PORT("P"),                //DOCUMENTED
// 	REMOTE_OPT_PARAM("R"),          //DOCUMENTED
// 	SYSTEM_PROPFILE("S"),           //NOT_USED - We place the system.properties in the correct place on the filesystem.
// 	REMOTE_STOP("X");               //DOCUMENTED
// 
// 	private final String commandLineArgument;
// 
// 	JMeterCommandLineArguments(String commandLineArgument) {
// 		this.commandLineArgument = commandLineArgument;
// 	}
// 
// 	public String getCommandLineArgument() {
// 		return "-" + commandLineArgument;
// 	}
// 
// }
// 
// Path: src/main/java/com/lazerycode/jmeter/utility/UtilityFunctions.java
// public static Boolean isNotSet(Map<?, ?> value) {
//     return null == value || value.isEmpty();
// }
// 
// Path: src/main/java/com/lazerycode/jmeter/utility/UtilityFunctions.java
// public static Boolean isSet(String value) {
//     return !isNotSet(value);
// }


import org.apache.commons.io.FilenameUtils;
import org.apache.maven.plugin.MojoExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeSet;
import static com.lazerycode.jmeter.configuration.JMeterCommandLineArguments.*;
import static com.lazerycode.jmeter.utility.UtilityFunctions.isNotSet;
import static com.lazerycode.jmeter.utility.UtilityFunctions.isSet;
        argumentList.add(SERVER_OPT);
        disableTests = true;
        if (isSet(logsDirectory)) {
            if (null == exportedHostname) {
                exportedHostname = "localhost";
            }
            jmeterLogFileName = logsDirectory + File.separator + String.format("%s_%s.log", exportedHostname, port);
            argumentList.add(JMLOGFILE_OPT);
        }

        return this;
    }

    public String getResultsLogFileName() {
        return resultsLogFileName;
    }

    /**
     * Generate an arguments array representing the command line options you want to send to JMeter.
     * The order of the array is determined by the order the values in JMeterCommandLineArguments are defined.
     *
     * @return An array representing the command line sent to JMeter
     * @throws MojoExecutionException Exception
     */
    public List<String> buildArgumentsArray() throws MojoExecutionException {
        if (!argumentList.contains(TESTFILE_OPT) && !disableTests) {
            throw new MojoExecutionException("No test(s) specified!");
        }
        List<String> argumentsArray = new ArrayList<>();

// Path: src/main/java/com/lazerycode/jmeter/configuration/JMeterCommandLineArguments.java
// public enum JMeterCommandLineArguments {
// 
// 	PROXY_PASSWORD("a"),            //DOCUMENTED
// 	JMETER_HOME_OPT("d"),           //ALWAYS_SET - The JMeter dir structure is created by the plugin.
// 	REPORT_AT_END_OPT("e"),         //DOCUMENTED
// 	HELP_OPT("h"),                  //NOT_USED - Prints help information and exits.
// 	REPORT_GENERATING_OPT("g"),     //NOT_USED - We always generate reports in the verify phase.
// 	SERVER_OPT("s"),                //AUTOMATICALLY_SET - This is used hwne JMeter is started in server mode.
// 	JMLOGFILE_OPT("j"),             //ALWAYS_SET - Test name is used for logfile name (<testname>.log).
// 	LOGFILE_OPT("l"),               //ALWAYS_SET - Test name is used for logfile name (<testname>.jtl).
// 	NONGUI_OPT("n"),                //DOCUMENTED
// 	REPORT_OUTPUT_FOLDER_OPT("o"),  //DOCUMENTED
// 	PROPFILE_OPT("p"),              //NOT_USED - We place the jmeter.properties in the correct place on the filesystem.
// 	PROPFILE2_OPT("q"),             //DOCUMENTED
// 	REMOTE_OPT("r"),                //DOCUMENTED
// 	TESTFILE_OPT("t"),              //ALWAYS_SET - This is how we pass our test file list over to JMeter.
// 	PROXY_USERNAME("u"),            //DOCUMENTED
// 	VERSION_OPT("v"),               //NOT_USED - Prints version information and exits.
// 	SYSTEM_PROPERTY("D"),           //DOCUMENTED
// 	JMETER_GLOBAL_PROP("G"),        //DOCUMENTED
// 	PROXY_HOST("H"),                //DOCUMENTED
// 	JMETER_PROPERTY("J"),           //DOCUMENTED
// 	LOGLEVEL("L"),                  //DOCUMENTED
// 	NONPROXY_HOSTS("N"),            //DOCUMENTED
// 	PROXY_PORT("P"),                //DOCUMENTED
// 	REMOTE_OPT_PARAM("R"),          //DOCUMENTED
// 	SYSTEM_PROPFILE("S"),           //NOT_USED - We place the system.properties in the correct place on the filesystem.
// 	REMOTE_STOP("X");               //DOCUMENTED
// 
// 	private final String commandLineArgument;
// 
// 	JMeterCommandLineArguments(String commandLineArgument) {
// 		this.commandLineArgument = commandLineArgument;
// 	}
// 
// 	public String getCommandLineArgument() {
// 		return "-" + commandLineArgument;
// 	}
// 
// }
// 
// Path: src/main/java/com/lazerycode/jmeter/utility/UtilityFunctions.java
// public static Boolean isNotSet(Map<?, ?> value) {
//     return null == value || value.isEmpty();
// }
// 
// Path: src/main/java/com/lazerycode/jmeter/utility/UtilityFunctions.java
// public static Boolean isSet(String value) {
//     return !isNotSet(value);
// }


// Path: src/main/java/com/lazerycode/jmeter/configuration/JMeterArgumentsArray.java
import org.apache.commons.io.FilenameUtils;
import org.apache.maven.plugin.MojoExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeSet;
import static com.lazerycode.jmeter.configuration.JMeterCommandLineArguments.*;
import static com.lazerycode.jmeter.utility.UtilityFunctions.isNotSet;
import static com.lazerycode.jmeter.utility.UtilityFunctions.isSet;

        argumentList.add(SERVER_OPT);
        disableTests = true;
        if (isSet(logsDirectory)) {
            if (null == exportedHostname) {
                exportedHostname = "localhost";
            }
            jmeterLogFileName = logsDirectory + File.separator + String.format("%s_%s.log", exportedHostname, port);
            argumentList.add(JMLOGFILE_OPT);
        }

        return this;
    }

    public String getResultsLogFileName() {
        return resultsLogFileName;
    }

    /**
     * Generate an arguments array representing the command line options you want to send to JMeter.
     * The order of the array is determined by the order the values in JMeterCommandLineArguments are defined.
     *
     * @return An array representing the command line sent to JMeter
     * @throws MojoExecutionException Exception
     */
    public List<String> buildArgumentsArray() throws MojoExecutionException {
        if (!argumentList.contains(TESTFILE_OPT) && !disableTests) {
            throw new MojoExecutionException("No test(s) specified!");
        }
        List<String> argumentsArray = new ArrayList<>();

        for (JMeterCommandLineArguments argument : argumentList) {