changeset 1229:38535d18ed51

HttpTrafficDumperFilter.tag
author Devel 2
date Fri, 26 Jun 2020 08:32:57 +0200
parents ea1994acc93c
children 1006020f834f
files stress-tester/src/main/java/com/passus/st/client/http/filter/HttpTrafficDumperFilter.java
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpTrafficDumperFilter.java	Thu Jun 25 14:41:51 2020 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpTrafficDumperFilter.java	Fri Jun 26 08:32:57 2020 +0200
@@ -54,6 +54,8 @@
 
     private boolean append = false;
 
+    private String tag;
+
     @Override
     public FlowFilter instanceForWorker(int index) {
         return this;
@@ -63,6 +65,7 @@
     public void configure(Configuration config, ConfigurationContext context) {
         fileName = config.getString("fileName");
         append = config.getBoolean("append", false);
+        tag = config.getString("tag", null);
     }
 
     private void writeHeaders() throws IOException {
@@ -92,12 +95,16 @@
         writeString("sessionId");
         writeString("username");
         csvHelper.write("loop", writer);
+        if (tag != null) {
+            csvHelper.writeDelimiter(writer);
+            csvHelper.write("tag", writer);
+        }
         csvHelper.write("\n", writer);
     }
 
     private void createWriter(String name) throws IOException {
         file = new File(name);
-        if (file.exists() && !append) {
+        if (!append && file.exists()) {
             file.delete();
         }
 
@@ -235,6 +242,11 @@
                 }
 
                 csvHelper.write(context.loop(), writer);
+                if (tag != null) {
+                    csvHelper.writeDelimiter(writer);
+                    csvHelper.write(tag, writer);
+                }
+
                 csvHelper.write("\n", writer);
                 writer.flush();
             }
@@ -251,7 +263,8 @@
         public NodeDefinition create() {
             return mapDef(
                     tupleDef("fileName", valueDef().setTransformer(new FileTransformer(true))),
-                    tupleDef("append", BOOLEAN_DEF).setRequired(false)
+                    tupleDef("append", BOOLEAN_DEF).setRequired(false),
+                    tupleDef("tag", STRING_DEF).setRequired(false)
             );
         }