Mercurial > stress-tester
changeset 726:af5daf4a3879
minor
author | Devel 1 |
---|---|
date | Fri, 01 Dec 2017 14:25:05 +0100 |
parents | 75cf7ccbbff2 |
children | 7bc4eb666b7f |
files | stress-tester/src/test/java/com/passus/st/client/http/filter/HttpDateFilterTest.java stress-tester/src/test/java/com/passus/st/client/http/filter/HttpFilterTestUtils.java stress-tester/src/test/java/com/passus/st/client/http/filter/HttpMessageModificationFilterTest.java stress-tester/src/test/java/com/passus/st/client/http/filter/HttpMvelFilterTest.java |
diffstat | 4 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpDateFilterTest.java Fri Dec 01 13:22:16 2017 +0100 +++ b/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpDateFilterTest.java Fri Dec 01 14:25:05 2017 +0100 @@ -26,4 +26,7 @@ assertEquals(req.getHeaders().get(HttpHeaders.DATE).toString(), "Fri, 14 Jul 2017 02:40:00 GMT"); } + public static void setDate(HttpDateFilter filter, long date) { + filter.setGenerator(new CustomTimeGenerator(date)); + } }
--- a/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpFilterTestUtils.java Fri Dec 01 13:22:16 2017 +0100 +++ b/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpFilterTestUtils.java Fri Dec 01 14:25:05 2017 +0100 @@ -22,14 +22,14 @@ */ public class HttpFilterTestUtils { - protected static HttpFlowContext createMockContext() { + public static HttpFlowContext createMockContext() { HttpFlowContext mockContext = mock(HttpFlowContext.class); final HttpScopes scopes = new HttpScopes(); when(mockContext.scopes()).thenReturn(scopes); return mockContext; } - protected static HttpMessagePredicate createPredicate(String config) { + public static HttpMessagePredicate createPredicate(String config) { try { Predicate predicate = Transformers.PREDICATE.transform(config); return new HttpMessagePredicate(predicate); @@ -38,13 +38,13 @@ } } - protected static void tagMessages(HttpMessage... messages) { + public static void tagMessages(HttpMessage... messages) { for (HttpMessage message : messages) { message.setTag(TAG_SESSION_ID, "sid1"); } } - protected static void printErrors(Errors errors) { + public static void printErrors(Errors errors) { List<ObjectError> allErrors = errors.getAllErrors(); if (allErrors.size() > 0) { System.out.println("ERRORS:"); @@ -54,7 +54,7 @@ } } - protected static Map<String, ParametersBag> getSessions(HttpScopes scopes) { + public static Map<String, ParametersBag> getSessions(HttpScopes scopes) { Map<String, Map<String, ParametersBag>> zonesSessions = ReflectionUtils.<Map>getField(scopes, "zonesSessions"); Map<String, ParametersBag> defaultZone = zonesSessions.get(ZONE_DEFAULT); System.out.println(defaultZone);
--- a/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpMessageModificationFilterTest.java Fri Dec 01 13:22:16 2017 +0100 +++ b/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpMessageModificationFilterTest.java Fri Dec 01 14:25:05 2017 +0100 @@ -46,7 +46,8 @@ @Test(enabled = true) public void testFilterOutbound() throws Exception { - HttpRequest req = HttpRequestBuilder.post("http://test.com/path/test?uParam1=1", "param1=value1¶m2=value2¶m3=value3") + HttpRequest req = HttpRequestBuilder + .post("http://test.com/path/test?uParam1=1", "param1=value1¶m2=value2¶m3=value3") .header("Header1", "Header1Value1") .header("Header2", "Header1Value2") .header("Header3", "Header1Value3")
--- a/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpMvelFilterTest.java Fri Dec 01 13:22:16 2017 +0100 +++ b/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpMvelFilterTest.java Fri Dec 01 14:25:05 2017 +0100 @@ -56,7 +56,7 @@ assertEquals(0, filter.filterInbound(null, null, null)); } - private static ExecutableStatement es(String expression) { + public static ExecutableStatement es(String expression) { return (ExecutableStatement) MVEL.compileExpression(expression); } }