Mercurial > stress-tester
changeset 426:e814e2c0a600
httpPorts option in CLI
author | Devel 1 |
---|---|
date | Wed, 26 Jul 2017 09:58:57 +0200 |
parents | d0c9e307bae4 |
children | c6223fd78e17 |
files | stress-tester/src/main/java/com/passus/st/Main.java |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/Main.java Wed Jul 26 09:38:48 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/Main.java Wed Jul 26 09:58:57 2017 +0200 @@ -7,6 +7,7 @@ import com.passus.config.validation.Errors; import static com.passus.config.validation.ErrorsUtils.objectErrorToString; import com.passus.config.validation.ObjectError; +import com.passus.net.PortRangeSet; import com.passus.st.client.MemoryEventsCache; import com.passus.st.client.http.DumperHttpClientListener; import com.passus.st.client.http.HttpClient; @@ -105,6 +106,11 @@ .build() ); + options.addOption(option("hp", "httpPorts").desc("Specify HTTP ports in input file.") + .hasArgs().argName("ports") + .build() + ); + options.addOption(option("rs", "replaySpeed").desc("Speedup factor (default 0 - top speed)") .hasArg().argName("speed") .build()); @@ -283,6 +289,14 @@ eventSrc.setAllowPartialSession(cl.hasOption("ps")); eventSrc.setCollectMetrics(true); + if (cl.hasOption("hp")) { + PortRangeSet portsRanges = eventSrc.getPortsRange(); + String[] ports = cl.getOptionValues("hp"); + for (String port : ports) { + portsRanges.add(port); + } + } + int loops = Integer.parseInt(cl.getOptionValue("lp", "1")); if (loops <= 0) { throw new Exception("Loop should be greater than zero.");