changeset 841:6ea37bd18996

ReporterConfigurator
author Devel 1
date Tue, 23 Jan 2018 11:05:19 +0100
parents 69f9920bc532
children 48681d1fd832
files stress-tester/src/main/java/com/passus/st/client/http/ReporterConfigurator.java stress-tester/src/main/java/com/passus/st/client/http/ReporterNodeDefinitionCreator.java stress-tester/src/main/java/com/passus/st/utils/ConfigurationContextConsts.java
diffstat 3 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/ReporterConfigurator.java	Mon Jan 22 14:13:41 2018 +0100
+++ b/stress-tester/src/main/java/com/passus/st/client/http/ReporterConfigurator.java	Tue Jan 23 11:05:19 2018 +0100
@@ -8,6 +8,10 @@
 import com.passus.config.schema.NodeDefinition;
 import com.passus.config.validation.Errors;
 import com.passus.st.plugin.PluginConstants;
+import static com.passus.st.utils.ConfigurationContextConsts.REPORTER_DEFAULT_DESTINATION;
+import static com.passus.st.utils.ConfigurationContextConsts.REPORTER_DESTINATIONS;
+import java.util.Collections;
+import java.util.List;
 
 @Plugin(name = ReporterConfigurator.DOMAIN, category = PluginConstants.CATEGORY_DOMAIN_CONFIGURATOR)
 public class ReporterConfigurator implements DomainConfigurator {
@@ -32,7 +36,16 @@
         CCompositeNode rootNode = config.getRootNode();
         nodeDefinition.transform(rootNode, errors, context);
         if (!errors.hasError()) {
+            boolean active = config.getBoolean("active", true);
+            if (active) {
+                ReporterRemoteDestination remote = new ReporterRemoteDestination();
+                remote.configure(config);
+                context.add(REPORTER_DEFAULT_DESTINATION, remote);
+            }
 
+            List<ReporterDestination> destinations = (List<ReporterDestination>) config.get(
+                    "destinations", Collections.EMPTY_LIST);
+            context.add(REPORTER_DESTINATIONS, destinations);
         }
     }
 }
--- a/stress-tester/src/main/java/com/passus/st/client/http/ReporterNodeDefinitionCreator.java	Mon Jan 22 14:13:41 2018 +0100
+++ b/stress-tester/src/main/java/com/passus/st/client/http/ReporterNodeDefinitionCreator.java	Tue Jan 23 11:05:19 2018 +0100
@@ -19,6 +19,7 @@
                 tupleDef("active", valueDefBool()).setRequired(false),
                 tupleDef("address", valueDef()).setRequired(false),
                 tupleDef("port", valueDefInteger().addValidator(PortValidator.INSTANCE)).setRequired(false),
+                tupleDef("threads", valueDefInteger()),
                 tupleDef("destinations", createDestinationsListDef()).setRequired(false)
         );
     }
--- a/stress-tester/src/main/java/com/passus/st/utils/ConfigurationContextConsts.java	Mon Jan 22 14:13:41 2018 +0100
+++ b/stress-tester/src/main/java/com/passus/st/utils/ConfigurationContextConsts.java	Tue Jan 23 11:05:19 2018 +0100
@@ -35,7 +35,7 @@
 
     public static final String REPORTER_DESTINATIONS = "reporter.destinations";
 
-    public static final String REPORTER_DEFAULT_DESTINATIONS =  "reporter.default_destination";
+    public static final String REPORTER_DEFAULT_DESTINATION =  "reporter.default_destination";
 
     private ConfigurationContextConsts() {
     }