use of org.apache.commons.cli.GnuParser in project GNS by MobilityFirst.
the class ThroughputAsynchMultiClientTest method initializeOptions.
private static CommandLine initializeOptions(String[] args) throws ParseException {
Option helpOption = new Option("help", "Prints Usage");
Option aliasOption = OptionBuilder.withArgName("alias").hasArg().withDescription("the alias (HRN) to use").create("alias");
Option operationOption = OptionBuilder.withArgName("op").hasArg().withDescription("the operation to perform (read or update - default is read)").create("op");
Option rateOption = OptionBuilder.withArgName("rate").hasArg().withDescription("the rate in ops per second").create("rate");
Option incOption = OptionBuilder.withArgName("inc").hasArg().withDescription("the increment used with rate").create("inc");
Option clientsOption = OptionBuilder.withArgName("clients").hasArg().withDescription("number of clients used to send (default 10)").create("clients");
Option requestsPerClientOption = OptionBuilder.withArgName("requests").hasArg().withDescription("number of requests sent by each client each time").create("requests");
Option guidsPerRequestOption = OptionBuilder.withArgName("guids").hasArg().withDescription("number of guids for each request").create("guids");
Option useExistingGuidsOption = new Option("useExistingGuids", "use guids in account Guid instead of creating new ones");
Option updateAliasOption = new Option("updateAlias", true, "Alias of guid to update/read");
Option updateFieldOption = new Option("updateField", true, "Field to read/update");
Option updateValueOption = new Option("updateValue", true, "Value to use in read/update");
commandLineOptions = new Options();
commandLineOptions.addOption(aliasOption);
commandLineOptions.addOption(operationOption);
commandLineOptions.addOption(rateOption);
commandLineOptions.addOption(incOption);
commandLineOptions.addOption(clientsOption);
commandLineOptions.addOption(requestsPerClientOption);
commandLineOptions.addOption(guidsPerRequestOption);
commandLineOptions.addOption(helpOption);
commandLineOptions.addOption(updateAliasOption);
commandLineOptions.addOption(updateFieldOption);
commandLineOptions.addOption(updateValueOption);
commandLineOptions.addOption(useExistingGuidsOption);
CommandLineParser parser = new GnuParser();
return parser.parse(commandLineOptions, args);
}
use of org.apache.commons.cli.GnuParser in project GNS by MobilityFirst.
the class ReplicaLatencyTest method initializeOptions.
private static CommandLine initializeOptions(String[] args) throws ParseException {
Option help = new Option("help", "Prints Usage");
Option alias = OptionBuilder.withArgName("alias").hasArg().withDescription("the alias (HRN) to use for the account").create("alias");
Option host = OptionBuilder.withArgName("host").hasArg().withDescription("the GNS host").create("host");
Option port = OptionBuilder.withArgName("port").hasArg().withDescription("the GNS port").create("port");
Option debug = new Option("debug", "show output");
Option closeActiveReplica = OptionBuilder.withArgName("closeAR").hasArg().withDescription("the active replica close to you").create("closeAR");
commandLineOptions = new Options();
commandLineOptions.addOption(alias);
commandLineOptions.addOption(host);
commandLineOptions.addOption(port);
commandLineOptions.addOption(debug);
commandLineOptions.addOption(closeActiveReplica);
commandLineOptions.addOption(help);
CommandLineParser parser = new GnuParser();
return parser.parse(commandLineOptions, args);
}
use of org.apache.commons.cli.GnuParser in project GNS by MobilityFirst.
the class CommandLineInterface method initializeOptions.
private static CommandLine initializeOptions(String[] args) throws ParseException {
Option help = new Option("help", "Prints Usage");
Option silent = new Option("silent", "Disables output");
Option noDefaults = new Option("noDefaults", "Don't use server and guid defaults");
commandLineOptions = new Options();
commandLineOptions.addOption(help);
commandLineOptions.addOption(silent);
commandLineOptions.addOption(noDefaults);
CommandLineParser parser = new GnuParser();
return parser.parse(commandLineOptions, args, false);
}
use of org.apache.commons.cli.GnuParser in project GNS by MobilityFirst.
the class GNSInstaller method initializeOptions.
private static CommandLine initializeOptions(String[] args) throws ParseException {
Option help = new Option("help", "Prints Usage");
Option update = OptionBuilder.withArgName("installation name").hasArg().withDescription("updates GNS files and restarts servers in a installation").create("update");
Option restart = OptionBuilder.withArgName("installation name").hasArg().withDescription("restarts GNS servers in a installation").create("restart");
Option removeLogs = new Option("removeLogs", "remove paxos and Logger log files (use with -restart or -update)");
Option deleteDatabase = new Option("deleteDatabase", "delete the databases in a installation (use with -restart or -update)");
Option dataStore = OptionBuilder.withArgName("data store type").hasArg().withDescription("data store type").create("datastore");
Option scriptFile = OptionBuilder.withArgName("install script file").hasArg().withDescription("specifies the location of a bash script file that will install MongoDB and Java").create("scriptFile");
Option runscript = OptionBuilder.withArgName("installation name").hasArg().withDescription("just runs the script file").create("runscript");
Option stop = OptionBuilder.withArgName("installation name").hasArg().withDescription("stops GNS servers in a installation").create("stop");
Option root = new Option("root", "run the installation as root");
Option noopTest = new Option("noopTest", "starts noop test servers instead of GNS APP servers");
commandLineOptions = new Options();
commandLineOptions.addOption(update);
commandLineOptions.addOption(restart);
commandLineOptions.addOption(stop);
commandLineOptions.addOption(removeLogs);
commandLineOptions.addOption(deleteDatabase);
commandLineOptions.addOption(dataStore);
commandLineOptions.addOption(scriptFile);
commandLineOptions.addOption(runscript);
commandLineOptions.addOption(root);
commandLineOptions.addOption(noopTest);
commandLineOptions.addOption(help);
CommandLineParser parser = new GnuParser();
return parser.parse(commandLineOptions, args);
}
use of org.apache.commons.cli.GnuParser in project opennms by OpenNMS.
the class Mib2Events method parseCli.
public void parseCli(String[] argv) {
Options opts = new Options();
opts.addOption("m", "mib", true, "Pathname or URL of MIB file to scan for traps");
opts.addOption("b", "ueibase", true, "Base UEI for resulting events");
opts.addOption("c", "compat", false, "Turn on compatibility mode to create output as similar to mib2opennms as possible");
CommandLineParser parser = new GnuParser();
try {
CommandLine cmd = parser.parse(opts, argv);
if (cmd.hasOption('m')) {
m_mibLocation = cmd.getOptionValue('m');
} else {
printHelp("You must specify a MIB file pathname or URL");
System.exit(1);
}
if (cmd.hasOption("b")) {
m_ueiBase = cmd.getOptionValue('b');
}
if (cmd.hasOption("c")) {
m_compat = true;
}
} catch (ParseException e) {
printHelp("Failed to parse command line options");
System.exit(1);
}
}
Aggregations