Mercurial > stress-tester
changeset 820:3b8b53f6ec89
ClientConfigurator bugfix
author | Devel 2 |
---|---|
date | Thu, 18 Jan 2018 10:22:53 +0100 |
parents | 53537abab89b |
children | efc9f09afa8d |
files | stress-tester/src/main/java/com/passus/st/config/ClientConfigurator.java stress-tester/src/test/java/com/passus/st/config/ClientConfiguratorTest.java |
diffstat | 2 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/config/ClientConfigurator.java Thu Jan 18 10:07:11 2018 +0100 +++ b/stress-tester/src/main/java/com/passus/st/config/ClientConfigurator.java Thu Jan 18 10:22:53 2018 +0100 @@ -66,7 +66,7 @@ } CListNode listNode = (CListNode) nodeDef.transform(rootNode, errors, context); - if (listNode != null) { + if (listNode != null && !errors.hasError()) { try { List clients = ConfigurationUtils.convertToList(listNode, Type.OBJECT); context.add("clients", clients);
--- a/stress-tester/src/test/java/com/passus/st/config/ClientConfiguratorTest.java Thu Jan 18 10:07:11 2018 +0100 +++ b/stress-tester/src/test/java/com/passus/st/config/ClientConfiguratorTest.java Thu Jan 18 10:22:53 2018 +0100 @@ -21,6 +21,22 @@ public class ClientConfiguratorTest { @Test + public void testConfigure_InvalidFilter() throws Exception { + String configStr = "client:\n" + + " - type: http\n" + + " filters:\n" + + " - type: unknownFilter\n"; + + Configuration config = YamlConfigurationReader.readFromString(configStr); + ClientConfigurator configurator = new ClientConfigurator(); + + Errors errors = new Errors(); + ConfigurationContext context = new ConfigurationContextImpl(); + configurator.configure(config.subConfiguration("client"), errors, context); + assertTrue(errors.hasError()); + } + + @Test public void testConfigure() throws Exception { String configStr = "client:\n" + " - type: http\n" @@ -46,6 +62,7 @@ Errors errors = new Errors(); ConfigurationContext context = new ConfigurationContextImpl(); configurator.configure(config.subConfiguration("client"), errors, context); + assertFalse(errors.hasError()); List<Client> clients = (List<Client>) context.get("clients");