changeset 876:40674a682e7f

rename
author Devel 1
date Fri, 02 Feb 2018 12:27:02 +0100
parents 1bb2a1f9b982
children 145eb1d60983
files stress-tester/src/main/java/com/passus/st/filter/HttpMessageHeaderValueExtractor.java stress-tester/src/main/java/com/passus/st/filter/HttpMessageValueExtractor.java stress-tester/src/main/java/com/passus/st/filter/HttpMessageValueExtractorResolver.java stress-tester/src/main/java/com/passus/st/filter/HttpMessageWrapperDynamicExtractor.java stress-tester/src/main/java/com/passus/st/filter/HttpMessageWrapperExtractorResolver.java stress-tester/src/main/java/com/passus/st/filter/HttpMessageWrapperStaticExtractor.java stress-tester/src/main/java/com/passus/st/filter/Transformers.java stress-tester/src/main/java/com/passus/st/vars/VarsValueExtractorResolver.java stress-tester/src/test/java/com/passus/st/filter/HttpMessageHeaderValueExtractorTest.java stress-tester/src/test/java/com/passus/st/filter/HttpMessageValueExtractorTest.java stress-tester/src/test/java/com/passus/st/filter/HttpMessageWrapperDynamicExtractorTest.java stress-tester/src/test/java/com/passus/st/filter/HttpMessageWrapperStaticExtractorTest.java
diffstat 12 files changed, 692 insertions(+), 694 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/filter/HttpMessageHeaderValueExtractor.java	Fri Jan 26 14:50:03 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,334 +0,0 @@
-package com.passus.st.filter;
-
-import com.passus.data.ByteString;
-import com.passus.filter.ValueExtractor;
-import com.passus.net.http.HttpMessage;
-import com.passus.net.http.HttpMessageHelper;
-import com.passus.st.ParametersBag;
-import com.passus.st.client.http.extractor.ContentExtractor;
-import com.passus.st.client.http.extractor.ContentExtractorUtils;
-import com.passus.st.client.http.filter.HttpMessageWrapper;
-import java.util.Objects;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-/**
- *
- * @author mikolaj.podbielski
- */
-public class HttpMessageHeaderValueExtractor implements ValueExtractor {
-
-    private static final Logger LOGGER = LogManager.getLogger(HttpMessageHeaderValueExtractor.class);
-
-    static final Pattern REQ_COOKIE_FUN = Pattern.compile("req\\.getCookie\\(.*'(.*)'\\)");
-    static final Pattern REQ_HEADER_FUN = Pattern.compile("req\\.getHeader\\(.*'(.*)'\\)");
-    static final Pattern RESP_COOKIE_FUN = Pattern.compile("resp\\.getCookie\\(.*'(.*)'\\)");
-    static final Pattern RESP_HEADER_FUN = Pattern.compile("resp\\.getHeader\\(.*'(.*)'\\)");
-    static final Pattern HTTP_SESS_FUN = Pattern.compile("httpSession\\.get\\(.*'(.*)'\\)");
-
-    static final String REQ_COOKIE_SF = "req.cookie@";
-    static final String REQ_HEADER_SF = "req.header@";
-    static final String REQ_FULL_CONTENT_SF = "req.content";
-
-    static final String RESP_COOKIE_SF = "resp.cookie@";
-    static final String RESP_HEADER_SF = "resp.header@";
-    static final String RESP_FULL_CONTENT_SF = "resp.content";
-
-    static final String HTTP_SESSION_SF = "sess@";
-
-    static abstract class Operation {
-
-        protected String name;
-
-        public abstract Object extract(HttpMessageWrapper wrapper);
-
-        @Override
-        public int hashCode() {
-            return getClass().hashCode() ^ name.hashCode();
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj == null) {
-                return false;
-            }
-            if (getClass() != obj.getClass()) {
-                return false;
-            }
-            final Operation other = (Operation) obj;
-            return name.equals(other.name);
-        }
-    }
-
-    private static class GetReqCookieOperation extends Operation {
-
-        @Override
-        public ByteString extract(HttpMessageWrapper wrapper) {
-            if (wrapper.getReq() == null) {
-                return null;
-            }
-
-            return wrapper.getReq().getCookie(name);
-        }
-    }
-
-    private static class GetReqHeaderOperation extends Operation {
-
-        @Override
-        public ByteString extract(HttpMessageWrapper wrapper) {
-            if (wrapper.getReq() == null) {
-                return null;
-            }
-
-            return wrapper.getReq().getHeader(name);
-        }
-    }
-
-    private static class GetRespCookieOperation extends Operation {
-
-        @Override
-        public ByteString extract(HttpMessageWrapper wrapper) {
-            if (wrapper.getResp() == null) {
-                return null;
-            }
-
-            return wrapper.getResp().getCookie(name);
-        }
-    }
-
-    private static class GetRespHeaderOperation extends Operation {
-
-        @Override
-        public ByteString extract(HttpMessageWrapper wrapper) {
-            if (wrapper.getResp() == null) {
-                return null;
-            }
-
-            return wrapper.getResp().getHeader(name);
-        }
-    }
-
-    private static class GetSessionVariable extends Operation {
-
-        @Override
-        public Object extract(HttpMessageWrapper wrapper) {
-            ParametersBag httpSession = wrapper.getHttpSession();
-            return httpSession == null ? null : httpSession.get(name);
-        }
-    }
-
-    private static abstract class ExtractContentOperation extends Operation {
-
-        protected final HttpMessageHelper httpMessageHelper = HttpMessageHelper.NOT_STRICT;
-
-        private ContentExtractor contentExtractor;
-
-        public ExtractContentOperation() {
-
-        }
-
-        public ExtractContentOperation(String rule) {
-            contentExtractor = ContentExtractorUtils.createExtractor(rule);
-        }
-
-        public ExtractContentOperation(ContentExtractor contentExtractor) {
-            this.contentExtractor = contentExtractor;
-        }
-
-        protected final Object extract(HttpMessage message) {
-            try {
-                if (message == null) {
-                    return null;
-                }
-
-                if (contentExtractor != null) {
-                    return contentExtractor.extract(message);
-                } else {
-                    return httpMessageHelper.contentToString(message, true);
-                }
-            } catch (Exception e) {
-                if (LOGGER.isDebugEnabled()) {
-                    LOGGER.debug(e.getMessage(), e);
-                }
-
-                return "";
-            }
-        }
-
-    }
-
-    private static class ExtractReqContentOperation extends ExtractContentOperation {
-
-        public ExtractReqContentOperation() {
-        }
-
-        public ExtractReqContentOperation(String rule) {
-            super(rule);
-        }
-
-        public ExtractReqContentOperation(ContentExtractor contentExtractor) {
-            super(contentExtractor);
-        }
-
-        @Override
-        public Object extract(HttpMessageWrapper wrapper) {
-            if (wrapper.getReq() == null) {
-                return null;
-            }
-
-            return extract(wrapper.getReq().getWrappedMessage());
-        }
-
-    }
-
-    private static class ExtractRespContentOperation extends ExtractContentOperation {
-
-        public ExtractRespContentOperation() {
-        }
-
-        public ExtractRespContentOperation(String rule) {
-            super(rule);
-        }
-
-        public ExtractRespContentOperation(ContentExtractor contentExtractor) {
-            super(contentExtractor);
-        }
-
-        @Override
-        public Object extract(HttpMessageWrapper wrapper) {
-            if (wrapper.getResp() == null) {
-                return null;
-            }
-
-            return extract(wrapper.getResp().getWrappedMessage());
-        }
-
-    }
-
-    static Operation createForFunction(String expr) {
-        Operation op = null;
-        String name;
-        if ((name = matchAndExtract(REQ_COOKIE_FUN, expr)) != null) {
-            op = new GetReqCookieOperation();
-            op.name = name;
-        } else if ((name = matchAndExtract(REQ_HEADER_FUN, expr)) != null) {
-            op = new GetReqHeaderOperation();
-            op.name = name;
-        } else if ((name = matchAndExtract(RESP_COOKIE_FUN, expr)) != null) {
-            op = new GetRespCookieOperation();
-            op.name = name;
-        } else if ((name = matchAndExtract(RESP_HEADER_FUN, expr)) != null) {
-            op = new GetRespHeaderOperation();
-            op.name = name;
-        } else if ((name = matchAndExtract(HTTP_SESS_FUN, expr)) != null) {
-            op = new GetSessionVariable();
-            op.name = name;
-        }
-        return op;
-    }
-
-    static Operation createForShortForm(String expr) {
-        Operation op = null;
-        if (expr.startsWith(REQ_COOKIE_SF)) {
-            op = new GetReqCookieOperation();
-            op.name = expr.substring(REQ_COOKIE_SF.length());
-        } else if (expr.startsWith(REQ_HEADER_SF)) {
-            op = new GetReqHeaderOperation();
-            op.name = expr.substring(REQ_HEADER_SF.length());
-        } else if (expr.startsWith(REQ_FULL_CONTENT_SF)) {
-            if (REQ_FULL_CONTENT_SF.length() == expr.length()) {
-                op = new ExtractReqContentOperation();
-            } else {
-                String subExpr = expr.substring(REQ_FULL_CONTENT_SF.length());
-                if (subExpr.charAt(0) == '|') {
-                    op = new ExtractReqContentOperation(subExpr.substring(1));
-                } else {
-                    throw new IllegalArgumentException("Invalid extractor '" + expr + "'.");
-                }
-            }
-        } else if (expr.startsWith(RESP_COOKIE_SF)) {
-            op = new GetRespCookieOperation();
-            op.name = expr.substring(RESP_COOKIE_SF.length());
-        } else if (expr.startsWith(RESP_HEADER_SF)) {
-            op = new GetRespHeaderOperation();
-            op.name = expr.substring(RESP_HEADER_SF.length());
-        } else if (expr.startsWith(HTTP_SESSION_SF)) {
-            op = new GetSessionVariable();
-            op.name = expr.substring(HTTP_SESSION_SF.length());
-        } else if (expr.startsWith(RESP_FULL_CONTENT_SF)) {
-            if (RESP_FULL_CONTENT_SF.length() == expr.length()) {
-                op = new ExtractRespContentOperation();
-            } else {
-                String subExpr = expr.substring(RESP_FULL_CONTENT_SF.length());
-                if (subExpr.charAt(0) == '|') {
-                    op = new ExtractRespContentOperation(subExpr.substring(1));
-                } else {
-                    throw new IllegalArgumentException("Invalid extractor '" + expr + "'.");
-                }
-            }
-        }
-
-        return op;
-    }
-
-    static String matchAndExtract(Pattern pattern, String fieldName) {
-        Matcher matcher = pattern.matcher(fieldName);
-        if (matcher.find()) {
-            matcher.groupCount();
-            if (matcher.groupCount() >= 1) {
-                int start = matcher.start(1);
-                int end = matcher.end(1);
-                if (start != -1 && end != -1) {
-                    return fieldName.substring(start, end);
-                }
-            }
-        }
-        return null;
-    }
-
-    private final ValueExtractor fallbackExtractor;
-
-    private final Operation operation;
-
-    HttpMessageHeaderValueExtractor(Operation operation, ValueExtractor fallbackExtractor) {
-        this.operation = operation;
-        this.fallbackExtractor = fallbackExtractor;
-    }
-
-    @Override
-    public Object extract(Object object) {
-        if (object instanceof HttpMessageWrapper) {
-            return extractFromWrapper((HttpMessageWrapper) object);
-        }
-
-        return fallbackExtractor.extract(object);
-    }
-
-    private Object extractFromWrapper(HttpMessageWrapper wrapper) {
-        return operation.extract(wrapper);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(fallbackExtractor) ^ Objects.hashCode(operation);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!(obj instanceof HttpMessageHeaderValueExtractor)) {
-            return false;
-        }
-
-        final HttpMessageHeaderValueExtractor other = (HttpMessageHeaderValueExtractor) obj;
-        return Objects.equals(fallbackExtractor, other.fallbackExtractor) && Objects.equals(operation, other.operation);
-    }
-
-}
--- a/stress-tester/src/main/java/com/passus/st/filter/HttpMessageValueExtractor.java	Fri Jan 26 14:50:03 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-package com.passus.st.filter;
-
-import com.passus.filter.BeanValueExtractor;
-import com.passus.filter.ValueExtractor;
-import com.passus.net.http.URL;
-import com.passus.st.client.http.filter.HttpMessageWrapper;
-import java.util.Objects;
-
-/**
- *
- * @author mikolaj.podbielski
- */
-public class HttpMessageValueExtractor implements ValueExtractor {
-
-    private final ValueExtractor fallbackExtractor;
-
-    private final String fieldName;
-
-    public HttpMessageValueExtractor(String fieldName) {
-        this(fieldName, new BeanValueExtractor(fieldName));
-    }
-
-    public HttpMessageValueExtractor(String fieldName, ValueExtractor fallbackExtractor) {
-        this.fieldName = fieldName;
-        this.fallbackExtractor = fallbackExtractor;
-    }
-
-    @Override
-    public Object extract(Object object) {
-        if (object instanceof HttpMessageWrapper) {
-            return extractFromWrapper((HttpMessageWrapper) object);
-        }
-
-        return fallbackExtractor.extract(object);
-    }
-
-    private Object extractFromWrapper(HttpMessageWrapper wrapper) {
-        switch (fieldName) {
-            case "req.version":
-            case "req.getVersion()":
-                return wrapper.getReq().getVersion();
-            case "req.method":
-            case "req.getMethod()":
-                return wrapper.getReq().getMethod();
-            case "req.sessionId":
-            case "req.getSessionId()":
-                return wrapper.getReq().getSessionId();
-            case "req.url":
-            case "req.getUrl()":
-                return wrapper.getReq().getUrl();
-            case "req.uri":
-            case "req.getUri()":
-                return wrapper.getReq().getUri();
-            case "resp.version":
-            case "resp.getVersion()":
-                return wrapper.getResp().getVersion();
-            case "resp.status":
-            case "resp.getStatus()":
-                return wrapper.getResp().getStatus();
-            case "resp.status.code":
-            case "resp.getStatus().getCode()":
-                return wrapper.getResp().getStatus().getCode();
-            default:
-                if (fieldName.startsWith("req.url.")) {
-                    URL url = wrapper.getReq().getUrl();
-                    String urlPart = fieldName.substring(8);
-                    switch (urlPart) {
-                        case "authority":
-                            return url.getAuthority();
-                        case "host":
-                            return url.getHost();
-                        case "path":
-                            return url.getPath();
-                        case "port":
-                            return url.getPort();
-                        case "query":
-                            return url.getQuery();
-                        case "ref":
-                            return url.getRef();
-                        case "scheme":
-                            return url.getScheme();
-                        case "userInfo":
-                            return url.getUserInfo();
-                    }
-                }
-                return fallbackExtractor.extract(wrapper);
-        }
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(fallbackExtractor) ^ Objects.hashCode(fieldName);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!(obj instanceof HttpMessageValueExtractor)) {
-            return false;
-        }
-
-        final HttpMessageValueExtractor other = (HttpMessageValueExtractor) obj;
-        return Objects.equals(fieldName, other.fieldName) && Objects.equals(fallbackExtractor, other.fallbackExtractor);
-    }
-
-}
--- a/stress-tester/src/main/java/com/passus/st/filter/HttpMessageValueExtractorResolver.java	Fri Jan 26 14:50:03 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-package com.passus.st.filter;
-
-import com.passus.filter.ValueExtractor;
-import com.passus.filter.config.DefaultValueExtractorResolver;
-import com.passus.filter.config.ValueExtractorResolver;
-
-/**
- *
- * @author mikolaj.podbielski
- */
-public class HttpMessageValueExtractorResolver implements ValueExtractorResolver {
-
-    private final ValueExtractorResolver extractorFactory = new DefaultValueExtractorResolver();
-
-    @Override
-    public ValueExtractor resolveValueExtractor(String fieldName) {
-        ValueExtractor valueExtractor = extractorFactory.resolveValueExtractor(fieldName);
-        HttpMessageHeaderValueExtractor.Operation operation = HttpMessageHeaderValueExtractor.createForFunction(fieldName);
-        if (operation != null) {
-            return new HttpMessageHeaderValueExtractor(operation, valueExtractor);
-        }
-
-        operation = HttpMessageHeaderValueExtractor.createForShortForm(fieldName);
-        if (operation != null) {
-            return new HttpMessageHeaderValueExtractor(operation, valueExtractor);
-        }
-
-        return new HttpMessageValueExtractor(fieldName, valueExtractor);
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stress-tester/src/main/java/com/passus/st/filter/HttpMessageWrapperDynamicExtractor.java	Fri Feb 02 12:27:02 2018 +0100
@@ -0,0 +1,108 @@
+package com.passus.st.filter;
+
+import com.passus.filter.BeanValueExtractor;
+import com.passus.filter.ValueExtractor;
+import com.passus.net.http.URL;
+import com.passus.st.client.http.filter.HttpMessageWrapper;
+import java.util.Objects;
+
+/**
+ *
+ * @author mikolaj.podbielski
+ */
+public class HttpMessageWrapperDynamicExtractor implements ValueExtractor {
+
+    private final ValueExtractor fallbackExtractor;
+
+    private final String fieldName;
+
+    public HttpMessageWrapperDynamicExtractor(String fieldName) {
+        this(fieldName, new BeanValueExtractor(fieldName));
+    }
+
+    public HttpMessageWrapperDynamicExtractor(String fieldName, ValueExtractor fallbackExtractor) {
+        this.fieldName = fieldName;
+        this.fallbackExtractor = fallbackExtractor;
+    }
+
+    @Override
+    public Object extract(Object object) {
+        if (object instanceof HttpMessageWrapper) {
+            return extractFromWrapper((HttpMessageWrapper) object);
+        }
+
+        return fallbackExtractor.extract(object);
+    }
+
+    private Object extractFromWrapper(HttpMessageWrapper wrapper) {
+        switch (fieldName) {
+            case "req.version":
+            case "req.getVersion()":
+                return wrapper.getReq().getVersion();
+            case "req.method":
+            case "req.getMethod()":
+                return wrapper.getReq().getMethod();
+            case "req.sessionId":
+            case "req.getSessionId()":
+                return wrapper.getReq().getSessionId();
+            case "req.url":
+            case "req.getUrl()":
+                return wrapper.getReq().getUrl();
+            case "req.uri":
+            case "req.getUri()":
+                return wrapper.getReq().getUri();
+            case "resp.version":
+            case "resp.getVersion()":
+                return wrapper.getResp().getVersion();
+            case "resp.status":
+            case "resp.getStatus()":
+                return wrapper.getResp().getStatus();
+            case "resp.status.code":
+            case "resp.getStatus().getCode()":
+                return wrapper.getResp().getStatus().getCode();
+            default:
+                if (fieldName.startsWith("req.url.")) {
+                    URL url = wrapper.getReq().getUrl();
+                    String urlPart = fieldName.substring(8);
+                    switch (urlPart) {
+                        case "authority":
+                            return url.getAuthority();
+                        case "host":
+                            return url.getHost();
+                        case "path":
+                            return url.getPath();
+                        case "port":
+                            return url.getPort();
+                        case "query":
+                            return url.getQuery();
+                        case "ref":
+                            return url.getRef();
+                        case "scheme":
+                            return url.getScheme();
+                        case "userInfo":
+                            return url.getUserInfo();
+                    }
+                }
+                return fallbackExtractor.extract(wrapper);
+        }
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(fallbackExtractor) ^ Objects.hashCode(fieldName);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof HttpMessageWrapperDynamicExtractor)) {
+            return false;
+        }
+
+        final HttpMessageWrapperDynamicExtractor other = (HttpMessageWrapperDynamicExtractor) obj;
+        return Objects.equals(fieldName, other.fieldName) && Objects.equals(fallbackExtractor, other.fallbackExtractor);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stress-tester/src/main/java/com/passus/st/filter/HttpMessageWrapperExtractorResolver.java	Fri Feb 02 12:27:02 2018 +0100
@@ -0,0 +1,33 @@
+package com.passus.st.filter;
+
+import com.passus.filter.ValueExtractor;
+import com.passus.filter.config.DefaultValueExtractorResolver;
+import com.passus.filter.config.ValueExtractorResolver;
+
+/**
+ *
+ * @author mikolaj.podbielski
+ */
+public class HttpMessageWrapperExtractorResolver implements ValueExtractorResolver {
+
+    private final ValueExtractorResolver fallbackResolver = new DefaultValueExtractorResolver();
+
+    @Override
+    public ValueExtractor resolveValueExtractor(String fieldName) {
+        ValueExtractor fallbackExtractor = fallbackResolver.resolveValueExtractor(fieldName);
+        HttpMessageWrapperStaticExtractor.Operation operation;
+
+        operation = HttpMessageWrapperStaticExtractor.createForFunction(fieldName);
+        if (operation != null) {
+            return new HttpMessageWrapperStaticExtractor(operation, fallbackExtractor);
+        }
+
+        operation = HttpMessageWrapperStaticExtractor.createForShortForm(fieldName);
+        if (operation != null) {
+            return new HttpMessageWrapperStaticExtractor(operation, fallbackExtractor);
+        }
+
+        return new HttpMessageWrapperDynamicExtractor(fieldName, fallbackExtractor);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stress-tester/src/main/java/com/passus/st/filter/HttpMessageWrapperStaticExtractor.java	Fri Feb 02 12:27:02 2018 +0100
@@ -0,0 +1,330 @@
+package com.passus.st.filter;
+
+import com.passus.data.ByteString;
+import com.passus.filter.ValueExtractor;
+import com.passus.net.http.HttpMessage;
+import com.passus.net.http.HttpMessageHelper;
+import com.passus.st.ParametersBag;
+import com.passus.st.client.http.extractor.ContentExtractor;
+import com.passus.st.client.http.extractor.ContentExtractorUtils;
+import com.passus.st.client.http.filter.HttpMessageWrapper;
+import java.util.Objects;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+/**
+ *
+ * @author mikolaj.podbielski
+ */
+public class HttpMessageWrapperStaticExtractor implements ValueExtractor {
+
+    private static final Logger LOGGER = LogManager.getLogger(HttpMessageWrapperStaticExtractor.class);
+
+    static final Pattern REQ_COOKIE_FUN = Pattern.compile("req\\.getCookie\\(.*'(.*)'\\)");
+    static final Pattern REQ_HEADER_FUN = Pattern.compile("req\\.getHeader\\(.*'(.*)'\\)");
+    static final Pattern RESP_COOKIE_FUN = Pattern.compile("resp\\.getCookie\\(.*'(.*)'\\)");
+    static final Pattern RESP_HEADER_FUN = Pattern.compile("resp\\.getHeader\\(.*'(.*)'\\)");
+    static final Pattern HTTP_SESS_FUN = Pattern.compile("httpSession\\.get\\(.*'(.*)'\\)");
+
+    static final String REQ_COOKIE_SF = "req.cookie@";
+    static final String REQ_HEADER_SF = "req.header@";
+    static final String REQ_FULL_CONTENT_SF = "req.content";
+
+    static final String RESP_COOKIE_SF = "resp.cookie@";
+    static final String RESP_HEADER_SF = "resp.header@";
+    static final String RESP_FULL_CONTENT_SF = "resp.content";
+
+    static final String HTTP_SESSION_SF = "sess@";
+
+    static abstract class Operation {
+
+        protected String name;
+
+        public abstract Object extract(HttpMessageWrapper wrapper);
+
+        @Override
+        public int hashCode() {
+            return getClass().hashCode() ^ name.hashCode();
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            final Operation other = (Operation) obj;
+            return name.equals(other.name);
+        }
+    }
+
+    private static class GetReqCookieOperation extends Operation {
+
+        @Override
+        public ByteString extract(HttpMessageWrapper wrapper) {
+            if (wrapper.getReq() == null) {
+                return null;
+            }
+
+            return wrapper.getReq().getCookie(name);
+        }
+    }
+
+    private static class GetReqHeaderOperation extends Operation {
+
+        @Override
+        public ByteString extract(HttpMessageWrapper wrapper) {
+            if (wrapper.getReq() == null) {
+                return null;
+            }
+
+            return wrapper.getReq().getHeader(name);
+        }
+    }
+
+    private static class GetRespCookieOperation extends Operation {
+
+        @Override
+        public ByteString extract(HttpMessageWrapper wrapper) {
+            if (wrapper.getResp() == null) {
+                return null;
+            }
+
+            return wrapper.getResp().getCookie(name);
+        }
+    }
+
+    private static class GetRespHeaderOperation extends Operation {
+
+        @Override
+        public ByteString extract(HttpMessageWrapper wrapper) {
+            if (wrapper.getResp() == null) {
+                return null;
+            }
+
+            return wrapper.getResp().getHeader(name);
+        }
+    }
+
+    private static class GetSessionVariable extends Operation {
+
+        @Override
+        public Object extract(HttpMessageWrapper wrapper) {
+            ParametersBag httpSession = wrapper.getHttpSession();
+            return httpSession == null ? null : httpSession.get(name);
+        }
+    }
+
+    private static abstract class ExtractContentOperation extends Operation {
+
+        protected final HttpMessageHelper httpMessageHelper = HttpMessageHelper.NOT_STRICT;
+
+        private ContentExtractor contentExtractor;
+
+        public ExtractContentOperation() {
+
+        }
+
+        public ExtractContentOperation(String rule) {
+            contentExtractor = ContentExtractorUtils.createExtractor(rule);
+        }
+
+        public ExtractContentOperation(ContentExtractor contentExtractor) {
+            this.contentExtractor = contentExtractor;
+        }
+
+        protected final Object extract(HttpMessage message) {
+            try {
+                if (message == null) {
+                    return null;
+                }
+
+                if (contentExtractor != null) {
+                    return contentExtractor.extract(message);
+                } else {
+                    return httpMessageHelper.contentToString(message, true);
+                }
+            } catch (Exception e) {
+                if (LOGGER.isDebugEnabled()) {
+                    LOGGER.debug(e.getMessage(), e);
+                }
+
+                return "";
+            }
+        }
+
+    }
+
+    private static class ExtractReqContentOperation extends ExtractContentOperation {
+
+        public ExtractReqContentOperation() {
+        }
+
+        public ExtractReqContentOperation(String rule) {
+            super(rule);
+        }
+
+        public ExtractReqContentOperation(ContentExtractor contentExtractor) {
+            super(contentExtractor);
+        }
+
+        @Override
+        public Object extract(HttpMessageWrapper wrapper) {
+            if (wrapper.getReq() == null) {
+                return null;
+            }
+
+            return extract(wrapper.getReq().getWrappedMessage());
+        }
+
+    }
+
+    private static class ExtractRespContentOperation extends ExtractContentOperation {
+
+        public ExtractRespContentOperation() {
+        }
+
+        public ExtractRespContentOperation(String rule) {
+            super(rule);
+        }
+
+        public ExtractRespContentOperation(ContentExtractor contentExtractor) {
+            super(contentExtractor);
+        }
+
+        @Override
+        public Object extract(HttpMessageWrapper wrapper) {
+            if (wrapper.getResp() == null) {
+                return null;
+            }
+
+            return extract(wrapper.getResp().getWrappedMessage());
+        }
+
+    }
+
+    static Operation createForFunction(String expr) {
+        Operation op = null;
+        String name;
+        if ((name = matchAndExtract(REQ_COOKIE_FUN, expr)) != null) {
+            op = new GetReqCookieOperation();
+            op.name = name;
+        } else if ((name = matchAndExtract(REQ_HEADER_FUN, expr)) != null) {
+            op = new GetReqHeaderOperation();
+            op.name = name;
+        } else if ((name = matchAndExtract(RESP_COOKIE_FUN, expr)) != null) {
+            op = new GetRespCookieOperation();
+            op.name = name;
+        } else if ((name = matchAndExtract(RESP_HEADER_FUN, expr)) != null) {
+            op = new GetRespHeaderOperation();
+            op.name = name;
+        } else if ((name = matchAndExtract(HTTP_SESS_FUN, expr)) != null) {
+            op = new GetSessionVariable();
+            op.name = name;
+        }
+        return op;
+    }
+
+    static Operation createForShortForm(String expr) {
+        Operation op = null;
+        if (expr.startsWith(REQ_COOKIE_SF)) {
+            op = new GetReqCookieOperation();
+            op.name = expr.substring(REQ_COOKIE_SF.length());
+        } else if (expr.startsWith(REQ_HEADER_SF)) {
+            op = new GetReqHeaderOperation();
+            op.name = expr.substring(REQ_HEADER_SF.length());
+        } else if (expr.startsWith(REQ_FULL_CONTENT_SF)) {
+            if (REQ_FULL_CONTENT_SF.length() == expr.length()) {
+                op = new ExtractReqContentOperation();
+            } else {
+                String subExpr = expr.substring(REQ_FULL_CONTENT_SF.length());
+                if (subExpr.charAt(0) == '|') {
+                    op = new ExtractReqContentOperation(subExpr.substring(1));
+                } else {
+                    throw new IllegalArgumentException("Invalid extractor '" + expr + "'.");
+                }
+            }
+        } else if (expr.startsWith(RESP_COOKIE_SF)) {
+            op = new GetRespCookieOperation();
+            op.name = expr.substring(RESP_COOKIE_SF.length());
+        } else if (expr.startsWith(RESP_HEADER_SF)) {
+            op = new GetRespHeaderOperation();
+            op.name = expr.substring(RESP_HEADER_SF.length());
+        } else if (expr.startsWith(HTTP_SESSION_SF)) {
+            op = new GetSessionVariable();
+            op.name = expr.substring(HTTP_SESSION_SF.length());
+        } else if (expr.startsWith(RESP_FULL_CONTENT_SF)) {
+            if (RESP_FULL_CONTENT_SF.length() == expr.length()) {
+                op = new ExtractRespContentOperation();
+            } else {
+                String subExpr = expr.substring(RESP_FULL_CONTENT_SF.length());
+                if (subExpr.charAt(0) == '|') {
+                    op = new ExtractRespContentOperation(subExpr.substring(1));
+                } else {
+                    throw new IllegalArgumentException("Invalid extractor '" + expr + "'.");
+                }
+            }
+        }
+
+        return op;
+    }
+
+    static String matchAndExtract(Pattern pattern, String fieldName) {
+        Matcher matcher = pattern.matcher(fieldName);
+        if (matcher.find()) {
+            matcher.groupCount();
+            if (matcher.groupCount() >= 1) {
+                int start = matcher.start(1);
+                int end = matcher.end(1);
+                if (start != -1 && end != -1) {
+                    return fieldName.substring(start, end);
+                }
+            }
+        }
+        return null;
+    }
+
+    private final ValueExtractor fallbackExtractor;
+
+    private final Operation operation;
+
+    HttpMessageWrapperStaticExtractor(Operation operation, ValueExtractor fallbackExtractor) {
+        this.operation = operation;
+        this.fallbackExtractor = fallbackExtractor;
+    }
+
+    @Override
+    public Object extract(Object object) {
+        if (object instanceof HttpMessageWrapper) {
+            return operation.extract((HttpMessageWrapper) object);
+        }
+
+        return fallbackExtractor.extract(object);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(fallbackExtractor) ^ Objects.hashCode(operation);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof HttpMessageWrapperStaticExtractor)) {
+            return false;
+        }
+
+        final HttpMessageWrapperStaticExtractor other = (HttpMessageWrapperStaticExtractor) obj;
+        return Objects.equals(fallbackExtractor, other.fallbackExtractor) && Objects.equals(operation, other.operation);
+    }
+
+}
--- a/stress-tester/src/main/java/com/passus/st/filter/Transformers.java	Fri Jan 26 14:50:03 2018 +0100
+++ b/stress-tester/src/main/java/com/passus/st/filter/Transformers.java	Fri Feb 02 12:27:02 2018 +0100
@@ -11,7 +11,7 @@
  */
 public class Transformers {
 
-    public static final ValueExtractorResolver VALUE_EXTRACTOR_RESOLVER = new HttpMessageValueExtractorResolver();
+    public static final ValueExtractorResolver VALUE_EXTRACTOR_RESOLVER = new HttpMessageWrapperExtractorResolver();
 
     public static final PredicateNodeTransformer PREDICATE = new PredicateNodeTransformer(VALUE_EXTRACTOR_RESOLVER);
 
--- a/stress-tester/src/main/java/com/passus/st/vars/VarsValueExtractorResolver.java	Fri Jan 26 14:50:03 2018 +0100
+++ b/stress-tester/src/main/java/com/passus/st/vars/VarsValueExtractorResolver.java	Fri Feb 02 12:27:02 2018 +0100
@@ -11,7 +11,7 @@
  */
 public class VarsValueExtractorResolver implements ValueExtractorResolver {
 
-    private final ValueExtractorResolver extractorFactory = new DefaultValueExtractorResolver();
+    private final ValueExtractorResolver fallbackResolver = new DefaultValueExtractorResolver();
     private final Map<String, ValueExtractor> globalVars;
 
     public VarsValueExtractorResolver(Map<String, ValueExtractor> globalVars) {
@@ -23,7 +23,7 @@
         if (globalVars.containsKey(fieldName)) {
             return globalVars.get(fieldName);
         } else {
-            return extractorFactory.resolveValueExtractor(fieldName);
+            return fallbackResolver.resolveValueExtractor(fieldName);
         }
     }
 
--- a/stress-tester/src/test/java/com/passus/st/filter/HttpMessageHeaderValueExtractorTest.java	Fri Jan 26 14:50:03 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-package com.passus.st.filter;
-
-import com.passus.net.http.HttpRequest;
-import com.passus.net.http.HttpRequestBuilder;
-import com.passus.net.http.HttpResponse;
-import com.passus.net.http.HttpResponseBuilder;
-import com.passus.st.client.http.HttpConsts;
-import com.passus.st.client.http.HttpFlowContext;
-import com.passus.st.client.http.HttpScopes;
-import com.passus.st.client.http.filter.HttpMessageWrapper;
-import static com.passus.st.filter.HttpMessageHeaderValueExtractor.*;
-import static org.testng.AssertJUnit.*;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author mikolaj.podbielski
- */
-public class HttpMessageHeaderValueExtractorTest {
-
-    private final String F_REQ_COOKIE = "req.getCookie('abc')";
-    private final String F_REQ_HEADER = "req.getHeader('def')";
-    private final String F_RESP_COOKIE = "resp.getCookie('ghi')";
-    private final String F_RESP_HEADER = "resp.getHeader('jkl')";
-    private final String F_SESS_VAR = "httpSession.get('mno')";
-
-    private final String S_REQ_COOKIE = "req.cookie@abc";
-    private final String S_REQ_HEADER = "req.header@def";
-    private final String S_REQ_FULL_CONTENT = "req.content";
-    private final String S_REQ_JSON_CONTENT = "req.content|json:$.reqNode";
-    private final String S_REQ_REGEXP_CONTENT = "req.content|regexp:(\\:.+)";
-
-    private final String S_RESP_COOKIE = "resp.cookie@ghi";
-    private final String S_RESP_HEADER = "resp.header@jkl";
-    private final String S_RESP_FULL_CONTENT = "resp.content";
-    private final String S_RESP_JSON_CONTENT = "resp.content|json:$.respNode";
-    private final String S_RESP_REGEXP_CONTENT = "resp.content|regexp:(\\:.+)";
-
-    private final String S_SESS_VAR = "sess@mno";
-
-    private final HttpRequest REQ = HttpRequestBuilder.get("http://www.example.com")
-            .cookie("abc", "1").header("def", "2").tag(HttpConsts.TAG_SESSION_ID, "sid")
-            .content("{reqNode: reqNodeValue}").build();
-
-    private final HttpResponse RESP = HttpResponseBuilder.ok()
-            .cookie("ghi", "3").header("jkl", "4")
-            .content("{respNode: respNodeValue}").build();
-
-    private final HttpFlowContext CONTEXT;
-
-    {
-        HttpScopes scopes = new HttpScopes();
-        scopes.getSession("sid").set("mno", "5");
-        CONTEXT = new HttpFlowContext(null, scopes);
-    }
-
-    private final HttpMessageWrapper WRAPPER = new HttpMessageWrapper(REQ, RESP, CONTEXT);
-    private final HttpMessageWrapper NULL_WRAPPER = new HttpMessageWrapper(null, null, CONTEXT);
-
-    @DataProvider(name = "invalidExtractorRules")
-    public Object[][] invalidExtractorRules() {
-        return new Object[][]{
-            {"req.content@unknownLang:$.reqNode"},
-            {"req.content@json:$....reqNode"},
-            {"req.content@json:"},
-            {"req.content@json"},
-            {"req.content@"},
-            {"req.content@   "},
-            {"req.content#   "}
-        };
-    }
-
-    @Test
-    public void testCreateForShortForm() {
-        assertNotNull(createForShortForm(S_REQ_COOKIE));
-        assertNotNull(createForShortForm(S_REQ_HEADER));
-        assertNotNull(createForShortForm(S_REQ_FULL_CONTENT));
-        assertNotNull(createForShortForm(S_REQ_JSON_CONTENT));
-        assertNotNull(createForShortForm(S_REQ_REGEXP_CONTENT));
-        assertNotNull(createForShortForm(S_RESP_COOKIE));
-        assertNotNull(createForShortForm(S_RESP_HEADER));
-        assertNotNull(createForShortForm(S_RESP_FULL_CONTENT));
-        assertNotNull(createForShortForm(S_RESP_JSON_CONTENT));
-        assertNotNull(createForShortForm(S_RESP_REGEXP_CONTENT));
-        assertNotNull(createForShortForm(S_SESS_VAR));
-        assertNull(createForShortForm("req.getVersion()"));
-    }
-
-    @Test
-    public void testExtractByShortForm() {
-        assertEquals("1", createForShortForm(S_REQ_COOKIE).extract(WRAPPER).toString());
-        assertEquals("2", createForShortForm(S_REQ_HEADER).extract(WRAPPER).toString());
-        assertEquals("{reqNode: reqNodeValue}", createForShortForm(S_REQ_FULL_CONTENT).extract(WRAPPER).toString());
-        assertEquals("reqNodeValue", createForShortForm(S_REQ_JSON_CONTENT).extract(WRAPPER).toString());
-        assertEquals(": reqNodeValue}", createForShortForm(S_REQ_REGEXP_CONTENT).extract(WRAPPER).toString());
-        assertEquals("3", createForShortForm(S_RESP_COOKIE).extract(WRAPPER).toString());
-        assertEquals("4", createForShortForm(S_RESP_HEADER).extract(WRAPPER).toString());
-        assertEquals("5", createForShortForm(S_SESS_VAR).extract(WRAPPER).toString());
-        assertEquals("{respNode: respNodeValue}", createForShortForm(S_RESP_FULL_CONTENT).extract(WRAPPER).toString());
-        assertEquals("respNodeValue", createForShortForm(S_RESP_JSON_CONTENT).extract(WRAPPER).toString());
-    }
-
-    @Test
-    public void testExtractByShortForm_NullWrapper() {
-        assertEquals(null, createForShortForm(S_REQ_COOKIE).extract(NULL_WRAPPER));
-        assertEquals(null, createForShortForm(S_REQ_HEADER).extract(NULL_WRAPPER));
-        assertEquals(null, createForShortForm(S_REQ_FULL_CONTENT).extract(NULL_WRAPPER));
-        assertEquals(null, createForShortForm(S_REQ_JSON_CONTENT).extract(NULL_WRAPPER));
-        assertEquals(null, createForShortForm(S_REQ_REGEXP_CONTENT).extract(NULL_WRAPPER));
-        assertEquals(null, createForShortForm(S_RESP_COOKIE).extract(NULL_WRAPPER));
-        assertEquals(null, createForShortForm(S_RESP_HEADER).extract(NULL_WRAPPER));
-        assertEquals(null, createForShortForm(S_SESS_VAR).extract(NULL_WRAPPER));
-        assertEquals(null, createForShortForm(S_RESP_FULL_CONTENT).extract(NULL_WRAPPER));
-        assertEquals(null, createForShortForm(S_RESP_JSON_CONTENT).extract(NULL_WRAPPER));
-    }
-
-    @Test
-    public void testCreateForFunction() {
-        assertEquals("abc", matchAndExtract(REQ_COOKIE_FUN, F_REQ_COOKIE));
-        assertNotNull(createForFunction(F_REQ_COOKIE));
-
-        assertEquals("def", matchAndExtract(REQ_HEADER_FUN, F_REQ_HEADER));
-        assertNotNull(createForFunction(F_REQ_HEADER));
-
-        assertEquals("ghi", matchAndExtract(RESP_COOKIE_FUN, F_RESP_COOKIE));
-        assertNotNull(createForFunction(F_RESP_COOKIE));
-
-        assertEquals("jkl", matchAndExtract(RESP_HEADER_FUN, F_RESP_HEADER));
-        assertNotNull(createForFunction(F_RESP_HEADER));
-
-        assertEquals("mno", matchAndExtract(HTTP_SESS_FUN, F_SESS_VAR));
-        assertNotNull(createForFunction(F_SESS_VAR));
-
-        assertNull(createForFunction("req.getVersion()"));
-    }
-
-    @Test
-    public void testExtractByFunction() {
-        assertEquals("1", createForFunction(F_REQ_COOKIE).extract(WRAPPER).toString());
-        assertEquals("2", createForFunction(F_REQ_HEADER).extract(WRAPPER).toString());
-        assertEquals("3", createForFunction(F_RESP_COOKIE).extract(WRAPPER).toString());
-        assertEquals("4", createForFunction(F_RESP_HEADER).extract(WRAPPER).toString());
-        assertEquals("5", createForFunction(F_SESS_VAR).extract(WRAPPER).toString());
-    }
-
-    @Test(dataProvider = "invalidExtractorRules")
-    public void testInvalidExtractRules(String rule) {
-        try {
-            createForShortForm(rule);
-            fail("Exception required for rule '" + rule + "'.");
-        } catch (Exception e) {
-        }
-    }
-}
--- a/stress-tester/src/test/java/com/passus/st/filter/HttpMessageValueExtractorTest.java	Fri Jan 26 14:50:03 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-package com.passus.st.filter;
-
-import com.passus.filter.BeanValueExtractor;
-import com.passus.net.http.HttpRequest;
-import com.passus.net.http.HttpRequestBuilder;
-import com.passus.net.http.HttpResponse;
-import com.passus.net.http.HttpResponseBuilder;
-import com.passus.net.http.HttpStatus;
-import static com.passus.st.client.http.HttpConsts.TAG_SESSION_ID;
-import com.passus.st.client.http.filter.HttpMessageWrapper;
-import static com.passus.st.utils.Assert.*;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author mikolaj.podbielski
- */
-public class HttpMessageValueExtractorTest {
-
-    private final HttpRequest REQ;
-
-    private final HttpResponse RESP;
-
-    private final HttpMessageWrapper WRAPPER;
-
-    public HttpMessageValueExtractorTest() {
-        REQ = HttpRequestBuilder.get("http://www.example.com/1")
-                .tag(TAG_SESSION_ID, "sid1").build();
-
-        RESP = HttpResponseBuilder.ok().build();
-        WRAPPER = new HttpMessageWrapper(REQ, RESP, null);
-    }
-
-    private Object extract(String expr) {
-        return extract(expr, WRAPPER);
-    }
-
-    private Object extract(String expr, Object context) {
-        BeanValueExtractor fallbackExtractor = new BeanValueExtractor(expr);
-        return new HttpMessageValueExtractor(expr, fallbackExtractor).extract(context);
-    }
-
-    @Test
-    public void testExtract_HttpMessageWrapper() {
-        assertEquals("HTTP/1.1", extract("req.version").toString());
-        assertEquals("HTTP/1.1", extract("req.getVersion()").toString());
-        assertEquals("GET", extract("req.method").toString());
-        assertEquals("GET", extract("req.getMethod()").toString());
-        assertEquals("sid1", extract("req.sessionId"));
-        assertEquals("sid1", extract("req.getSessionId()"));
-        assertEquals("http://www.example.com/1", extract("req.url").toString());
-        assertEquals("http://www.example.com/1", extract("req.getUrl()").toString());
-        assertEquals("/1", extract("req.uri").toString());
-        assertEquals("/1", extract("req.getUri()").toString());
-        assertEquals("HTTP/1.1", extract("resp.version").toString());
-        assertEquals("HTTP/1.1", extract("resp.getVersion()").toString());
-        assertEquals(HttpStatus.OK, extract("resp.status"));
-        assertEquals(HttpStatus.OK, extract("resp.getStatus()"));
-        assertEquals(200, extract("resp.status.code"));
-        assertEquals(200, extract("resp.getStatus().getCode()"));
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stress-tester/src/test/java/com/passus/st/filter/HttpMessageWrapperDynamicExtractorTest.java	Fri Feb 02 12:27:02 2018 +0100
@@ -0,0 +1,63 @@
+package com.passus.st.filter;
+
+import com.passus.filter.BeanValueExtractor;
+import com.passus.net.http.HttpRequest;
+import com.passus.net.http.HttpRequestBuilder;
+import com.passus.net.http.HttpResponse;
+import com.passus.net.http.HttpResponseBuilder;
+import com.passus.net.http.HttpStatus;
+import static com.passus.st.client.http.HttpConsts.TAG_SESSION_ID;
+import com.passus.st.client.http.filter.HttpMessageWrapper;
+import static com.passus.st.utils.Assert.*;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author mikolaj.podbielski
+ */
+public class HttpMessageWrapperDynamicExtractorTest {
+
+    private final HttpRequest REQ;
+
+    private final HttpResponse RESP;
+
+    private final HttpMessageWrapper WRAPPER;
+
+    public HttpMessageWrapperDynamicExtractorTest() {
+        REQ = HttpRequestBuilder.get("http://www.example.com/1")
+                .tag(TAG_SESSION_ID, "sid1").build();
+
+        RESP = HttpResponseBuilder.ok().build();
+        WRAPPER = new HttpMessageWrapper(REQ, RESP, null);
+    }
+
+    private Object extract(String expr) {
+        return extract(expr, WRAPPER);
+    }
+
+    private Object extract(String expr, Object context) {
+        BeanValueExtractor fallbackExtractor = new BeanValueExtractor(expr);
+        return new HttpMessageWrapperDynamicExtractor(expr, fallbackExtractor).extract(context);
+    }
+
+    @Test
+    public void testExtract_HttpMessageWrapper() {
+        assertEquals("HTTP/1.1", extract("req.version").toString());
+        assertEquals("HTTP/1.1", extract("req.getVersion()").toString());
+        assertEquals("GET", extract("req.method").toString());
+        assertEquals("GET", extract("req.getMethod()").toString());
+        assertEquals("sid1", extract("req.sessionId"));
+        assertEquals("sid1", extract("req.getSessionId()"));
+        assertEquals("http://www.example.com/1", extract("req.url").toString());
+        assertEquals("http://www.example.com/1", extract("req.getUrl()").toString());
+        assertEquals("/1", extract("req.uri").toString());
+        assertEquals("/1", extract("req.getUri()").toString());
+        assertEquals("HTTP/1.1", extract("resp.version").toString());
+        assertEquals("HTTP/1.1", extract("resp.getVersion()").toString());
+        assertEquals(HttpStatus.OK, extract("resp.status"));
+        assertEquals(HttpStatus.OK, extract("resp.getStatus()"));
+        assertEquals(200, extract("resp.status.code"));
+        assertEquals(200, extract("resp.getStatus().getCode()"));
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/stress-tester/src/test/java/com/passus/st/filter/HttpMessageWrapperStaticExtractorTest.java	Fri Feb 02 12:27:02 2018 +0100
@@ -0,0 +1,155 @@
+package com.passus.st.filter;
+
+import com.passus.net.http.HttpRequest;
+import com.passus.net.http.HttpRequestBuilder;
+import com.passus.net.http.HttpResponse;
+import com.passus.net.http.HttpResponseBuilder;
+import com.passus.st.client.http.HttpConsts;
+import com.passus.st.client.http.HttpFlowContext;
+import com.passus.st.client.http.HttpScopes;
+import com.passus.st.client.http.filter.HttpMessageWrapper;
+import static com.passus.st.filter.HttpMessageWrapperStaticExtractor.*;
+import static org.testng.AssertJUnit.*;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author mikolaj.podbielski
+ */
+public class HttpMessageWrapperStaticExtractorTest {
+
+    private final String F_REQ_COOKIE = "req.getCookie('abc')";
+    private final String F_REQ_HEADER = "req.getHeader('def')";
+    private final String F_RESP_COOKIE = "resp.getCookie('ghi')";
+    private final String F_RESP_HEADER = "resp.getHeader('jkl')";
+    private final String F_SESS_VAR = "httpSession.get('mno')";
+
+    private final String S_REQ_COOKIE = "req.cookie@abc";
+    private final String S_REQ_HEADER = "req.header@def";
+    private final String S_REQ_FULL_CONTENT = "req.content";
+    private final String S_REQ_JSON_CONTENT = "req.content|json:$.reqNode";
+    private final String S_REQ_REGEXP_CONTENT = "req.content|regexp:(\\:.+)";
+
+    private final String S_RESP_COOKIE = "resp.cookie@ghi";
+    private final String S_RESP_HEADER = "resp.header@jkl";
+    private final String S_RESP_FULL_CONTENT = "resp.content";
+    private final String S_RESP_JSON_CONTENT = "resp.content|json:$.respNode";
+    private final String S_RESP_REGEXP_CONTENT = "resp.content|regexp:(\\:.+)";
+
+    private final String S_SESS_VAR = "sess@mno";
+
+    private final HttpRequest REQ = HttpRequestBuilder.get("http://www.example.com")
+            .cookie("abc", "1").header("def", "2").tag(HttpConsts.TAG_SESSION_ID, "sid")
+            .content("{reqNode: reqNodeValue}").build();
+
+    private final HttpResponse RESP = HttpResponseBuilder.ok()
+            .cookie("ghi", "3").header("jkl", "4")
+            .content("{respNode: respNodeValue}").build();
+
+    private final HttpFlowContext CONTEXT;
+
+    {
+        HttpScopes scopes = new HttpScopes();
+        scopes.getSession("sid").set("mno", "5");
+        CONTEXT = new HttpFlowContext(null, scopes);
+    }
+
+    private final HttpMessageWrapper WRAPPER = new HttpMessageWrapper(REQ, RESP, CONTEXT);
+    private final HttpMessageWrapper NULL_WRAPPER = new HttpMessageWrapper(null, null, CONTEXT);
+
+    @DataProvider(name = "invalidExtractorRules")
+    public Object[][] invalidExtractorRules() {
+        return new Object[][]{
+            {"req.content@unknownLang:$.reqNode"},
+            {"req.content@json:$....reqNode"},
+            {"req.content@json:"},
+            {"req.content@json"},
+            {"req.content@"},
+            {"req.content@   "},
+            {"req.content#   "}
+        };
+    }
+
+    @Test
+    public void testCreateForShortForm() {
+        assertNotNull(createForShortForm(S_REQ_COOKIE));
+        assertNotNull(createForShortForm(S_REQ_HEADER));
+        assertNotNull(createForShortForm(S_REQ_FULL_CONTENT));
+        assertNotNull(createForShortForm(S_REQ_JSON_CONTENT));
+        assertNotNull(createForShortForm(S_REQ_REGEXP_CONTENT));
+        assertNotNull(createForShortForm(S_RESP_COOKIE));
+        assertNotNull(createForShortForm(S_RESP_HEADER));
+        assertNotNull(createForShortForm(S_RESP_FULL_CONTENT));
+        assertNotNull(createForShortForm(S_RESP_JSON_CONTENT));
+        assertNotNull(createForShortForm(S_RESP_REGEXP_CONTENT));
+        assertNotNull(createForShortForm(S_SESS_VAR));
+        assertNull(createForShortForm("req.getVersion()"));
+    }
+
+    @Test
+    public void testExtractByShortForm() {
+        assertEquals("1", createForShortForm(S_REQ_COOKIE).extract(WRAPPER).toString());
+        assertEquals("2", createForShortForm(S_REQ_HEADER).extract(WRAPPER).toString());
+        assertEquals("{reqNode: reqNodeValue}", createForShortForm(S_REQ_FULL_CONTENT).extract(WRAPPER).toString());
+        assertEquals("reqNodeValue", createForShortForm(S_REQ_JSON_CONTENT).extract(WRAPPER).toString());
+        assertEquals(": reqNodeValue}", createForShortForm(S_REQ_REGEXP_CONTENT).extract(WRAPPER).toString());
+        assertEquals("3", createForShortForm(S_RESP_COOKIE).extract(WRAPPER).toString());
+        assertEquals("4", createForShortForm(S_RESP_HEADER).extract(WRAPPER).toString());
+        assertEquals("5", createForShortForm(S_SESS_VAR).extract(WRAPPER).toString());
+        assertEquals("{respNode: respNodeValue}", createForShortForm(S_RESP_FULL_CONTENT).extract(WRAPPER).toString());
+        assertEquals("respNodeValue", createForShortForm(S_RESP_JSON_CONTENT).extract(WRAPPER).toString());
+    }
+
+    @Test
+    public void testExtractByShortForm_NullWrapper() {
+        assertEquals(null, createForShortForm(S_REQ_COOKIE).extract(NULL_WRAPPER));
+        assertEquals(null, createForShortForm(S_REQ_HEADER).extract(NULL_WRAPPER));
+        assertEquals(null, createForShortForm(S_REQ_FULL_CONTENT).extract(NULL_WRAPPER));
+        assertEquals(null, createForShortForm(S_REQ_JSON_CONTENT).extract(NULL_WRAPPER));
+        assertEquals(null, createForShortForm(S_REQ_REGEXP_CONTENT).extract(NULL_WRAPPER));
+        assertEquals(null, createForShortForm(S_RESP_COOKIE).extract(NULL_WRAPPER));
+        assertEquals(null, createForShortForm(S_RESP_HEADER).extract(NULL_WRAPPER));
+        assertEquals(null, createForShortForm(S_SESS_VAR).extract(NULL_WRAPPER));
+        assertEquals(null, createForShortForm(S_RESP_FULL_CONTENT).extract(NULL_WRAPPER));
+        assertEquals(null, createForShortForm(S_RESP_JSON_CONTENT).extract(NULL_WRAPPER));
+    }
+
+    @Test
+    public void testCreateForFunction() {
+        assertEquals("abc", matchAndExtract(REQ_COOKIE_FUN, F_REQ_COOKIE));
+        assertNotNull(createForFunction(F_REQ_COOKIE));
+
+        assertEquals("def", matchAndExtract(REQ_HEADER_FUN, F_REQ_HEADER));
+        assertNotNull(createForFunction(F_REQ_HEADER));
+
+        assertEquals("ghi", matchAndExtract(RESP_COOKIE_FUN, F_RESP_COOKIE));
+        assertNotNull(createForFunction(F_RESP_COOKIE));
+
+        assertEquals("jkl", matchAndExtract(RESP_HEADER_FUN, F_RESP_HEADER));
+        assertNotNull(createForFunction(F_RESP_HEADER));
+
+        assertEquals("mno", matchAndExtract(HTTP_SESS_FUN, F_SESS_VAR));
+        assertNotNull(createForFunction(F_SESS_VAR));
+
+        assertNull(createForFunction("req.getVersion()"));
+    }
+
+    @Test
+    public void testExtractByFunction() {
+        assertEquals("1", createForFunction(F_REQ_COOKIE).extract(WRAPPER).toString());
+        assertEquals("2", createForFunction(F_REQ_HEADER).extract(WRAPPER).toString());
+        assertEquals("3", createForFunction(F_RESP_COOKIE).extract(WRAPPER).toString());
+        assertEquals("4", createForFunction(F_RESP_HEADER).extract(WRAPPER).toString());
+        assertEquals("5", createForFunction(F_SESS_VAR).extract(WRAPPER).toString());
+    }
+
+    @Test(dataProvider = "invalidExtractorRules")
+    public void testInvalidExtractRules(String rule) {
+        try {
+            createForShortForm(rule);
+            fail("Exception required for rule '" + rule + "'.");
+        } catch (Exception e) {
+        }
+    }
+}