changeset 648:4434d61d41b4

HttpMarkFilter bugfixes
author Devel 2
date Thu, 09 Nov 2017 11:57:11 +0100
parents a60392f31cf0
children e261ef91ed51
files stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMarkFilter.java
diffstat 1 files changed, 20 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMarkFilter.java	Thu Nov 09 11:40:26 2017 +0100
+++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMarkFilter.java	Thu Nov 09 11:57:11 2017 +0100
@@ -7,6 +7,7 @@
 import com.passus.config.CTupleNode;
 import com.passus.config.CValueNode;
 import com.passus.config.Configuration;
+import com.passus.config.ConfigurationContext;
 import com.passus.config.ConfigurationUtils;
 import com.passus.config.annotations.NodeDefinitionCreate;
 import static com.passus.config.schema.ConfigurationSchemaBuilder.listDef;
@@ -179,9 +180,9 @@
         private static final PredicateNodeTransformer PREDICATE_TRANS = Transformers.PREDICATE;
 
         @Override
-        public CNode transform(CNode node, Errors errors) {
+        public CNode transform(CNode node, Errors errors, ConfigurationContext context) {
             CMapNode mapNode = (CMapNode) node;
-            MarkerRule rule = null;
+
             List<CTupleNode> tuples = mapNode.getChildren();
             if (tuples.isEmpty()) {
                 return new CValueNode(null);
@@ -194,37 +195,31 @@
             for (CTupleNode tuple : tuples) {
                 String opName = tuple.getName();
                 try {
-                    errors.pushNestedPath(opName);
-                    try {
-                        switch (opName.toLowerCase()) {
-                            case "category":
-                                category = ConfigurationUtils.extractString(tuple);
-                                break;
-                            case "message":
-                                message = ConfigurationUtils.extractString(tuple);
-                                break;
-                            case "applyif":
-                                Predicate predicate = PREDICATE_TRANS.transform(tuple.getNode());
-                                applyIf = new HttpMessagePredicate(predicate);
-                                break;
-                            default:
-                                throw new IllegalArgumentException("Unknwon parameter '" + opName + "'.");
-                        }
-                    } catch (Exception ex) {
-                        throw new IllegalArgumentException(ex.getMessage(), ex);
+                    switch (opName.toLowerCase()) {
+                        case "category":
+                            category = ConfigurationUtils.extractString(tuple);
+                            break;
+                        case "message":
+                            message = ConfigurationUtils.extractString(tuple);
+                            break;
+                        case "applyif":
+                            Predicate predicate = PREDICATE_TRANS.transform(tuple.getNode());
+                            applyIf = new HttpMessagePredicate(predicate);
+                            break;
+                        default:
+                            throw new IllegalArgumentException("Unknwon parameter '" + opName + "'.");
                     }
-
-                } finally {
-                    errors.popNestedPath();
+                } catch (Exception ex) {
+                    throw new IllegalArgumentException(ex.getMessage(), ex);
                 }
             }
 
-            rule = new MarkerRule(category, applyIf, message);
+            MarkerRule rule = new MarkerRule(category, applyIf, message);
             return new CValueNode(rule);
         }
 
         @Override
-        public CNode reverseTransform(CNode node, Errors errors) {
+        public CNode reverseTransform(CNode node, Errors errors, ConfigurationContext context) {
             throw new UnsupportedOperationException("Not supported yet.");
         }