changeset 920:3a90f274cd0d

Transformers minor changes
author Devel 2
date Thu, 26 Apr 2018 12:43:47 +0200
parents 25b3d4568893
children 5c94b8f2dc4b
files stress-tester/src/main/java/com/passus/st/filter/Transformers.java
diffstat 1 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/filter/Transformers.java	Thu Apr 26 11:29:43 2018 +0200
+++ b/stress-tester/src/main/java/com/passus/st/filter/Transformers.java	Thu Apr 26 12:43:47 2018 +0200
@@ -12,12 +12,12 @@
 import com.passus.lookup.filter.LookupValueExtractorTransformer;
 import com.passus.st.utils.ConfigurationContextConsts;
 import com.passus.st.vars.VarsExtractorResolver;
+
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
 /**
- *
  * @author mikolaj.podbielski
  */
 public class Transformers {
@@ -33,6 +33,10 @@
     public static final LookupHelper LOOKUP_HELPER = new LookupHelper(VALUE_EXTRACTOR_PARSER);
 
     public static ExpressionNodeTransformer expressionNodeTransformer(ConfigurationContext context) {
+        if(context == null) {
+            return Transformers.EXPRESSION;
+        }
+
         Map<String, ValueExtractor> vars = (Map<String, ValueExtractor>) context.get(ConfigurationContextConsts.APP_VARS);
         if (vars != null && !vars.isEmpty()) {
             VarsExtractorResolver varsResolver = new VarsExtractorResolver(vars);
@@ -44,12 +48,24 @@
     }
 
     public static LookupValueExtractorTransformer lookupValueTransformer(ConfigurationContext context) {
-        List<Lookup> lookups = context.get(ConfigurationContextConsts.LOOKUPS, Collections.EMPTY_LIST);
+        List<Lookup> lookups;
+        if (context == null) {
+            lookups = Collections.EMPTY_LIST;
+        } else {
+            lookups = context.get(ConfigurationContextConsts.LOOKUPS, Collections.EMPTY_LIST);
+        }
+
         return new LookupValueExtractorTransformer(lookups, LOOKUP_HELPER);
     }
 
     public static LookupKeyExistsLeftOperatorTransformer lookupKeyExistsTransformer(ConfigurationContext context) {
-        List<Lookup> lookups = context.get(ConfigurationContextConsts.LOOKUPS, Collections.EMPTY_LIST);
+        List<Lookup> lookups;
+        if (context == null) {
+            lookups = Collections.EMPTY_LIST;
+        } else {
+            lookups = context.get(ConfigurationContextConsts.LOOKUPS, Collections.EMPTY_LIST);
+        }
+
         return new LookupKeyExistsLeftOperatorTransformer(lookups, LOOKUP_HELPER);
     }