use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testUserAgent.
@Test
public void testUserAgent() {
String cmdLine = "curl 'http://jmeter.apache.org/' -H 'User-Agent: Mozilla/5.0 (Macintosh;" + " Intel Mac OS X 10.11; rv:63.0) Gecko/20100101 Firefox/63.0' " + "-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' " + "-H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'DNT: 1' " + "-H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -A 'Mozilla/5.0'";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertEquals(5, request.getHeaders().size(), "With method 'parser', the quantity of Headers should be 5'");
assertTrue(request.getHeaders().contains(Pair.of("User-Agent", "Mozilla/5.0")), "With method 'parser', Headers need to add 'user-agent' with value 'Mozilla/5.0' ");
}
use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testIgnoreOptions.
@Test
public void testIgnoreOptions() {
String cmdLine = "curl 'http://jmeter.apache.org/' --include --keepalive-time '20'";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
List<String> listOptions = request.getOptionsIgnored();
assertTrue(listOptions.contains("include"), "The list of ignored options should contain 'include'");
assertTrue(listOptions.contains("keepalive-time"), "The list of ignored options should contain 'keepalive-time'");
}
use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testLimitRate.
@Test
public void testLimitRate() {
String cmdLine = "curl 'http://jmeter.apache.org/' --limit-rate '1g'";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertEquals(1024000000, request.getLimitRate());
cmdLine = "curl 'http://jmeter.apache.org/' --limit-rate '171k'";
request = basicCurlParser.parse(cmdLine);
assertEquals(175104, request.getLimitRate());
cmdLine = "curl 'http://jmeter.apache.org/' --limit-rate '54M'";
request = basicCurlParser.parse(cmdLine);
assertEquals(55296000, request.getLimitRate());
}
use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testCiphers.
@Test
public void testCiphers() {
String cmdLine = "curl 'http://jmeter.apache.org/' --ciphers 'test.pem' ";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertEquals("ciphers", request.getCaCert(), "With method 'parser',the cacert need to show a warning' ");
}
use of org.apache.jmeter.protocol.http.curl.BasicCurlParser in project jmeter by apache.
the class BasicCurlParserTest method testNotKeepAlive.
@Test
public void testNotKeepAlive() {
String cmdLine = "curl -X POST \"https://api.imgur.com/3/upload\" " + " -H 'Authorization: Client-ID fb52f2bfa714a36' --dns-servers '0.0.0.0,1.1.1.1' --no-keepalive ";
BasicCurlParser basicCurlParser = new BasicCurlParser();
BasicCurlParser.Request request = basicCurlParser.parse(cmdLine);
assertFalse(request.isKeepAlive(), "With method 'parser', keepalive should be disabled");
}
Aggregations