changeset 895:ae83d4c096cd

ST-120
author Devel 1
date Mon, 09 Apr 2018 11:25:46 +0200
parents 426752705914
children c14897e6021d
files stress-tester/src/main/java/com/passus/st/client/http/filter/HttpSequenceFilter.java stress-tester/src/main/java/com/passus/st/config/TestJobConfigurator.java stress-tester/src/main/java/com/passus/st/source/PcapSessionEventSource.java
diffstat 3 files changed, 14 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpSequenceFilter.java	Fri Mar 30 15:09:19 2018 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpSequenceFilter.java	Mon Apr 09 11:25:46 2018 +0200
@@ -186,22 +186,6 @@
                 curItem.setNext(nexItem);
                 curItem = nexItem;
             }
-
-//            if (isMarkFlow()) {
-//                try {
-//                    if (getPipeline() == null) {
-//                        flowMarker = FlowMarker.create();
-//                    } else {
-//                        flowMarker = FlowMarker.create(getPipeline().getFlowId());
-//                    }
-//
-//                    value.addFlowMarker(flowMarker);
-//                } catch (Throwable e) {
-//                    if (LOGGER.isDebugEnabled()) {
-//                        LOGGER.debug(e.getMessage(), e);
-//                    }
-//                }
-//            }
         }
 
         public void updateValue(HttpMessageWrapper wrapper) {
@@ -296,10 +280,6 @@
                         if (!chain.seqItem.seq.mustOccur) {
                             iterator.remove();
                         } else {
-//                            if (chain.flowMarker != null) {
-//                                value.addFlowMarker(chain.flowMarker);
-//                            }
-
                             chain.persistsValue(value, chain.seqItem.seq.getAliases());
                             if (!chain.hasNext()) {
                                 fireEvent(chain);
@@ -314,7 +294,6 @@
             }
         }
 
-        // TODO: refactor
         final Map<String, Object> valueMap = new HashMap<>();
         valueMap.put("req", value.getReq());
         valueMap.put("resp", value.getResp());
@@ -322,9 +301,6 @@
         if (seqItems[0].match(valueMap)) {
             SeqChain chain = new SeqChain(seqItems, now, valueMap);
             chain.persistsValue(value, seqItems[0].getAliases());
-//            if (chain.flowMarker != null) {
-//                value.addFlowMarker(chain.flowMarker);
-//            }
             chains.add(chain);
         }
     }
@@ -374,7 +350,6 @@
         List<SequenceItem> itemsList = (List<SequenceItem>) config.get("sequence");
         seqItems = itemsList.toArray(new SequenceItem[itemsList.size()]);
         for (int i = 0; i < seqItems.length; ++i) {
-            //TODO: refactor
             seqItems[i].setNum(i);
         }
 
--- a/stress-tester/src/main/java/com/passus/st/config/TestJobConfigurator.java	Fri Mar 30 15:09:19 2018 +0200
+++ b/stress-tester/src/main/java/com/passus/st/config/TestJobConfigurator.java	Mon Apr 09 11:25:46 2018 +0200
@@ -108,11 +108,10 @@
 
                 Configuration subConfig = config.subConfiguration(keyName);
                 DomainConfigurator configurator = entry.getValue();
-                // TODO: enable validation
-//                configurator.validate(config, errors, context);
-//                if (errors.hasError()) {
-//                    break;
-//                }
+                configurator.validate(subConfig, errors, context);
+                if (errors.hasError()) {
+                    break;
+                }
                 configurator.configure(subConfig, errors, context);
                 if (errors.hasError()) {
                     break;
--- a/stress-tester/src/main/java/com/passus/st/source/PcapSessionEventSource.java	Fri Mar 30 15:09:19 2018 +0200
+++ b/stress-tester/src/main/java/com/passus/st/source/PcapSessionEventSource.java	Mon Apr 09 11:25:46 2018 +0200
@@ -49,6 +49,7 @@
 import java.util.concurrent.TimeUnit;
 
 import static com.passus.config.schema.ConfigurationSchemaBuilder.*;
+import com.passus.config.schema.MapNodeDefinition;
 import static com.passus.net.session.TcpSessionProcessorConstants.STATUS_CLOSE;
 import static com.passus.net.session.TcpSessionProcessorConstants.STATUS_ESTABLISHED;
 
@@ -637,10 +638,18 @@
 
         @Override
         public NodeDefinition create() {
+            MapNodeDefinition sessionProcDef = mapDef(
+                    tupleDef("tcp", mapDef(
+                            tupleDef("allowPartialSession", valueDefBool().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))
+                    tupleDef("loopDelay", valueDefLong().addValidator(LongValidator.GREATER_EQUAL_ZERO)),
+                    tupleDef("sessionProc", sessionProcDef.setRequired(false)),
+                    tupleDef("collectMetrics", valueDefBool()).setRequired(false)
             );
         }
     }