changeset 942:96f3c8ba4b4d

bugfixes
author Devel 2
date Wed, 19 Sep 2018 08:26:50 +0200
parents b6f72cdcac16
children ad881e214d8d
files stress-tester/src/main/java/com/passus/st/ReaderMain.java stress-tester/src/main/java/com/passus/st/StatsMain.java stress-tester/src/main/java/com/passus/st/reader/nc/HttpSessionPayloadEventDataReader.java stress-tester/src/main/java/com/passus/st/reader/nc/NcDataBlockReader.java stress-tester/src/main/java/com/passus/st/reader/nc/NcDataHelper.java stress-tester/src/main/java/com/passus/st/source/NcEventSource.java stress-tester/src/main/java/com/passus/st/vars/VarsUtils.java stress-tester/src/test/java/com/passus/st/filter/HttpMessageValueExtractorTest.java stress-tester/src/test/java/com/passus/st/reader/nc/NcDataHelperTest.java stress-tester/src/test/java/com/passus/st/reader/nc/option/DefaultValueCoderTest.java stress-tester/src/test/java/com/passus/st/reader/nc/option/VarOptionCoderTest.java stress-tester/src/test/java/com/passus/st/source/NcEventSourceTest.java
diffstat 12 files changed, 30 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/ReaderMain.java	Fri Jun 15 13:27:17 2018 +0200
+++ b/stress-tester/src/main/java/com/passus/st/ReaderMain.java	Wed Sep 19 08:26:50 2018 +0200
@@ -1,7 +1,7 @@
 package com.passus.st;
 
 import com.passus.data.DataSourceUtils;
-import com.passus.data.PooledAllocator;
+import com.passus.data.PooledByteBuffAllocator;
 import com.passus.net.http.HttpMessageHelper;
 import com.passus.net.http.HttpRequest;
 import com.passus.net.http.HttpRequestEncoder;
@@ -174,7 +174,7 @@
 
     private void readNcFile(NcEventSource src, PrintStream ps) throws Exception {
         src.setParallel(false);
-        src.setAllocator(new PooledAllocator(64 * 1024, 100, 0));
+        src.setAllocator(new PooledByteBuffAllocator(64 * 1024, 100, 0));
         src.setHandler((event) -> printEvent(event, ps));
 
         try {
--- a/stress-tester/src/main/java/com/passus/st/StatsMain.java	Fri Jun 15 13:27:17 2018 +0200
+++ b/stress-tester/src/main/java/com/passus/st/StatsMain.java	Wed Sep 19 08:26:50 2018 +0200
@@ -4,7 +4,7 @@
 import com.passus.commons.metric.LongHistogramMetricImpl;
 import com.passus.data.ByteString;
 import com.passus.data.ByteStringImpl;
-import com.passus.data.PooledAllocator;
+import com.passus.data.PooledByteBuffAllocator;
 import static com.passus.net.http.HttpHeaders.CONTENT_ENCODING;
 import static com.passus.net.http.HttpHeaders.TRANSFER_ENCODING;
 import com.passus.net.http.HttpMessage;
@@ -114,7 +114,7 @@
 
     private void readNcFile(NcEventSource src) throws Exception {
         src.setParallel(false);
-        src.setAllocator(new PooledAllocator(64 * 1024, 100, 0));
+        src.setAllocator(new PooledByteBuffAllocator(64 * 1024, 100, 0));
         src.setHandler(this::stats);
 
         try {
--- a/stress-tester/src/main/java/com/passus/st/reader/nc/HttpSessionPayloadEventDataReader.java	Fri Jun 15 13:27:17 2018 +0200
+++ b/stress-tester/src/main/java/com/passus/st/reader/nc/HttpSessionPayloadEventDataReader.java	Wed Sep 19 08:26:50 2018 +0200
@@ -1,12 +1,7 @@
 package com.passus.st.reader.nc;
 
 import com.passus.commons.Assert;
-import com.passus.data.Allocator;
-import com.passus.data.ByteBuff;
-import com.passus.data.ByteBuffDataSource;
-import com.passus.data.ByteString;
-import com.passus.data.DataSource;
-import com.passus.data.DefaultAllocator;
+import com.passus.data.*;
 import com.passus.net.http.HttpCachedHeadersImpl;
 import com.passus.net.http.HttpConsts;
 import com.passus.net.http.HttpHeaders;
@@ -32,13 +27,13 @@
 
     private final NcDataHelper ncDataHelper = NcDataHelper.getInstance();
 
-    private Allocator allocator = new DefaultAllocator();
+    private ByteBuffAllocator allocator = new DefaultByteBuffAllocator();
 
-    public Allocator getAllocator() {
+    public ByteBuffAllocator getAllocator() {
         return allocator;
     }
 
-    public void setAllocator(Allocator allocator) {
+    public void setAllocator(ByteBuffAllocator allocator) {
         Assert.notNull(allocator, "allocator");
         this.allocator = allocator;
     }
--- a/stress-tester/src/main/java/com/passus/st/reader/nc/NcDataBlockReader.java	Fri Jun 15 13:27:17 2018 +0200
+++ b/stress-tester/src/main/java/com/passus/st/reader/nc/NcDataBlockReader.java	Wed Sep 19 08:26:50 2018 +0200
@@ -1,9 +1,9 @@
 package com.passus.st.reader.nc;
 
 import com.passus.commons.Assert;
-import com.passus.data.Allocator;
 import com.passus.data.ByteBuff;
-import com.passus.data.DefaultAllocator;
+import com.passus.data.ByteBuffAllocator;
+import com.passus.data.DefaultByteBuffAllocator;
 import com.passus.data.HeapByteBuff;
 import com.passus.net.IpAddress;
 import com.passus.net.session.SessionBean;
@@ -13,13 +13,14 @@
 import com.passus.st.reader.nc.option.Option;
 import com.passus.st.reader.nc.option.Options;
 import com.passus.st.reader.nc.option.ValueCoder;
+
 import java.io.File;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.channels.FileChannel;
+import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.nio.file.Files;
 import java.nio.file.StandardOpenOption;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -27,7 +28,6 @@
 import java.util.Map;
 
 /**
- *
  * @author Mirosław Hawrot
  */
 public class NcDataBlockReader implements DataBlockReader<NcDataBlock> {
@@ -57,7 +57,7 @@
 
     private boolean eof = false;
 
-    private Allocator allocator = new DefaultAllocator();
+    private ByteBuffAllocator allocator = new DefaultByteBuffAllocator();
 
     private final Map<Integer, SessionInfo> sessionIdMap = new HashMap<>();
 
@@ -76,11 +76,11 @@
         this.path = path;
     }
 
-    public Allocator getAllocator() {
+    public ByteBuffAllocator getAllocator() {
         return allocator;
     }
 
-    public void setAllocator(Allocator allocator) {
+    public void setAllocator(ByteBuffAllocator allocator) {
         Assert.notNull(allocator, "allocator");
         this.allocator = allocator;
     }
--- a/stress-tester/src/main/java/com/passus/st/reader/nc/NcDataHelper.java	Fri Jun 15 13:27:17 2018 +0200
+++ b/stress-tester/src/main/java/com/passus/st/reader/nc/NcDataHelper.java	Wed Sep 19 08:26:50 2018 +0200
@@ -1,6 +1,6 @@
 package com.passus.st.reader.nc;
 
-import com.passus.commons.AsciiUtils;
+import com.passus.commons.utils.AsciiUtils;
 import com.passus.data.ByteBuff;
 import com.passus.data.ByteBuffUtils;
 import com.passus.data.ByteString;
--- a/stress-tester/src/main/java/com/passus/st/source/NcEventSource.java	Fri Jun 15 13:27:17 2018 +0200
+++ b/stress-tester/src/main/java/com/passus/st/source/NcEventSource.java	Wed Sep 19 08:26:50 2018 +0200
@@ -10,10 +10,7 @@
 import com.passus.config.schema.NodeDefinition;
 import com.passus.config.schema.NodeDefinitionCreator;
 import com.passus.config.validation.LongValidator;
-import com.passus.data.Allocator;
-import com.passus.data.ByteBuff;
-import com.passus.data.ByteBuffDataSource;
-import com.passus.data.DefaultAllocator;
+import com.passus.data.*;
 import com.passus.st.client.DataEvents;
 import com.passus.st.client.DataEvents.DataEnd;
 import com.passus.st.client.DataEvents.DataLoopEnd;
@@ -62,7 +59,7 @@
 
     private boolean parallel = true;
 
-    private Allocator allocator = new DefaultAllocator();
+    private ByteBuffAllocator allocator = new DefaultByteBuffAllocator();
 
     private int loops = 1;
 
@@ -100,11 +97,11 @@
         this.ncFile = ncFile;
     }
 
-    public Allocator getAllocator() {
+    public ByteBuffAllocator getAllocator() {
         return allocator;
     }
 
-    public void setAllocator(Allocator allocator) {
+    public void setAllocator(ByteBuffAllocator allocator) {
         Assert.notNull(allocator, "allocator");
         this.allocator = allocator;
     }
--- a/stress-tester/src/main/java/com/passus/st/vars/VarsUtils.java	Fri Jun 15 13:27:17 2018 +0200
+++ b/stress-tester/src/main/java/com/passus/st/vars/VarsUtils.java	Wed Sep 19 08:26:50 2018 +0200
@@ -1,8 +1,6 @@
 package com.passus.st.vars;
 
-import com.passus.commons.AsciiUtils;
-import com.passus.data.ByteString;
-import com.passus.data.ByteStringImpl;
+import com.passus.commons.utils.AsciiUtils;
 
 /**
  *
--- a/stress-tester/src/test/java/com/passus/st/filter/HttpMessageValueExtractorTest.java	Fri Jun 15 13:27:17 2018 +0200
+++ b/stress-tester/src/test/java/com/passus/st/filter/HttpMessageValueExtractorTest.java	Wed Sep 19 08:26:50 2018 +0200
@@ -98,6 +98,7 @@
                 {"scopes", HttpScopes.class},
                 {"scopes.global", ParametersBag.class},
                 {"scopes.global.get('GlobalVar1')", "GlobalVal1"},
+                {"scopes.getSession('sessId').get('Var1')", "Val1"},
                 {"globalParams", ParametersBag.class},
                 {"globalParams.get('GlobalVar1')", "GlobalVal1"},
                 {"globalParams@GlobalVar1", "GlobalVal1"},
--- a/stress-tester/src/test/java/com/passus/st/reader/nc/NcDataHelperTest.java	Fri Jun 15 13:27:17 2018 +0200
+++ b/stress-tester/src/test/java/com/passus/st/reader/nc/NcDataHelperTest.java	Wed Sep 19 08:26:50 2018 +0200
@@ -1,6 +1,6 @@
 package com.passus.st.reader.nc;
 
-import com.passus.commons.AsciiUtils;
+import com.passus.commons.utils.AsciiUtils;
 import com.passus.data.ByteBuff;
 import com.passus.data.ByteString;
 import com.passus.data.HeapByteBuff;
--- a/stress-tester/src/test/java/com/passus/st/reader/nc/option/DefaultValueCoderTest.java	Fri Jun 15 13:27:17 2018 +0200
+++ b/stress-tester/src/test/java/com/passus/st/reader/nc/option/DefaultValueCoderTest.java	Wed Sep 19 08:26:50 2018 +0200
@@ -1,13 +1,14 @@
 package com.passus.st.reader.nc.option;
 
-import com.passus.commons.AsciiUtils;
+import com.passus.commons.utils.AsciiUtils;
 import com.passus.data.ByteStringImpl;
 import com.passus.data.HeapByteBuff;
-import static org.testng.AssertJUnit.*;
 import org.testng.annotations.Test;
 
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNull;
+
 /**
- *
  * @author mikolaj.podbielski
  */
 public class DefaultValueCoderTest {
--- a/stress-tester/src/test/java/com/passus/st/reader/nc/option/VarOptionCoderTest.java	Fri Jun 15 13:27:17 2018 +0200
+++ b/stress-tester/src/test/java/com/passus/st/reader/nc/option/VarOptionCoderTest.java	Wed Sep 19 08:26:50 2018 +0200
@@ -1,6 +1,6 @@
 package com.passus.st.reader.nc.option;
 
-import com.passus.commons.AsciiUtils;
+import com.passus.commons.utils.AsciiUtils;
 import com.passus.data.HeapByteBuff;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.Test;
--- a/stress-tester/src/test/java/com/passus/st/source/NcEventSourceTest.java	Fri Jun 15 13:27:17 2018 +0200
+++ b/stress-tester/src/test/java/com/passus/st/source/NcEventSourceTest.java	Wed Sep 19 08:26:50 2018 +0200
@@ -1,7 +1,7 @@
 package com.passus.st.source;
 
 import static com.passus.commons.utils.ResourceUtils.createTmpFile;
-import com.passus.data.PooledAllocator;
+import com.passus.data.PooledByteBuffAllocator;
 import com.passus.st.client.ArrayListEventHandler;
 import com.passus.st.client.Event;
 import com.passus.st.utils.EventUtils;
@@ -66,7 +66,7 @@
     public void testRead_PooledAllocator() throws Exception {
         FileEvents fileEvents = writeEvents("pcap/http/http_req_resp.pcap");
         try {
-            PooledAllocator allocator = new PooledAllocator();
+            PooledByteBuffAllocator allocator = new PooledByteBuffAllocator();
             ArrayListEventHandler handler = new ArrayListEventHandler();
             NcEventSource eventSource = new NcEventSource(fileEvents.ncFile);
             eventSource.setAllocator(allocator);