Mercurial > stress-tester
changeset 654:de5d297a3822
MultiCredentialsProviderTrsnformer improvements + tests bugfixes
author | Devel 2 |
---|---|
date | Thu, 09 Nov 2017 14:37:01 +0100 |
parents | 193d54da0880 |
children | b8426b876edf |
files | stress-tester/src/main/java/com/passus/st/client/credentials/MultiCredentialsProviderTransformer.java stress-tester/src/test/java/com/passus/st/client/credentials/MultiCredentialsProviderTransformerTest.java stress-tester/src/test/java/com/passus/st/client/http/filter/HttpBasicAuthLoginFilterTest.java stress-tester/src/test/java/com/passus/st/client/http/filter/HttpFiltersConfiguratorTest.java stress-tester/src/test/java/com/passus/st/client/http/filter/HttpFiltersNodeDefinitionCreatorTest.java |
diffstat | 5 files changed, 14 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/credentials/MultiCredentialsProviderTransformer.java Thu Nov 09 13:29:03 2017 +0100 +++ b/stress-tester/src/main/java/com/passus/st/client/credentials/MultiCredentialsProviderTransformer.java Thu Nov 09 14:37:01 2017 +0100 @@ -8,6 +8,8 @@ import com.passus.config.ConfigurationContext; import com.passus.config.ConfigurationImpl; import com.passus.config.NodeType; +import com.passus.config.schema.ConfigurationSchemaUtils; +import static com.passus.config.schema.ConfigurationSchemaUtils.getDefinitionCreatorFactory; import com.passus.config.schema.NodeDefinition; import com.passus.config.schema.NodeDefinitionCreator; import com.passus.config.schema.NodeTransformer; @@ -41,8 +43,7 @@ CredentialsProvider provider = factory.getInstanceByName(providerName); try { errors.pushNestedPath(providerName); - NodeDefinitionCreator nodeDefCreator = NodeDefinitionCreator.getByObject(provider); - NodeDefinition nodeDef = nodeDefCreator.create(); + NodeDefinition nodeDef = getDefinitionCreatorFactory(context).getNodeDefinition(provider); nodeDef.validate(configNode, errors, context); if (errors.hasError()) { break;
--- a/stress-tester/src/test/java/com/passus/st/client/credentials/MultiCredentialsProviderTransformerTest.java Thu Nov 09 13:29:03 2017 +0100 +++ b/stress-tester/src/test/java/com/passus/st/client/credentials/MultiCredentialsProviderTransformerTest.java Thu Nov 09 14:37:01 2017 +0100 @@ -7,8 +7,11 @@ import com.passus.config.CTupleNode; import com.passus.config.CValueNode; import com.passus.config.Configuration; +import com.passus.config.ConfigurationContext; import com.passus.config.NodeException; import com.passus.config.YamlConfigurationReader; +import com.passus.config.schema.NodeDefinitionCreatorFactory; +import com.passus.config.schema.NodeDefinitionCreatorFactoryImpl; import com.passus.st.client.credentials.CsvUsernamePasswordCredentialsProvider.ReadMode; import java.io.File; import java.io.IOException; @@ -91,13 +94,14 @@ } private static MultiCredentialsProvider readAndTransform(String content) throws IOException, NodeException, ConversionException { + ConfigurationContext context = ConfigurationContext.create(); Configuration cfg = YamlConfigurationReader.readFromString(content); CCompositeNode rootNode = cfg.getRootNode(); CTupleNode providerNode = (CTupleNode) rootNode.getFirstChild(); CNode node = providerNode.getNode(); MultiCredentialsProviderTransformer transformer = new MultiCredentialsProviderTransformer(); - CValueNode valueNode = transformer.transform(node, null); + CValueNode valueNode = transformer.transform(node, context); return (MultiCredentialsProvider) valueNode.getValue(); }
--- a/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpBasicAuthLoginFilterTest.java Thu Nov 09 13:29:03 2017 +0100 +++ b/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpBasicAuthLoginFilterTest.java Thu Nov 09 14:37:01 2017 +0100 @@ -1,6 +1,7 @@ package com.passus.st.client.http.filter; import com.passus.commons.utils.ResourceUtils; +import com.passus.config.ConfigurationContext; import com.passus.config.ConfigurationImpl; import com.passus.config.validation.Errors; import com.passus.net.http.HttpHeaders; @@ -135,7 +136,7 @@ filterConfig = String.format(filterConfig, file.getAbsolutePath()); Errors errors = new Errors(); - List<HttpFilter> filters = HttpFiltersConfigurator.getFilters(filterConfig, errors, null); + List<HttpFilter> filters = HttpFiltersConfigurator.getFilters(filterConfig, errors, ConfigurationContext.create()); HttpFilterTestUtils.printErrors(errors); assertEquals(errors.getErrorCount(), 0);
--- a/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpFiltersConfiguratorTest.java Thu Nov 09 13:29:03 2017 +0100 +++ b/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpFiltersConfiguratorTest.java Thu Nov 09 14:37:01 2017 +0100 @@ -2,6 +2,7 @@ import com.passus.commons.utils.ResourceUtils; import com.passus.config.Configuration; +import com.passus.config.ConfigurationContext; import com.passus.config.YamlConfigurationReader; import com.passus.config.validation.Errors; import com.passus.st.client.credentials.MultiCredentialsProvider; @@ -30,7 +31,7 @@ HttpFiltersConfigurator configurator = new HttpFiltersConfigurator(client); Errors errors = new Errors(); - configurator.configure(config, errors, null); + configurator.configure(config, errors, ConfigurationContext.create()); assertEquals(0, errors.getErrorCount()); verify(client, times(3)).addFilter(captor.capture());
--- a/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpFiltersNodeDefinitionCreatorTest.java Thu Nov 09 13:29:03 2017 +0100 +++ b/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpFiltersNodeDefinitionCreatorTest.java Thu Nov 09 14:37:01 2017 +0100 @@ -6,6 +6,7 @@ import com.passus.config.CNode; import com.passus.config.CTupleNode; import com.passus.config.Configuration; +import com.passus.config.ConfigurationContext; import com.passus.config.YamlConfigurationReader; import com.passus.config.schema.KeyValueVaryListNodeDefinition; import com.passus.config.schema.NodeDefinition; @@ -46,7 +47,7 @@ Errors errors = new Errors(); CNode filtersNode = ((CTupleNode) config.getRootNode().getFirstChild()).getNode(); - CListNode listNode = (CListNode) def.transform(filtersNode, errors, null); + CListNode listNode = (CListNode) def.transform(filtersNode, errors, ConfigurationContext.create()); errors.getAllErrors().forEach(System.out::println); assertEquals(0, errors.getErrorCount());