Mercurial > stress-tester
changeset 790:bd1d28b5a096
Variable name convention changed. ${var} -> {$var}
author | Devel 2 |
---|---|
date | Wed, 20 Dec 2017 14:44:30 +0100 |
parents | 595f1081548e |
children | 91e24dd0e837 |
files | stress-tester/src/main/java/com/passus/st/vars/VarsCompiler.java stress-tester/src/test/java/com/passus/st/client/http/filter/HttpVarsFilterTest.java stress-tester/src/test/java/com/passus/st/vars/VarsCompilerTest.java stress-tester/src/test/java/com/passus/st/vars/VarsExecutorTest.java |
diffstat | 4 files changed, 18 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/vars/VarsCompiler.java Wed Dec 20 14:15:02 2017 +0100 +++ b/stress-tester/src/main/java/com/passus/st/vars/VarsCompiler.java Wed Dec 20 14:44:30 2017 +0100 @@ -15,8 +15,8 @@ */ public class VarsCompiler { - private static final byte VAR_START_1 = (byte) '$'; - private static final byte VAR_START_2 = (byte) '{'; + private static final byte VAR_START_1 = (byte) '{'; + private static final byte VAR_START_2 = (byte) '$'; private static final byte VAR_END = (byte) '}';
--- a/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpVarsFilterTest.java Wed Dec 20 14:15:02 2017 +0100 +++ b/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpVarsFilterTest.java Wed Dec 20 14:44:30 2017 +0100 @@ -53,7 +53,7 @@ + "Content-Type: application/x-www-form-urlencoded\r\n" + "Content-Length: 23\r\n" + "\r\n" - + "user=admin&pass=${var1}"; + + "user=admin&pass={$var1}"; HttpRequest request = TestHttpUtils.request(reqs); HttpVarsFilter filter = new HttpVarsFilter(resolver); @@ -77,13 +77,13 @@ String c1 = "--------------------1456847137\r\n" + "Content-Disposition: form-data; name=\"name\"\r\n\r\n" - + "Filter ${name}\r\n" + + "Filter {$name}\r\n" + "--------------------1456847137\r\n" + "Content-Disposition: form-data; name=\"description\"\r\n\r\n" + "Komputery korzystajÄ…ce z netu bez logowania do domeny\r\n" + "--------------------1456847137\r\n" + "Content-Disposition: form-data; name=\"type\"\r\n\r\n" - + "${type}\r\n"; + + "{$type}\r\n"; String cn = "--------------------1456847137--\r\n"; byte[] bytes = (hdrs + c1 + cn).getBytes(UTF_8); @@ -108,7 +108,7 @@ @Test public void testPut() throws IOException { HttpRequestBuilder builder = new HttpRequestBuilder("http://test.com", HttpMethod.PUT); - builder.content("{\"abc\": \"${var1}\"}", "application/json"); + builder.content("{\"abc\": \"{$var1}\"}", "application/json"); HttpRequest request = builder.build(); HttpVarsFilter filter = new HttpVarsFilter(resolver); @@ -122,7 +122,7 @@ @Test public void testPutDeflate() throws IOException { - String json = "{\"abc\": \"${var1}\"}"; + String json = "{\"abc\": \"{$var1}\"}"; byte[] plain = json.getBytes(); //18 byte[] deflate = CompressionUtils.deflate(plain); //26
--- a/stress-tester/src/test/java/com/passus/st/vars/VarsCompilerTest.java Wed Dec 20 14:15:02 2017 +0100 +++ b/stress-tester/src/test/java/com/passus/st/vars/VarsCompilerTest.java Wed Dec 20 14:44:30 2017 +0100 @@ -16,11 +16,8 @@ @DataProvider(name = "validOneVar") public Object[][] validOneVar() { return new Object[][]{ - {"${var}", "var", 0, 5}, - {"${var }", "var", 0, 8}, - {"${ var}", "var", 0, 8}, - {"${ var }", "var", 0, 11}, - {"abc ${var} def", "var", 4, 9} + {"{$var}", "var", 0, 5}, + {"abc {$var} def", "var", 4, 9} }; } @@ -37,7 +34,7 @@ @Test public void testSearch_ManyVars() { - List<Var> vars = compiler.search("a ${var1} ${var2} bcd ${var2}"); + List<Var> vars = compiler.search("a {$var1} {$var2} bcd {$var2}"); assertFalse(vars == null); assertEquals(3, vars.size());
--- a/stress-tester/src/test/java/com/passus/st/vars/VarsExecutorTest.java Wed Dec 20 14:15:02 2017 +0100 +++ b/stress-tester/src/test/java/com/passus/st/vars/VarsExecutorTest.java Wed Dec 20 14:44:30 2017 +0100 @@ -22,14 +22,14 @@ @DataProvider(name = "contents") public Object[][] contents() { return new Object[][]{ - {"${var1}", true, "abcdef"}, - {"${var1}${var3}", true, "abcdefa"}, - {"a ${var1} b ${var2}", true, "a abcdef b abc"}, - {"a ${var1} b ${var2} c ${unresolvable}", true, "a abcdef b abc c ${unresolvable}"}, - {"a ${var1} ${bad@var%name}", true, "a abcdef ${bad@var%name}"}, - {"${var1}g", true, "abcdefg"}, - {"${var", false, null}, - {"${unresolvable}", false, null}, + {"{$var1}", true, "abcdef"}, + {"{$var1}{$var3}", true, "abcdefa"}, + {"a {$var1} b {$var2}", true, "a abcdef b abc"}, + {"a {$var1} b {$var2} c {$unresolvable}", true, "a abcdef b abc c {$unresolvable}"}, + {"a {$var1} {$bad@var%name}", true, "a abcdef {$bad@var%name}"}, + {"{$var1}g", true, "abcdefg"}, + {"{$var", false, null}, + {"{$unresolvable}", false, null}, {"", false, null} }; }