Mercurial > stress-tester
changeset 977:71d0f31b7e44
minor
author | Devel 2 |
---|---|
date | Thu, 25 Jul 2019 13:34:42 +0200 |
parents | aff81768741e |
children | d88ea87ac0a7 |
files | stress-tester/src/test/java/com/passus/st/client/netflow/FlowExecutorNetflowTest.java stress-tester/src/test/java/com/passus/st/utils/SimpleDatagramServer.java |
diffstat | 2 files changed, 25 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/test/java/com/passus/st/client/netflow/FlowExecutorNetflowTest.java Thu Jul 25 11:25:45 2019 +0200 +++ b/stress-tester/src/test/java/com/passus/st/client/netflow/FlowExecutorNetflowTest.java Thu Jul 25 13:34:42 2019 +0200 @@ -50,11 +50,7 @@ FlowExecutor flowExecutor = new FlowExecutor(); flowExecutor.setEmitter(emitter); flowExecutor.setConnectPartialSession(true); - flowExecutor.setWorkerType("parallel"); try { - flowExecutor.setListener((request, response, context) -> { - System.out.println(response); - }); flowExecutor.start(); events.forEach(flowExecutor::handle); flowExecutor.join();
--- a/stress-tester/src/test/java/com/passus/st/utils/SimpleDatagramServer.java Thu Jul 25 11:25:45 2019 +0200 +++ b/stress-tester/src/test/java/com/passus/st/utils/SimpleDatagramServer.java Thu Jul 25 13:34:42 2019 +0200 @@ -164,6 +164,10 @@ private List<T> received = new ArrayList<>(); + private long firstTimestamp = -1; + + private long lastTimestamp = -1; + private int errors = 0; private Exception lastException; @@ -172,6 +176,14 @@ return received; } + public long getFirstTimestamp() { + return firstTimestamp; + } + + public long getLastTimestamp() { + return lastTimestamp; + } + public int getErrors() { return errors; } @@ -180,9 +192,22 @@ return lastException; } + public void clear() { + received.clear(); + firstTimestamp = -1; + lastTimestamp = -1; + errors = 0; + } + @Override public void onDataReceived(T data) { + long now = System.currentTimeMillis(); + if (firstTimestamp == -1) { + firstTimestamp = now; + } + received.add(data); + lastTimestamp = now; } @Override