Mercurial > stress-tester
changeset 791:91e24dd0e837
HttpMessageModificationFilterTest - XML content replacer
author | Devel 1 |
---|---|
date | Wed, 20 Dec 2017 16:39:41 +0100 |
parents | bd1d28b5a096 |
children | b3a0d3083d5e |
files | stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMessageModificationFilter.java stress-tester/src/main/java/com/passus/st/filter/HttpMessageHeaderValueExtractor.java stress-tester/src/test/java/com/passus/st/client/http/filter/HttpMessageModificationFilterTest.java |
diffstat | 3 files changed, 4 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMessageModificationFilter.java Wed Dec 20 14:44:30 2017 +0100 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMessageModificationFilter.java Wed Dec 20 16:39:41 2017 +0100 @@ -10,19 +10,16 @@ import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; import static com.passus.config.schema.ConfigurationSchemaBuilder.valueDef; import com.passus.config.schema.KeyNameVaryListNodeDefinition; -import com.passus.config.schema.MapNodeDefinition; import com.passus.config.schema.NodeDefinition; import com.passus.config.schema.NodeDefinitionCreator; import com.passus.data.ByteString; import com.passus.filter.UnmutableValueExtractor; import com.passus.filter.ValueExtractor; -import com.passus.net.http.HttpMessage; import com.passus.net.http.HttpMessageHelper; import com.passus.net.http.HttpParameters; import com.passus.net.http.HttpRequest; import com.passus.net.http.HttpResponse; import com.passus.st.client.http.HttpFlowContext; -import com.passus.st.client.http.extractor.ContentExtractor; import com.passus.st.client.http.extractor.ContentExtractorUtils; import com.passus.st.client.http.extractor.ContentReplacer; import com.passus.st.config.HeaderOperationNodeDefinition;
--- a/stress-tester/src/main/java/com/passus/st/filter/HttpMessageHeaderValueExtractor.java Wed Dec 20 14:44:30 2017 +0100 +++ b/stress-tester/src/main/java/com/passus/st/filter/HttpMessageHeaderValueExtractor.java Wed Dec 20 16:39:41 2017 +0100 @@ -1,6 +1,5 @@ package com.passus.st.filter; -import com.passus.commons.Assert; import com.passus.data.ByteString; import com.passus.filter.ValueExtractor; import com.passus.net.http.HttpMessage; @@ -8,10 +7,6 @@ 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.extractor.JsonValueExtractor; -import com.passus.st.client.http.extractor.PostValueExtractor; -import com.passus.st.client.http.extractor.RegexValueExtractor; -import com.passus.st.client.http.extractor.XmlValueExtractor; import com.passus.st.client.http.filter.HttpMessageWrapper; import java.util.Objects; import java.util.regex.Matcher;
--- a/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpMessageModificationFilterTest.java Wed Dec 20 14:44:30 2017 +0100 +++ b/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpMessageModificationFilterTest.java Wed Dec 20 16:39:41 2017 +0100 @@ -38,7 +38,7 @@ public class HttpMessageModificationFilterTest { private final HttpMessageHelper helper = HttpMessageHelper.get(); - + @BeforeClass public static void beforeClass() { AppUtils.registerAll(); @@ -51,10 +51,12 @@ @DataProvider(name = "contents") public Object[][] contents() { + final String xmlVersion = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"; return new Object[][]{ {"param1=value1¶m2=value2", "post:param2", "value2new", "param1=value1¶m2=value2new", MimeTypes.APPLICATION_FORM_URLENCODED}, {"abc 123 def", "regexp:(\\d+)", "digits", "abc digits def", MimeTypes.TEXT_PLAIN}, - {"{node:\"value\"}", "json:$.node", "newValue", "{\"node\":\"newValue\"}", MimeTypes.APPLICATION_JSON} + {"{node:\"value\"}", "json:$.node", "newValue", "{\"node\":\"newValue\"}", MimeTypes.APPLICATION_JSON}, + {"<root><n1>old</n1></root>", "xml:/root/n1", "new", xmlVersion + "<root><n1>new</n1></root>", MimeTypes.APPLICATION_XML} }; }