Mercurial > stress-tester
changeset 1271:b51cb6766ca6
MessageWrapper.getSession, SequenceFilter - "session" variable
author | Devel 2 |
---|---|
date | Fri, 03 Jul 2020 11:36:39 +0200 |
parents | 15c0fcd63815 |
children | 4727d5e344f1 |
files | stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMessageWrapper.java stress-tester/src/main/java/com/passus/st/filter/MessageWrapper.java stress-tester/src/main/java/com/passus/st/filter/SequenceFilter.java |
diffstat | 3 files changed, 19 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMessageWrapper.java Fri Jul 03 11:18:13 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMessageWrapper.java Fri Jul 03 11:36:39 2020 +0200 @@ -1,19 +1,15 @@ package com.passus.st.client.http.filter; -import com.passus.net.http.HttpMessage; -import com.passus.net.http.HttpRequest; -import com.passus.net.http.HttpResponse; import com.passus.st.ParametersBag; import com.passus.st.client.FlowContext; -import com.passus.st.filter.MessageWrapper; import com.passus.st.client.http.HttpFlowContext; import com.passus.st.client.http.HttpScopes; -import com.passus.st.emitter.SessionInfo; +import com.passus.st.filter.MessageWrapper; /** * @author Mirosław Hawrot */ -public class HttpMessageWrapper extends MessageWrapper<HttpFilterRequestWrapper, HttpFilterResponseWrapper> { +public final class HttpMessageWrapper extends MessageWrapper<HttpFilterRequestWrapper, HttpFilterResponseWrapper> { private final HttpFilterResponseWrapper origResp; @@ -30,13 +26,6 @@ return origResp; } - public SessionInfo getSession() { - if (context != null) { - return context.sessionInfo(); - } - return null; - } - public HttpScopes getScopes() { if (httpContext != null) { return httpContext.scopes(); @@ -71,16 +60,4 @@ return scopes.getConversation(req.message); } - private HttpFilterMessageWrapper createWrapper(HttpMessage message) { - if (message == null) { - return null; - } - - if (message.isRequest()) { - return new HttpFilterRequestWrapper((HttpRequest) message); - } else { - return new HttpFilterResponseWrapper((HttpResponse) message); - } - } - }
--- a/stress-tester/src/main/java/com/passus/st/filter/MessageWrapper.java Fri Jul 03 11:18:13 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/filter/MessageWrapper.java Fri Jul 03 11:36:39 2020 +0200 @@ -1,6 +1,7 @@ package com.passus.st.filter; import com.passus.st.client.FlowContext; +import com.passus.st.emitter.SessionInfo; public class MessageWrapper<R, S> { @@ -24,4 +25,11 @@ return resp; } + public SessionInfo getSession() { + if (context != null) { + return context.sessionInfo(); + } + return null; + } + }
--- a/stress-tester/src/main/java/com/passus/st/filter/SequenceFilter.java Fri Jul 03 11:18:13 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/filter/SequenceFilter.java Fri Jul 03 11:36:39 2020 +0200 @@ -272,9 +272,7 @@ } if (chains.size() <= maxSequences) { - final Map<String, Object> valueMap = new HashMap<>(2); - valueMap.put("req", value.getReq()); - valueMap.put("resp", value.getResp()); + final Map<String, Object> valueMap = createMap(value); if (rootStage.match(valueMap)) { StageChain chain = new StageChain(valueMap); chain.setStage(now, rootStage, null); @@ -305,6 +303,13 @@ return DUNNO; } + private static Map<String, Object> createMap(MessageWrapper newValue) { + Map<String, Object> map = new HashMap<>(3); + map.put("req", newValue.getReq()); + map.put("resp", newValue.getResp()); + map.put("session", newValue.getSession()); + return map; + } public static class Stage { @@ -401,9 +406,7 @@ } public Map<String, Object> mergeValue(MessageWrapper newValue) { - Map<String, Object> out = new HashMap<>(2); - out.put("req", newValue.getReq()); - out.put("resp", newValue.getResp()); + Map<String, Object> out = createMap(newValue); return out; }