Mercurial > stress-tester
changeset 502:483eae2a2565
improvements
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFilterMessageWrapper.java Wed Aug 16 11:59:56 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFilterMessageWrapper.java Wed Aug 16 14:56:22 2017 +0200 @@ -36,4 +36,9 @@ public ByteString getVersion() { return message.getVersion(); } + + public ByteString getHeader(CharSequence name) { + HttpHeaders headers = message.getHeaders(); + return headers.get(name); + } }
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFilterRequestWrapper.java Wed Aug 16 11:59:56 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFilterRequestWrapper.java Wed Aug 16 14:56:22 2017 +0200 @@ -1,7 +1,6 @@ package com.passus.st.client.http.filter; import com.passus.data.ByteString; -import com.passus.net.http.HttpHeaders; import com.passus.net.http.HttpRequest; import com.passus.net.http.URL; import static com.passus.st.client.http.HttpConsts.TAG_SESSION_ID; @@ -33,9 +32,4 @@ public String getSessionId() { return (String) message.getTag(TAG_SESSION_ID); } - - public ByteString getHeader(CharSequence name) { - HttpHeaders headers = message.getHeaders(); - return headers.get(name); - } }
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMessageModificationFilter.java Wed Aug 16 11:59:56 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMessageModificationFilter.java Wed Aug 16 14:56:22 2017 +0200 @@ -53,9 +53,9 @@ protected final CharSequence extractValue(ValueExtractor extractor, HttpRequest req, HttpResponse resp, HttpFlowContext context) { Object value = HttpFiltersUtils.extractValue(extractor, req, resp, context); if (value instanceof CharSequence) { + LOGGER.debug("extractor={} extracted={}", extractor, value); return (CharSequence) value; } - LOGGER.debug("extractor={} extracted={}", extractor, value); return null; }
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMessagePredicate.java Wed Aug 16 11:59:56 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMessagePredicate.java Wed Aug 16 14:56:22 2017 +0200 @@ -35,4 +35,8 @@ return predicate.test(wrapper); } + @Override + public String toString() { + return predicate.toString(); + } }
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpResponseContentExtractorFilter.java Wed Aug 16 11:59:56 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpResponseContentExtractorFilter.java Wed Aug 16 14:56:22 2017 +0200 @@ -76,8 +76,10 @@ try { String value = contentExtractor.extract(response); - params.set(paramName, value); - LOGGER.debug("Session variable created {}={}", paramName, value); + if (value != null) { + params.set(paramName, value); + LOGGER.debug("Session variable created {}='{}'", paramName, value); + } } catch (IOException ex) { LOGGER.info("Could not read message body", ex); } @@ -100,8 +102,10 @@ try { String value = contentExtractor.extract(response); - params.set(paramName, value); - LOGGER.debug("Global variable created {}={}", paramName, value); + if (value != null) { + params.set(paramName, value); + LOGGER.debug("Global variable created {}='{}'", paramName, value); + } } catch (IOException ex) { LOGGER.info("Could not read message body", ex); } @@ -147,6 +151,9 @@ if (predicate != null) { HttpMessageWrapper wrapper = new HttpMessageWrapper(request, resp, context); exec = predicate.test(wrapper); + if (!exec) { + LOGGER.debug("response rejected [{}]: {}", predicate, resp.getHeaders()); + } } if (exec) {
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpSessionCookieFilter.java Wed Aug 16 11:59:56 2017 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpSessionCookieFilter.java Wed Aug 16 14:56:22 2017 +0200 @@ -139,8 +139,8 @@ HttpCookie requestCookie = findSessionCookie(modifiedRequest); HttpCookie inCookie = findSessionCookie(context.origReponse()); - String oldLiveSessionId = null; if (inCookie != null) { + String oldLiveSessionId = null; if (requestCookie != null) { oldLiveSessionId = requestCookie.getValue().toString(); ParametersBag session = context.scopes().getSession(oldLiveSessionId); @@ -148,7 +148,7 @@ } makeMappingTagsAndSession(modifiedRequest, realResponse, context, inCookie, oldLiveSessionId); } else if (requestCookie != null) { - makeMappingTagsAndSession(modifiedRequest, realResponse, context, requestCookie, oldLiveSessionId); + makeMappingTagsAndSession(modifiedRequest, realResponse, context, requestCookie, null); } else { Object sessionId = modifiedRequest.getTag(TAG_SESSION_ID); if (sessionId != null) {