Mercurial > stress-tester
changeset 1109:736e2559c13c
CommonNodeDefs - more predefined node definitions
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/FlowExecutor.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/FlowExecutor.java Wed May 20 09:45:26 2020 +0200 @@ -12,11 +12,10 @@ import com.passus.config.schema.NodeDefinitionCreator; import com.passus.config.validation.EnumValidator; import com.passus.config.validation.Errors; -import com.passus.config.validation.LongValidator; +import com.passus.st.emitter.Emitter; import com.passus.st.filter.FlowFilter; import com.passus.st.filter.FlowFilterChain; import com.passus.st.filter.FlowFilterNodeDefinitionCreator; -import com.passus.st.emitter.Emitter; import com.passus.st.metric.MetricSource; import com.passus.st.metric.MetricsContainer; import org.apache.logging.log4j.LogManager; @@ -25,6 +24,8 @@ import java.util.*; import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.st.config.CommonNodeDefs.BOOLEAN_DEF; +import static com.passus.st.config.CommonNodeDefs.INT_GREATER_THAN_ZERO_DEF; public class FlowExecutor implements EventHandler, MetricSource, Service, Configurable { @@ -358,11 +359,9 @@ @Override public NodeDefinition create() { return mapDef( - tupleDef("connectPartialSession", valueDefBool()).setRequired(false), - tupleDef("collectMetrics", valueDefBool()).setRequired(false), - tupleDef("workers", valueDefInteger() - .addValidator(LongValidator.GREATER_ZERO) - ).setRequired(false), + tupleDef("connectPartialSession", BOOLEAN_DEF).setRequired(false), + tupleDef("collectMetrics", BOOLEAN_DEF).setRequired(false), + tupleDef("workers", INT_GREATER_THAN_ZERO_DEF).setRequired(false), tupleDef("dispatcher", valueDef() .addValidator(new EnumValidator(DISPATCHERS, false)) .setTransformer(FlowExecutor.DispatcherTransformer.INSTANCE)
--- a/stress-tester/src/main/java/com/passus/st/client/credentials/CsvUsernamePasswordCredentialsProvider.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/credentials/CsvUsernamePasswordCredentialsProvider.java Wed May 20 09:45:26 2020 +0200 @@ -10,6 +10,8 @@ import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef; import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; import static com.passus.config.schema.ConfigurationSchemaBuilder.valueDef; +import static com.passus.st.config.CommonNodeDefs.STRING_DEF; + import com.passus.config.schema.NodeDefinition; import com.passus.config.schema.NodeDefinitionCreator; import com.passus.st.client.FlowContext; @@ -171,9 +173,9 @@ @Override public NodeDefinition create() { return mapDef( - tupleDef("fileName", valueDef()), + tupleDef("fileName", STRING_DEF), tupleDef("readMode", valueDef().setTransformer(TRANSFORMER)).setRequired(false), - tupleDef("separator", valueDef()).setRequired(false) + tupleDef("separator", STRING_DEF).setRequired(false) ); } }
--- a/stress-tester/src/main/java/com/passus/st/client/credentials/UsernamePasswordCredentialsProvider.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/credentials/UsernamePasswordCredentialsProvider.java Wed May 20 09:45:26 2020 +0200 @@ -4,14 +4,16 @@ import com.passus.config.Configuration; import com.passus.config.ConfigurationContext; import com.passus.config.annotations.NodeDefinitionCreate; -import static com.passus.config.schema.ConfigurationSchemaBuilder.*; import com.passus.config.schema.NodeDefinition; import com.passus.config.schema.NodeDefinitionCreator; import com.passus.st.client.FlowContext; import com.passus.st.plugin.PluginConstants; +import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef; +import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; +import static com.passus.st.config.CommonNodeDefs.STRING_DEF; + /** - * * @author mikolaj.podbielski */ @NodeDefinitionCreate(UsernamePasswordCredentialsProvider.UsernamePasswordCredentialsProviderNodeDefinitionCreator.class) @@ -69,8 +71,8 @@ @Override public NodeDefinition create() { return mapDef( - tupleDef("username", valueDef()), - tupleDef("password", valueDef()).setRequired(false) + tupleDef("username", STRING_DEF), + tupleDef("password", STRING_DEF).setRequired(false) ); }
--- a/stress-tester/src/main/java/com/passus/st/client/dns/filter/DnsRecordTypeFilter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/dns/filter/DnsRecordTypeFilter.java Wed May 20 09:45:26 2020 +0200 @@ -18,6 +18,7 @@ import java.util.Set; import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.st.config.CommonNodeDefs.BOOLEAN_DEF; @NodeDefinitionCreate(DnsRecordTypeFilter.DnsRecordTypeFilterNodeDefCreator.class) @Plugin(name = DnsRecordTypeFilter.TYPE, category = PluginConstants.CATEGORY_FLOW_FILTER) @@ -75,7 +76,7 @@ @Override public NodeDefinition create() { return mapDef( - tupleDef("acceptOnMatch", valueDefBool()).setRequired(false), + tupleDef("acceptOnMatch", BOOLEAN_DEF).setRequired(false), tupleDef("recordTypes", listDef(enumDef(DnsRecordType.class))) ); }
--- a/stress-tester/src/main/java/com/passus/st/client/http/DumperHttpClientListener.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/DumperHttpClientListener.java Wed May 20 09:45:26 2020 +0200 @@ -21,8 +21,11 @@ import java.util.Date; import java.util.concurrent.atomic.AtomicInteger; -import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef; +import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; import static com.passus.st.client.http.filter.HttpFlowUtils.extractHttpContext; +import static com.passus.st.config.CommonNodeDefs.BOOLEAN_DEF; +import static com.passus.st.config.CommonNodeDefs.STRING_DEF; /** * @author mikolaj.podbielski @@ -166,11 +169,11 @@ @Override public NodeDefinition create() { return mapDef( - tupleDef("directory", valueDef()), - tupleDef("prefix", valueDef()).setRequired(false), - tupleDef("suffix", valueDef()).setRequired(false), - tupleDef("decodeContent", valueDefBool()).setRequired(false), - tupleDef("requestsOnly", valueDefBool()).setRequired(false) + tupleDef("directory", STRING_DEF), + tupleDef("prefix", STRING_DEF).setRequired(false), + tupleDef("suffix", STRING_DEF).setRequired(false), + tupleDef("decodeContent", BOOLEAN_DEF).setRequired(false), + tupleDef("requestsOnly", BOOLEAN_DEF).setRequired(false) ); } }
--- a/stress-tester/src/main/java/com/passus/st/client/http/ReporterFileDestination.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/ReporterFileDestination.java Wed May 20 09:45:26 2020 +0200 @@ -31,6 +31,7 @@ import static com.passus.config.schema.ConfigurationSchemaBuilder.*; import static com.passus.net.http.HttpUtils.intToVersionString; import static com.passus.st.client.http.HttpConsts.*; +import static com.passus.st.config.CommonNodeDefs.STRING_DEF; import static com.passus.st.reporter.ReporterImpl.addValue; @NodeDefinitionCreate(ReporterFileDestination.ReporterFileDestinationNodeDefCreator.class) @@ -261,7 +262,7 @@ @Override public NodeDefinition create() { return mapDef( - tupleDef("directory", valueDef()) + tupleDef("directory", STRING_DEF) ); } }
--- a/stress-tester/src/main/java/com/passus/st/client/http/ReporterNodeDefinitionCreator.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/ReporterNodeDefinitionCreator.java Wed May 20 09:45:26 2020 +0200 @@ -3,10 +3,10 @@ import com.passus.config.schema.DynaKeyValueVaryListNodeDefinition; import com.passus.config.schema.NodeDefinition; import com.passus.config.schema.NodeDefinitionCreator; -import com.passus.st.validation.PortValidator; -import static com.passus.config.schema.ConfigurationSchemaBuilder.*; -import com.passus.config.validation.LongValidator; +import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef; +import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; +import static com.passus.st.config.CommonNodeDefs.*; public class ReporterNodeDefinitionCreator implements NodeDefinitionCreator { @@ -17,10 +17,10 @@ public static NodeDefinition createDef() { return mapDef( - tupleDef("active", valueDefBool()).setRequired(false), - tupleDef("host", valueDef()).setRequired(false), - tupleDef("port", valueDefInteger().addValidator(PortValidator.INSTANCE)).setRequired(false), - tupleDef("threads", valueDefInteger().addValidator(LongValidator.GREATER_ZERO)).setRequired(false), + tupleDef("active", BOOLEAN_DEF).setRequired(false), + tupleDef("host", STRING_DEF).setRequired(false), + tupleDef("port", PORT_DEF).setRequired(false), + tupleDef("threads", INT_GREATER_THAN_ZERO_DEF).setRequired(false), tupleDef("destinations", createDestinationsListDef()).setRequired(false) ); }
--- a/stress-tester/src/main/java/com/passus/st/client/http/ReporterRemoteDestination.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/ReporterRemoteDestination.java Wed May 20 09:45:26 2020 +0200 @@ -10,7 +10,6 @@ import com.passus.config.annotations.NodeDefinitionCreate; import com.passus.config.schema.NodeDefinition; import com.passus.config.schema.NodeDefinitionCreator; -import com.passus.config.validation.LongValidator; import com.passus.data.ByteString; import com.passus.net.SocketAddress; import com.passus.net.http.HttpHeaders; @@ -23,7 +22,6 @@ import com.passus.st.plugin.PluginConstants; import com.passus.st.reporter.ReporterClient; import com.passus.st.reporter.trx.SocketReporterClient; -import com.passus.st.validation.PortValidator; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -33,10 +31,12 @@ import java.util.Map; import java.util.Set; -import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef; +import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; import static com.passus.net.http.HttpUtils.intToVersionString; import static com.passus.st.client.http.HttpConsts.*; import static com.passus.st.client.http.filter.HttpFlowUtils.extractHttpContext; +import static com.passus.st.config.CommonNodeDefs.*; /** * @author Mirosław Hawrot @@ -272,9 +272,9 @@ @Override public NodeDefinition create() { return mapDef( - tupleDef("host", valueDef()).setRequired(false), - tupleDef("port", valueDefInteger().addValidator(PortValidator.INSTANCE)).setRequired(false), - tupleDef("threads", valueDefInteger().addValidator(LongValidator.GREATER_ZERO)).setRequired(false) + tupleDef("host", STRING_DEF).setRequired(false), + tupleDef("port", PORT_DEF).setRequired(false), + tupleDef("threads", INT_GREATER_THAN_ZERO_DEF).setRequired(false) ); } }
--- a/stress-tester/src/main/java/com/passus/st/client/http/SummaryHttpClientListener.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/SummaryHttpClientListener.java Wed May 20 09:45:26 2020 +0200 @@ -19,6 +19,7 @@ import static com.passus.config.schema.ConfigurationSchemaBuilder.*; import static com.passus.net.http.HttpUtils.intToVersionString; +import static com.passus.st.config.CommonNodeDefs.STRING_DEF; import static com.passus.st.plugin.PluginConstants.CATEGORY_CLIENT_LISTENER; /** @@ -104,7 +105,7 @@ @Override public NodeDefinition create() { return mapDef( - tupleDef("fileName", valueDef()) + tupleDef("fileName", STRING_DEF) ); } }
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpAbstractLoginFilter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpAbstractLoginFilter.java Wed May 20 09:45:26 2020 +0200 @@ -19,6 +19,7 @@ import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef; import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; import static com.passus.st.client.http.filter.HttpFlowUtils.extractHttpContext; +import static com.passus.st.config.CommonNodeDefs.MSG_PREDICATE_DEF; /** * @author mikolaj.podbielski @@ -110,11 +111,9 @@ public static class GenericNodeDefinitionCreator implements NodeDefinitionCreator { - private static final MessagePredicateNodeDefinition messagePredicateNodeDefinition = new MessagePredicateNodeDefinition(); - public final MapNodeDefinition create(boolean applyIfRequired, boolean providerRequired) { MapNodeDefinition mapDef = mapDef().setCanBeEmpty(true); - mapDef.add(tupleDef("applyIf", messagePredicateNodeDefinition).setRequired(applyIfRequired)); + mapDef.add(tupleDef("applyIf", MSG_PREDICATE_DEF).setRequired(applyIfRequired)); mapDef.add(tupleDef("provider", CredentialsProviderNodeDefinition.providersNodeDef()).setRequired(providerRequired)); return mapDef; }
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpCsrfFilter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpCsrfFilter.java Wed May 20 09:45:26 2020 +0200 @@ -30,6 +30,7 @@ import com.passus.st.validation.HttpValidators; import static com.passus.st.client.http.filter.HttpFlowUtils.extractHttpContext; +import static com.passus.st.config.CommonNodeDefs.STRING_DEF; import static com.passus.st.validation.NodeValidationUtils.validateType; import java.util.ArrayList; import java.util.Collections; @@ -324,12 +325,12 @@ KeyNameVaryListNodeDefinition extractorsDef = new KeyNameVaryListNodeDefinition() .setNodeTransformer(new HttpCsrfFilterExtractorTransformer()) .add("header", valueDef().addValidator(HttpValidators.HEADER_NAME_VALIDATOR)) - .add("cookie", valueDef()); + .add("cookie", STRING_DEF); KeyNameVaryListNodeDefinition injectorsDef = new KeyNameVaryListNodeDefinition() .setNodeTransformer(new HttpCsrfFilterInjectorTransformer()) .add("header", valueDef().addValidator(HttpValidators.HEADER_NAME_VALIDATOR)) - .add("cookie", valueDef()); + .add("cookie", STRING_DEF); ValueNodeDefinition storeDef = valueDef().setTransformer(new HttpCsrfFilterStoreTransformer());
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpCsrfFormFilter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpCsrfFormFilter.java Wed May 20 09:45:26 2020 +0200 @@ -21,8 +21,11 @@ import java.util.*; import java.util.stream.Collectors; -import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef; +import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; import static com.passus.st.client.http.filter.HttpFlowUtils.extractHttpContext; +import static com.passus.st.config.CommonNodeDefs.STRING_DEF; +import static com.passus.st.config.CommonNodeDefs.STRING_LIST_DEF; /** * @author mikolaj.podbielski @@ -159,8 +162,8 @@ @Override public NodeDefinition create() { return mapDef( - tupleDef("inputName", valueDef()), - tupleDef("contentTypesToScan", listDef(valueDef())).setRequired(false) + tupleDef("inputName", STRING_DEF), + tupleDef("contentTypesToScan", STRING_LIST_DEF).setRequired(false) ); } }
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFormLoginFilter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpFormLoginFilter.java Wed May 20 09:45:26 2020 +0200 @@ -21,6 +21,7 @@ import static com.passus.config.schema.ConfigurationSchemaBuilder.valueDef; import static com.passus.st.client.http.HttpConsts.PARAM_USERNAME; import static com.passus.st.client.http.filter.HttpFlowUtils.extractHttpContext; +import static com.passus.st.config.CommonNodeDefs.STRING_DEF; /** * @author mikolaj.podbielski @@ -114,8 +115,8 @@ @Override public MapNodeDefinition create() { MapNodeDefinition mapDef = create(true, false); - mapDef.add("userField", valueDef()); - mapDef.add("passwordField", valueDef()); + mapDef.add("userField", STRING_DEF); + mapDef.add("passwordField", STRING_DEF); return mapDef; } }
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpLogoutFilter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpLogoutFilter.java Wed May 20 09:45:26 2020 +0200 @@ -10,15 +10,18 @@ import com.passus.net.http.HttpResponse; import com.passus.st.ParametersBag; import com.passus.st.client.FlowContext; +import com.passus.st.client.http.HttpScopes; import com.passus.st.filter.MessagePredicate; import com.passus.st.filter.MessagePredicateNodeDefinition; -import com.passus.st.client.http.HttpScopes; import com.passus.st.plugin.PluginConstants; -import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef; +import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; import static com.passus.st.client.http.HttpConsts.PARAM_USERNAME; import static com.passus.st.client.http.HttpConsts.TAG_SESSION_ID; import static com.passus.st.client.http.filter.HttpFlowUtils.extractHttpContext; +import static com.passus.st.config.CommonNodeDefs.BOOLEAN_DEF; +import static com.passus.st.config.CommonNodeDefs.MSG_PREDICATE_DEF; /** * @author Mirosław Hawrot @@ -97,8 +100,8 @@ public NodeDefinition create() { return mapDef( - tupleDef("invalidateSession", valueDefBool()).setRequired(false), - tupleDef("applyIf", new MessagePredicateNodeDefinition()) + tupleDef("invalidateSession", BOOLEAN_DEF).setRequired(false), + tupleDef("applyIf", MSG_PREDICATE_DEF) ); }
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMarkFilter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMarkFilter.java Wed May 20 09:45:26 2020 +0200 @@ -27,6 +27,8 @@ import static com.passus.config.schema.ConfigurationSchemaBuilder.*; import static com.passus.st.client.http.HttpConsts.TAG_MARKER; +import static com.passus.st.config.CommonNodeDefs.MSG_PREDICATE_DEF; +import static com.passus.st.config.CommonNodeDefs.STRING_DEF; /** * @author Mirosław Hawrot @@ -161,9 +163,9 @@ @Override public NodeDefinition create() { MapNodeDefinition markerRuleNodeDef = mapDef( - tupleDef("category", valueDef()), - tupleDef("message", valueDef().setRequired(false)), - tupleDef("applyIf", new MessagePredicateNodeDefinition()) + tupleDef("category", STRING_DEF), + tupleDef("message", STRING_DEF).setRequired(false), + tupleDef("applyIf", MSG_PREDICATE_DEF) ).setTransformer(new MarkerRuleNodeTransformer()); return mapDef(
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMessageModificationFilter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMessageModificationFilter.java Wed May 20 09:45:26 2020 +0200 @@ -25,6 +25,7 @@ import java.util.List; import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.st.config.CommonNodeDefs.*; /** * @author Mirosław Hawrot @@ -147,23 +148,23 @@ listDef(valueDef()), fieldValExtractorNodeDef ) - ).addParam(tupleDef("*escape", valueDefBool()).setRequired(false)); + ).addParam(tupleDef("*escape", BOOLEAN_DEF).setRequired(false)); HeaderOperationNodeDefinition headerNodeDef = new HeaderOperationNodeDefinition( mixedDef( fieldValExtractorNodeDef ) - ).addParam(tupleDef("*escape", valueDefBool()).setRequired(false)); + ).addParam(tupleDef("*escape", BOOLEAN_DEF).setRequired(false)); KeyNameVaryListNodeDefinition operationsDef = new KeyNameVaryListNodeDefinition() .setNodeTransformer(new HttpMessageModificationFilterTransformer()) .add("removeHeader", valueDef().addValidator(HttpValidators.HEADER_NAME_VALIDATOR)) .add("addHeader", headerNodeDef) .add("setHeader", headerNodeDef) - .add("removeCookie", valueDef()) + .add("removeCookie", STRING_DEF) .add("addCookie", headerNodeDef) .add("setCookie", headerNodeDef) - .add("removePostParam", valueDef()) + .add("removePostParam", STRING_DEF) .add("addPostParam", paramNodeDef) .add("setPostParam", paramNodeDef) .add("removeQueryParam", paramNodeDef) @@ -172,9 +173,9 @@ .add("setContent", mappingDef().setChildrenNum(1)) .add("setMethod", valueDef().addValidator(HttpValidators.METHOD_VALIDATOR)) .add("setVersion", valueDef().addValidator(HttpValidators.VERSION_VALIDATOR)) - .add("setUri", valueDef()) - .add("setUrlQuery", valueDef()) - .add("setUrlRef", valueDef()) + .add("setUri", STRING_DEF) + .add("setUrlQuery", STRING_DEF) + .add("setUrlRef", STRING_DEF) .add("setUrlPath", mixedDef( valueDef(), mappingDef().setChildrenNum(1) @@ -182,7 +183,7 @@ return mapDef( tupleDef("operations", operationsDef), - tupleDef("applyIf", new MessagePredicateNodeDefinition()).setRequired(false), + tupleDef("applyIf", MSG_PREDICATE_DEF).setRequired(false), tupleDef("dir", enumDef(FilterDirection.class)).setRequired(false) ); }
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpScopeModificationFilter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpScopeModificationFilter.java Wed May 20 09:45:26 2020 +0200 @@ -15,7 +15,10 @@ import com.passus.st.client.FlowContext; import com.passus.st.config.FieldValueExtractorTransformerNodeDefCreator; import com.passus.st.config.HeaderOperationNodeDefinition; -import com.passus.st.filter.*; +import com.passus.st.filter.FilterDirection; +import com.passus.st.filter.FlowFilterFactory; +import com.passus.st.filter.MessagePredicate; +import com.passus.st.filter.MessageWrapper; import com.passus.st.plugin.PluginConstants; import java.util.ArrayList; @@ -24,6 +27,7 @@ import static com.passus.config.schema.ConfigurationSchemaBuilder.*; import static com.passus.st.client.http.filter.HttpFlowUtils.extractHttpContext; +import static com.passus.st.config.CommonNodeDefs.*; /** * @author Mirosław Hawrot @@ -291,7 +295,7 @@ fieldValExtractorNodeDef ); setSessionDef.addParam( - tupleDef("*autocreate", valueDefBool()).setRequired(false) + tupleDef("*autocreate", BOOLEAN_DEF).setRequired(false) ); HeaderOperationNodeDefinition setGlobalDef = new HeaderOperationNodeDefinition( @@ -300,17 +304,17 @@ KeyNameVaryListNodeDefinition operationsDef = new KeyNameVaryListNodeDefinition() .setNodeTransformer(new HttpScopeModificationFilterTransformer()) - .add("removeSession", nullValueDef()) - .add("removeSessionParam", valueDef()) + .add("removeSession", NULL_DEF) + .add("removeSessionParam", STRING_DEF) .add("addSessionParam", setSessionDef) .add("setSessionParam", setSessionDef) - .add("removeGlobalParam", valueDef()) + .add("removeGlobalParam", STRING_DEF) .add("addGlobalParam", setGlobalDef) .add("setGlobalParam", setGlobalDef); return mapDef( tupleDef("operations", operationsDef), - tupleDef("applyIf", new MessagePredicateNodeDefinition()).setRequired(false), + tupleDef("applyIf", MSG_PREDICATE_DEF).setRequired(false), tupleDef("dir", enumDef(FilterDirection.class)).setRequired(false) ); }
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpSessionBlockerFilter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpSessionBlockerFilter.java Wed May 20 09:45:26 2020 +0200 @@ -6,16 +6,17 @@ import com.passus.config.annotations.NodeDefinitionCreate; import com.passus.config.schema.MapNodeDefinition; import com.passus.config.schema.NodeDefinitionCreator; -import com.passus.config.validation.LongValidator; import com.passus.net.http.HttpRequest; import com.passus.net.http.HttpResponse; import com.passus.st.ParametersBag; import com.passus.st.client.FlowContext; import com.passus.st.plugin.PluginConstants; -import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef; +import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; import static com.passus.st.client.http.HttpConsts.TAG_SESSION_REQUESTS_COUNT; import static com.passus.st.client.http.filter.HttpFlowUtils.extractHttpContext; +import static com.passus.st.config.CommonNodeDefs.INT_GREATER_EQUAL_ZERO_DEF; @NodeDefinitionCreate(HttpSessionBlockerFilter.HttpSessionBlockerFilterNodeDefinitionCreator.class) @Plugin(name = HttpSessionBlockerFilter.TYPE, category = PluginConstants.CATEGORY_FLOW_FILTER) @@ -67,7 +68,7 @@ @Override public MapNodeDefinition create() { return mapDef( - tupleDef("maxRequestsCount", valueDefInteger().addValidator(LongValidator.GREATER_EQUAL_ZERO)) + tupleDef("maxRequestsCount", INT_GREATER_EQUAL_ZERO_DEF) ); } }
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpSessionCookieFilter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpSessionCookieFilter.java Wed May 20 09:45:26 2020 +0200 @@ -22,6 +22,8 @@ import static com.passus.st.client.http.HttpConsts.TAG_ORIG_SESSION_ID; import static com.passus.st.client.http.HttpConsts.TAG_SESSION_ID; import static com.passus.st.client.http.filter.HttpFlowUtils.extractHttpContext; +import static com.passus.st.config.CommonNodeDefs.BOOLEAN_DEF; +import static com.passus.st.config.CommonNodeDefs.STRING_DEF; /** * @author mikolaj.podbielski @@ -198,8 +200,8 @@ @Override public NodeDefinition create() { return mapDef( - tupleDef("sessionCookieNames", listDef(valueDef())).setRequired(false), - tupleDef("removeInvalidSessionId", valueDefBool()).setRequired(false) + tupleDef("sessionCookieNames", listDef(STRING_DEF)).setRequired(false), + tupleDef("removeInvalidSessionId", BOOLEAN_DEF).setRequired(false) ); }
--- a/stress-tester/src/main/java/com/passus/st/client/netflow/filter/NetflowVersionFilter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/client/netflow/filter/NetflowVersionFilter.java Wed May 20 09:45:26 2020 +0200 @@ -18,6 +18,7 @@ import java.util.Set; import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.st.config.CommonNodeDefs.BOOLEAN_DEF; @NodeDefinitionCreate(NetflowVersionFilter.NetflowVersionFilterNodeDefCreator.class) @Plugin(name = NetflowVersionFilter.TYPE, category = PluginConstants.CATEGORY_FLOW_FILTER) @@ -88,7 +89,7 @@ @Override public NodeDefinition create() { return mapDef( - tupleDef("acceptOnMatch", valueDefBool()).setRequired(false), + tupleDef("acceptOnMatch", BOOLEAN_DEF).setRequired(false), tupleDef("versions", listDef(valueDefInteger())) ); }
--- a/stress-tester/src/main/java/com/passus/st/config/CommonNodeDefs.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/config/CommonNodeDefs.java Wed May 20 09:45:26 2020 +0200 @@ -3,18 +3,29 @@ import com.passus.config.schema.NodeDefinition; import com.passus.config.validation.LongValidator; -import static com.passus.config.schema.ConfigurationSchemaBuilder.valueDefInteger; -import static com.passus.config.schema.ConfigurationSchemaBuilder.valueDefLong; +import static com.passus.config.schema.ConfigurationSchemaBuilder.*; public class CommonNodeDefs { - public static NodeDefinition INT_GREATER_THAN_ZERO = valueDefInteger().addValidator(LongValidator.GREATER_ZERO); + public static NodeDefinition NULL_DEF = nullValueDef(); - public static NodeDefinition LONG_GREATER_THAN_ZERO = valueDefLong().addValidator(LongValidator.GREATER_ZERO); + public static NodeDefinition BOOLEAN_DEF = valueDef(Boolean.class); - public static NodeDefinition INT_GREATER_EQUAL_ZERO = valueDefInteger().addValidator(LongValidator.GREATER_EQUAL_ZERO); + public static NodeDefinition STRING_DEF = valueDef(String.class); - public static NodeDefinition LONG_GREATER_EQUAL_ZERO = valueDefLong().addValidator(LongValidator.GREATER_EQUAL_ZERO); + public static NodeDefinition STRING_LIST_DEF = listDef(STRING_DEF); + + public static NodeDefinition PORT_DEF = valueDefInteger().addValidator(PortValidator.INSTANCE); + + public static NodeDefinition INT_GREATER_THAN_ZERO_DEF = valueDefInteger().addValidator(LongValidator.GREATER_ZERO); + + public static NodeDefinition LONG_GREATER_THAN_ZERO_DEF = valueDefLong().addValidator(LongValidator.GREATER_ZERO); + + public static NodeDefinition INT_GREATER_EQUAL_ZERO_DEF = valueDefInteger().addValidator(LongValidator.GREATER_EQUAL_ZERO); + + public static NodeDefinition LONG_GREATER_EQUAL_ZERO_DEF = valueDefLong().addValidator(LongValidator.GREATER_EQUAL_ZERO); + + public static NodeDefinition MSG_PREDICATE_DEF = new MessagePredicateNodeDefinition(); private CommonNodeDefs() { }
--- a/stress-tester/src/main/java/com/passus/st/config/TimeoutsNodeDefCreator.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/config/TimeoutsNodeDefCreator.java Wed May 20 09:45:26 2020 +0200 @@ -6,7 +6,7 @@ import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef; import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; -import static com.passus.st.config.CommonNodeDefs.LONG_GREATER_THAN_ZERO; +import static com.passus.st.config.CommonNodeDefs.LONG_GREATER_THAN_ZERO_DEF; public class TimeoutsNodeDefCreator implements NodeDefinitionCreator { @@ -23,9 +23,9 @@ @Override public NodeDefinition create() { return mapDef( - tupleDef("connect", LONG_GREATER_THAN_ZERO).setRequired(false), - tupleDef("read", LONG_GREATER_THAN_ZERO).setRequired(false), - tupleDef("disconnect", LONG_GREATER_THAN_ZERO).setRequired(false) + tupleDef("connect", LONG_GREATER_THAN_ZERO_DEF).setRequired(false), + tupleDef("read", LONG_GREATER_THAN_ZERO_DEF).setRequired(false), + tupleDef("disconnect", LONG_GREATER_THAN_ZERO_DEF).setRequired(false) ).setTransformer(new TimeoutsRuleNodeTransformer(defaultTimeouts)); }
--- a/stress-tester/src/main/java/com/passus/st/emitter/Emitter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/emitter/Emitter.java Wed May 20 09:45:26 2020 +0200 @@ -13,7 +13,9 @@ import java.io.IOException; -import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef; +import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; +import static com.passus.st.config.CommonNodeDefs.BOOLEAN_DEF; /** * @author Mirosław Hawrot @@ -49,7 +51,7 @@ return mapDef( tupleDef("sessionMapper", SessionMapperNodeDefinitionCreator.createDef()).setRequired(false), - tupleDef("collectMetrics", valueDefBool()).setRequired(false), + tupleDef("collectMetrics", BOOLEAN_DEF).setRequired(false), tupleDef("timeouts", timeoutsNodeDef).setRequired(false) ); }
--- a/stress-tester/src/main/java/com/passus/st/emitter/raw/PcapUnidirectionalRawPacketEmitter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/emitter/raw/PcapUnidirectionalRawPacketEmitter.java Wed May 20 09:45:26 2020 +0200 @@ -8,7 +8,7 @@ import com.passus.st.plugin.PluginConstants; import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; -import static com.passus.config.schema.ConfigurationSchemaBuilder.valueDef; +import static com.passus.st.config.CommonNodeDefs.STRING_DEF; @NodeDefinitionCreate(PcapUnidirectionalRawPacketEmitter.PcapUnidirectionalRawPacketEmitterNodeDefCreator.class) @Plugin(name = PcapUnidirectionalRawPacketEmitter.TYPE, category = PluginConstants.CATEGORY_EMITTER) @@ -50,7 +50,7 @@ public MapNodeDefinition create() { MapNodeDefinition def = super.create(); def.add( - tupleDef("dumpFile", valueDef()).setRequired(false) + tupleDef("dumpFile", STRING_DEF).setRequired(false) ); return def; }
--- a/stress-tester/src/main/java/com/passus/st/filter/CounterFilter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/filter/CounterFilter.java Wed May 20 09:45:26 2020 +0200 @@ -11,10 +11,11 @@ import java.util.concurrent.atomic.AtomicInteger; -import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef; +import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; +import static com.passus.st.config.CommonNodeDefs.*; /** - * * @author mikolaj.podbielski */ @NodeDefinitionCreate(CounterFilter.NodeDefCreator.class) @@ -99,9 +100,9 @@ @Override public NodeDefinition create() { return mapDef( - tupleDef("applyIf", new MessagePredicateNodeDefinition()), - tupleDef("limit", valueDefInteger()), - tupleDef("name", valueDef()).setRequired(false) + tupleDef("applyIf", MSG_PREDICATE_DEF), + tupleDef("limit", INT_GREATER_THAN_ZERO_DEF), + tupleDef("name", STRING_DEF).setRequired(false) ); }
--- a/stress-tester/src/main/java/com/passus/st/filter/MatchFilter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/filter/MatchFilter.java Wed May 20 09:45:26 2020 +0200 @@ -10,7 +10,10 @@ import com.passus.st.client.FlowContext; import com.passus.st.plugin.PluginConstants; -import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef; +import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; +import static com.passus.st.config.CommonNodeDefs.BOOLEAN_DEF; +import static com.passus.st.config.CommonNodeDefs.MSG_PREDICATE_DEF; /** * @author Mirosław Hawrot @@ -85,8 +88,8 @@ @Override public NodeDefinition create() { return mapDef( - tupleDef("acceptOnMatch", valueDefBool()).setRequired(false), - tupleDef("matches", new MessagePredicateNodeDefinition()) + tupleDef("acceptOnMatch", BOOLEAN_DEF).setRequired(false), + tupleDef("matches", MSG_PREDICATE_DEF) ); }
--- a/stress-tester/src/main/java/com/passus/st/filter/SequenceFilter.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/filter/SequenceFilter.java Wed May 20 09:45:26 2020 +0200 @@ -24,6 +24,7 @@ import java.util.function.Predicate; import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.st.config.CommonNodeDefs.*; /** * @author mikolaj.podbielski @@ -375,10 +376,10 @@ @Override public NodeDefinition create() { MapNodeDefinition elementDef = mapDef( - tupleDef("match", new MessagePredicateNodeDefinition()), - tupleDef("mustOccur", valueDef(Boolean.class)).setRequired(false), - tupleDef("time", valueDef(Long.class)).setRequired(false), - tupleDef("alias", valueDef()).setRequired(false) + tupleDef("match", MSG_PREDICATE_DEF), + tupleDef("mustOccur", BOOLEAN_DEF).setRequired(false), + tupleDef("time", LONG_GREATER_EQUAL_ZERO_DEF).setRequired(false), + tupleDef("alias", STRING_DEF).setRequired(false) ); elementDef.setTransformer(new SequencesNodeTransformer()); // TODO: mustOccur and time required in all steps but first
--- a/stress-tester/src/main/java/com/passus/st/generator/RandomStringGenerator.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/generator/RandomStringGenerator.java Wed May 20 09:45:26 2020 +0200 @@ -7,14 +7,14 @@ import com.passus.config.annotations.NodeDefinitionCreate; import com.passus.config.schema.NodeDefinition; import com.passus.config.schema.NodeDefinitionCreator; -import com.passus.config.schema.ValueNodeDefinition; -import com.passus.config.validation.LongValidator; import com.passus.st.plugin.PluginConstants; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.StringUtils; import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.st.config.CommonNodeDefs.INT_GREATER_EQUAL_ZERO_DEF; +import static com.passus.st.config.CommonNodeDefs.STRING_DEF; @NodeDefinitionCreate(RandomStringGenerator.RandomStringGeneratorNodeDefCreator.class) @Plugin(name = RandomStringGenerator.TYPE, category = PluginConstants.CATEGORY_GENERATOR) @@ -130,13 +130,11 @@ @Override public NodeDefinition create() { - ValueNodeDefinition lengthDef = valueDefInteger().addValidator(LongValidator.GREATER_EQUAL_ZERO); - return mapDef( tupleDef("charactersSet", enumDef(RandomStringGenerator.CharactersSet.class)).setRequired(false), - tupleDef("minLength", lengthDef).setRequired(false), - tupleDef("maxLength", lengthDef).setRequired(false), - tupleDef("chars", valueDef()).setRequired(false) + tupleDef("minLength", INT_GREATER_EQUAL_ZERO_DEF).setRequired(false), + tupleDef("maxLength", INT_GREATER_EQUAL_ZERO_DEF).setRequired(false), + tupleDef("chars", STRING_DEF).setRequired(false) ).setCanBeEmpty(true); } }
--- a/stress-tester/src/main/java/com/passus/st/metric/FileMetricsCollectionAppender.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/metric/FileMetricsCollectionAppender.java Wed May 20 09:45:26 2020 +0200 @@ -7,28 +7,19 @@ import com.passus.config.Configuration; import com.passus.config.ConfigurationContext; import com.passus.config.annotations.NodeDefinitionCreate; -import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef; -import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; -import static com.passus.config.schema.ConfigurationSchemaBuilder.valueDef; -import static com.passus.config.schema.ConfigurationSchemaBuilder.valueDefBool; -import static com.passus.config.schema.ConfigurationSchemaBuilder.valueDefInteger; import com.passus.config.schema.NodeDefinition; import com.passus.config.schema.NodeDefinitionCreator; -import com.passus.config.validation.LongValidator; import com.passus.st.plugin.PluginConstants; import com.passus.st.utils.SizeValueTransformer; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.io.*; + +import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.st.config.CommonNodeDefs.*; + /** - * * @author Mirosław Hawrot */ @NodeDefinitionCreate(FileMetricsCollectionAppender.FileMetricsCollectionAppenderNodeDefCreator.class) @@ -293,14 +284,12 @@ @Override public NodeDefinition create() { return mapDef( - tupleDef("active", valueDefBool()).setRequired(false), - tupleDef("fileName", valueDef()), + tupleDef("active", BOOLEAN_DEF).setRequired(false), + tupleDef("fileName", STRING_DEF), tupleDef("maxFileSize", valueDef().setTransformer(SizeValueTransformer.INSTANCE) ).setRequired(false), - tupleDef("maxBackupIndex", - valueDefInteger().addValidator(LongValidator.GREATER_EQUAL_ZERO) - ).setRequired(false) + tupleDef("maxBackupIndex", INT_GREATER_EQUAL_ZERO_DEF).setRequired(false) ); }
--- a/stress-tester/src/main/java/com/passus/st/metric/MetricsNodeDefinitionCreator.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/metric/MetricsNodeDefinitionCreator.java Wed May 20 09:45:26 2020 +0200 @@ -5,6 +5,7 @@ import com.passus.config.schema.NodeDefinitionCreator; import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.st.config.CommonNodeDefs.BOOLEAN_DEF; public class MetricsNodeDefinitionCreator implements NodeDefinitionCreator { @@ -15,7 +16,7 @@ public static NodeDefinition createDef() { return mapDef( - tupleDef("active", valueDefBool()).setRequired(false), + tupleDef("active", BOOLEAN_DEF).setRequired(false), tupleDef("destinations", createCollectionAppendersDef()) ); }
--- a/stress-tester/src/main/java/com/passus/st/source/EventSourceNodeDefCreator.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/source/EventSourceNodeDefCreator.java Wed May 20 09:45:26 2020 +0200 @@ -8,6 +8,7 @@ import com.passus.st.utils.PeriodValueTransformer; import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.st.config.CommonNodeDefs.INT_GREATER_THAN_ZERO_DEF; public class EventSourceNodeDefCreator implements NodeDefinitionCreator { @@ -40,7 +41,7 @@ )).setRequired(false),*/ tupleDef("buffer", mapDef( tupleDef("delayTime", valueDefInteger().setTransformer(PeriodValueTransformer.INSTANCE)).setRequired(false), - tupleDef("maxSize", valueDefInteger()).setRequired(false) + tupleDef("maxSize", INT_GREATER_THAN_ZERO_DEF).setRequired(false) )).setRequired(false), tupleDef("sources", createEventSourcesListDef(true)) );
--- a/stress-tester/src/main/java/com/passus/st/source/NcEventSource.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/source/NcEventSource.java Wed May 20 09:45:26 2020 +0200 @@ -9,7 +9,6 @@ import com.passus.config.annotations.NodeDefinitionCreate; import com.passus.config.schema.NodeDefinition; import com.passus.config.schema.NodeDefinitionCreator; -import com.passus.config.validation.LongValidator; import com.passus.data.ByteBuff; import com.passus.data.ByteBuffAllocator; import com.passus.data.ByteBuffDataSource; @@ -30,8 +29,11 @@ import java.io.File; import java.io.IOException; -import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef; +import static com.passus.config.schema.ConfigurationSchemaBuilder.tupleDef; import static com.passus.st.Protocols.*; +import static com.passus.st.config.CommonNodeDefs.INT_GREATER_EQUAL_ZERO_DEF; +import static com.passus.st.config.CommonNodeDefs.STRING_DEF; /** * @author Mirosław Hawrot @@ -339,10 +341,8 @@ @Override public NodeDefinition create() { return mapDef( - tupleDef("fileName", valueDef()), - tupleDef("loops", - valueDefInteger().addValidator(LongValidator.GREATER_EQUAL_ZERO) - ).setRequired(false) + tupleDef("fileName", STRING_DEF), + tupleDef("loops", INT_GREATER_EQUAL_ZERO_DEF).setRequired(false) ); }
--- a/stress-tester/src/main/java/com/passus/st/source/PcapSessionEventSource.java Tue May 19 13:51:19 2020 +0200 +++ b/stress-tester/src/main/java/com/passus/st/source/PcapSessionEventSource.java Wed May 20 09:45:26 2020 +0200 @@ -13,7 +13,6 @@ import com.passus.config.schema.MapNodeDefinition; import com.passus.config.schema.NodeDefinition; import com.passus.config.schema.NodeDefinitionCreator; -import com.passus.config.validation.LongValidator; import com.passus.net.Frame; import com.passus.net.MemoryFrame; import com.passus.net.dns.session.DnsUdpSessionAnalyzer; @@ -41,6 +40,7 @@ import java.util.*; import static com.passus.config.schema.ConfigurationSchemaBuilder.*; +import static com.passus.st.config.CommonNodeDefs.*; /** * @author Mirosław Hawrot @@ -518,17 +518,19 @@ pf.add("mysql", MySqlTcpSessionAnalyzer.class); MapNodeDefinition sessionProcDef = mapDef( - tupleDef("tcp", mapDef( - tupleDef("allowPartialSession", valueDefBool().setRequired(false)) - )).setRequired(false) + tupleDef("tcp", + mapDef( + tupleDef("allowPartialSession", BOOLEAN_DEF).setRequired(false) + ) + ).setRequired(false) ); return mapDef( - tupleDef("fileName", valueDef()), - tupleDef("loops", valueDefInteger().addValidator(LongValidator.GREATER_EQUAL_ZERO)), - tupleDef("loopDelay", valueDefLong().addValidator(LongValidator.GREATER_EQUAL_ZERO)).setRequired(false), + tupleDef("fileName", STRING_DEF), + tupleDef("loops", INT_GREATER_EQUAL_ZERO_DEF), + tupleDef("loopDelay", LONG_GREATER_EQUAL_ZERO_DEF).setRequired(false), tupleDef("sessionProc", sessionProcDef).setRequired(false), - tupleDef("collectMetrics", valueDefBool()).setRequired(false), + tupleDef("collectMetrics", BOOLEAN_DEF).setRequired(false), tupleDef("analyzers", dynaKeyValueVaryListDef("type", pf).setTransformToPluginObject(true) ).setRequired(false)