changeset 898:c603bf293bd7

minor
author Devel 1
date Tue, 10 Apr 2018 13:47:02 +0200
parents a50820afce53
children dc4a6b3fe009
files stress-tester/src/main/java/com/passus/st/CliHelper.java stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFiltersConfigurator.java stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFiltersNodeDefinitionCreator.java stress-tester/src/main/java/com/passus/st/lookup/LookupsDomainConfigurator.java stress-tester/src/main/java/com/passus/st/lookup/LookupsNodeDefinitionCreator.java stress-tester/src/test/java/com/passus/st/client/http/filter/HttpFiltersNodeDefinitionCreatorTest.java stress-tester/src/test/java/com/passus/st/lookup/LookupsDomainConfiguratorTest.java
diffstat 7 files changed, 8 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/CliHelper.java	Mon Apr 09 14:28:42 2018 +0200
+++ b/stress-tester/src/main/java/com/passus/st/CliHelper.java	Tue Apr 10 13:47:02 2018 +0200
@@ -161,10 +161,9 @@
     public List<HttpFilter> readHttpFilters(CommandLine cl) throws Exception {
         if (cl.hasOption("ff")) {
             File file = new File(cl.getOptionValue("ff"));
-            Configuration cfg = YamlConfigurationReader.readFromFile(file);
             Errors errors = new Errors();
             ConfigurationContext context = new ConfigurationContextImpl();
-            List<HttpFilter> filters = HttpFiltersConfigurator.getFilters(cfg, errors, context);
+            List<HttpFilter> filters = HttpFiltersConfigurator.getFilters(file, errors, context);
             if (errors.getErrorCount() != 0) {
                 printError("Error in file '" + file.getAbsolutePath() + "'.", false);
                 for (ObjectError error : errors.getAllErrors()) {
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFiltersConfigurator.java	Mon Apr 09 14:28:42 2018 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFiltersConfigurator.java	Tue Apr 10 13:47:02 2018 +0200
@@ -79,7 +79,7 @@
         nodeDef.transform(rootNode, errors, context);
         if (!errors.hasError()) {
             try {
-                List<HttpFilter> filters = ConfigurationUtils.convertToList(config.getRootNode(), HttpFilter.class);
+                List<HttpFilter> filters = ConfigurationUtils.convertToList(rootNode, HttpFilter.class);
                 context.add(ConfigurationContextConsts.HTTP_FILTERS, filters);
             } catch (Exception e) {
                 throw new RuntimeException(e.getMessage(), e);
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFiltersNodeDefinitionCreator.java	Mon Apr 09 14:28:42 2018 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFiltersNodeDefinitionCreator.java	Tue Apr 10 13:47:02 2018 +0200
@@ -10,10 +10,6 @@
  */
 public class HttpFiltersNodeDefinitionCreator implements NodeDefinitionCreator {
 
-    public static NodeDefinition createFiltersList() {
-        return createFiltersList(false);
-    }
-
     public static NodeDefinition createFiltersList(boolean transformToObject) {
         return new DynaKeyValueVaryListNodeDefinition("type", HttpFilterFactory.getInstance())
                 .setTransformToPluginObject(transformToObject);
@@ -24,5 +20,4 @@
         return createFiltersList(true);
     }
 
-
 }
--- a/stress-tester/src/main/java/com/passus/st/lookup/LookupsDomainConfigurator.java	Mon Apr 09 14:28:42 2018 +0200
+++ b/stress-tester/src/main/java/com/passus/st/lookup/LookupsDomainConfigurator.java	Tue Apr 10 13:47:02 2018 +0200
@@ -36,7 +36,7 @@
         nodeDef.transform(rootNode, errors, context);
         if (!errors.hasError()) {
             try {
-                List<Lookup> lookups = ConfigurationUtils.convertToList(config.getRootNode(), Lookup.class);
+                List<Lookup> lookups = ConfigurationUtils.convertToList(rootNode, Lookup.class);
                 context.add(ConfigurationContextConsts.LOOKUPS, lookups);
             } catch (Exception e) {
                 throw new RuntimeException(e.getMessage(), e);
--- a/stress-tester/src/main/java/com/passus/st/lookup/LookupsNodeDefinitionCreator.java	Mon Apr 09 14:28:42 2018 +0200
+++ b/stress-tester/src/main/java/com/passus/st/lookup/LookupsNodeDefinitionCreator.java	Tue Apr 10 13:47:02 2018 +0200
@@ -1,26 +1,20 @@
 package com.passus.st.lookup;
 
+import com.passus.config.schema.DynaKeyValueVaryListNodeDefinition;
 import com.passus.config.schema.NodeDefinition;
 import com.passus.config.schema.NodeDefinitionCreator;
 import com.passus.lookup.LookupFactory;
 
-import static com.passus.config.schema.ConfigurationSchemaBuilder.dynaKeyValueVaryListDef;
-
 public class LookupsNodeDefinitionCreator implements NodeDefinitionCreator {
 
-    public NodeDefinition createLookupsListDef() {
-        return createLookupsListDef(true);
-    }
-
     public NodeDefinition createLookupsListDef(boolean transformToObject) {
-        return dynaKeyValueVaryListDef("type", LookupFactory.getInstance())
+        return new DynaKeyValueVaryListNodeDefinition("type", LookupFactory.getInstance())
                 .setTransformToPluginObject(transformToObject);
     }
 
     @Override
     public NodeDefinition create() {
-        return createLookupsListDef();
+        return createLookupsListDef(true);
     }
 
-
 }
--- a/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpFiltersNodeDefinitionCreatorTest.java	Mon Apr 09 14:28:42 2018 +0200
+++ b/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpFiltersNodeDefinitionCreatorTest.java	Tue Apr 10 13:47:02 2018 +0200
@@ -41,8 +41,7 @@
         File file = ResourceUtils.getFile("com/passus/st/client/http/filter/http_message_modify_filter.yml");
         Configuration config = YamlConfigurationReader.readFromFile(file);
 
-        HttpFiltersNodeDefinitionCreator creator = new HttpFiltersNodeDefinitionCreator();
-        NodeDefinition def = creator.createFiltersList();
+        NodeDefinition def = HttpFiltersNodeDefinitionCreator.createFiltersList(false);
 
         Errors errors = new Errors();
         CNode filtersNode = ((CTupleNode) config.getRootNode().getFirstChild()).getNode();
--- a/stress-tester/src/test/java/com/passus/st/lookup/LookupsDomainConfiguratorTest.java	Mon Apr 09 14:28:42 2018 +0200
+++ b/stress-tester/src/test/java/com/passus/st/lookup/LookupsDomainConfiguratorTest.java	Tue Apr 10 13:47:02 2018 +0200
@@ -21,7 +21,7 @@
     public void testConfigure() throws Exception {
         String lookupsConfig = "lookups:\n" +
                 "  - type: csvFile\n" +
-                "    fileName: 'c:\test.csv'\n";
+                "    fileName: 'c:\\test.csv'\n";
 
         Configuration config = readFromString(lookupsConfig);