Mercurial > stress-tester
changeset 872:f67a557c1afb
globalVars -> appVars
author | Devel 1 |
---|---|
date | Fri, 26 Jan 2018 11:36:38 +0100 |
parents | 56e55f320734 |
children | c2bbb7c5b635 |
files | stress-tester/src/main/java/com/passus/st/utils/ConfigurationContextConsts.java stress-tester/src/main/java/com/passus/st/vars/VarsGlobalDomainConfigurator.java stress-tester/src/test/java/com/passus/st/config/TestJobConfiguratorTest.java stress-tester/src/test/resources/com/passus/st/config/test_job_config.yml |
diffstat | 4 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/utils/ConfigurationContextConsts.java Thu Jan 25 15:36:53 2018 +0100 +++ b/stress-tester/src/main/java/com/passus/st/utils/ConfigurationContextConsts.java Fri Jan 26 11:36:38 2018 +0100 @@ -44,6 +44,8 @@ public static final String LOOKUPS = "lookups"; + public static final String APP_VARS = "appVars"; + private ConfigurationContextConsts() { }
--- a/stress-tester/src/main/java/com/passus/st/vars/VarsGlobalDomainConfigurator.java Thu Jan 25 15:36:53 2018 +0100 +++ b/stress-tester/src/main/java/com/passus/st/vars/VarsGlobalDomainConfigurator.java Fri Jan 26 11:36:38 2018 +0100 @@ -7,12 +7,13 @@ import com.passus.config.validation.Errors; import com.passus.filter.ValueExtractor; import com.passus.st.plugin.PluginConstants; +import com.passus.st.utils.ConfigurationContextConsts; import java.util.Map; @Plugin(name = VarsGlobalDomainConfigurator.DOMAIN, category = PluginConstants.CATEGORY_DOMAIN_CONFIGURATOR) public class VarsGlobalDomainConfigurator implements DomainConfigurator { - public static final String DOMAIN = "globalVars"; + public static final String DOMAIN = ConfigurationContextConsts.APP_VARS; @Override public String getDomain() { @@ -27,6 +28,6 @@ @Override public void configure(Configuration config, Errors errors, ConfigurationContext context) { Map<String, ValueExtractor> vars = VarsConfigurator.getGlobalVars(config.getRootNode(), errors); - context.add(DOMAIN, vars); + context.add(ConfigurationContextConsts.APP_VARS, vars); } }
--- a/stress-tester/src/test/java/com/passus/st/config/TestJobConfiguratorTest.java Thu Jan 25 15:36:53 2018 +0100 +++ b/stress-tester/src/test/java/com/passus/st/config/TestJobConfiguratorTest.java Fri Jan 26 11:36:38 2018 +0100 @@ -14,7 +14,6 @@ import com.passus.st.source.NcEventSource; import com.passus.st.source.PcapSessionEventSource; import com.passus.st.utils.ConfigurationContextConsts; -import com.passus.st.vars.VarsGlobalDomainConfigurator; import org.testng.annotations.Test; import java.io.File; @@ -35,6 +34,7 @@ TestJobConfigurator configurator = new TestJobConfigurator(); ConfigurationContext context = new ConfigurationContextImpl(); configurator.configure(config, errors, context); + errors.getAllErrors().forEach(System.out::println); assertFalse(errors.hasError()); List<Client> clients = (List<Client>) context.get(ConfigurationContextConsts.CLIENT_CLIENTS); @@ -46,7 +46,7 @@ assertTrue(sources.get(0) instanceof PcapSessionEventSource); assertTrue(sources.get(1) instanceof NcEventSource); - Map<String, ValueExtractor> vars = (Map<String, ValueExtractor>) context.get(VarsGlobalDomainConfigurator.DOMAIN); + Map<String, ValueExtractor> vars = (Map<String, ValueExtractor>) context.get(ConfigurationContextConsts.APP_VARS); assertEquals(1, vars.size()); UnmutableValueExtractor value = (UnmutableValueExtractor) vars.get("varName"); assertEquals("varValue", value.getValue());
--- a/stress-tester/src/test/resources/com/passus/st/config/test_job_config.yml Thu Jan 25 15:36:53 2018 +0100 +++ b/stress-tester/src/test/resources/com/passus/st/config/test_job_config.yml Fri Jan 26 11:36:38 2018 +0100 @@ -44,5 +44,5 @@ - type: csvFile fileName: c:\csv -globalVars: +appVars: varName: varValue