changeset 1206:813c5f012b4f

minor
author Devel 2
date Mon, 22 Jun 2020 14:13:57 +0200
parents e9de75b31683
children 7575fa5eac1c
files stress-tester/src/test/java/com/passus/st/HeadersGenerator.java stress-tester/src/test/java/com/passus/st/client/EventTest.java stress-tester/src/test/java/com/passus/st/client/netflow/FlowExecutorNetflowTest.java stress-tester/src/test/java/com/passus/st/config/TestJobConfigurator.java stress-tester/src/test/java/com/passus/st/reader/pcap/PcapDataBlockReaderTest.java stress-tester/src/test/java/com/passus/st/reader/pcapng/PcapNgReaderTest.java stress-tester/src/test/java/com/passus/st/scanner/FlowAnalyzerCommandTest.java stress-tester/src/test/java/com/passus/st/scanner/HttpUrlStatsMetricTest.java stress-tester/src/test/java/com/passus/st/utils/server/SimpleDatagramServer.java
diffstat 9 files changed, 15 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/test/java/com/passus/st/HeadersGenerator.java	Mon Jun 22 14:03:13 2020 +0200
+++ b/stress-tester/src/test/java/com/passus/st/HeadersGenerator.java	Mon Jun 22 14:13:57 2020 +0200
@@ -1,25 +1,19 @@
 package com.passus.st;
 
+import org.testng.annotations.Test;
+
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Iterator;
-import org.testng.annotations.Test;
 
 /**
- *
  * @author mikolaj.podbielski
  */
 public class HeadersGenerator {
 
     static Path PATH = Paths.get("src/test/resources/headers.txt");
 
-    public static void main(String[] args) throws Exception {
-        printHttpHeaders();
-        System.out.println("================");
-        printNcHttpDataUtils();
-    }
-
     static String id(String s) {
         return s.toUpperCase().replace('-', '_');
     }
--- a/stress-tester/src/test/java/com/passus/st/client/EventTest.java	Mon Jun 22 14:03:13 2020 +0200
+++ b/stress-tester/src/test/java/com/passus/st/client/EventTest.java	Mon Jun 22 14:13:57 2020 +0200
@@ -30,14 +30,6 @@
         }
     }
 
-    public static void main(String[] args) throws Exception {
-        Set<Class<?>> classes = find();
-        Map<Class, Integer> types = getEventTypes(classes);
-        for (Map.Entry<Class, Integer> e : types.entrySet()) {
-            System.out.println(e.getKey().getName() + " -> " + e.getValue());
-        }
-    }
-
     private static Map<Class, Integer> getEventTypes(Set<Class<?>> classes) throws Exception {
         Map<Class, Integer> types = new LinkedHashMap<>(classes.size());
         for (final Class<?> clazz : classes) {
--- a/stress-tester/src/test/java/com/passus/st/client/netflow/FlowExecutorNetflowTest.java	Mon Jun 22 14:03:13 2020 +0200
+++ b/stress-tester/src/test/java/com/passus/st/client/netflow/FlowExecutorNetflowTest.java	Mon Jun 22 14:13:57 2020 +0200
@@ -71,14 +71,4 @@
 
     }
 
-    @Test(enabled = false)
-    public void testHandle_Netflow2() throws Exception {
-        for (int i = 0; i < 1000; i++) {
-            if (i % 10 == 0) {
-                System.out.println(i);
-            }
-
-            testHandle_Netflow();
-        }
-    }
 }
--- a/stress-tester/src/test/java/com/passus/st/config/TestJobConfigurator.java	Mon Jun 22 14:03:13 2020 +0200
+++ b/stress-tester/src/test/java/com/passus/st/config/TestJobConfigurator.java	Mon Jun 22 14:13:57 2020 +0200
@@ -51,7 +51,7 @@
         JobConfigurator configurator = new JobConfigurator();
         ConfigurationContext context = new ConfigurationContextImpl(configFile.getParentFile());
         configurator.configure(config, errors, context);
-        System.out.println("Errors: " + errors.toString());
+
         assertFalse(errors.hasError());
         return context;
     }
--- a/stress-tester/src/test/java/com/passus/st/reader/pcap/PcapDataBlockReaderTest.java	Mon Jun 22 14:03:13 2020 +0200
+++ b/stress-tester/src/test/java/com/passus/st/reader/pcap/PcapDataBlockReaderTest.java	Mon Jun 22 14:13:57 2020 +0200
@@ -26,7 +26,7 @@
             String[] parts = fileName.split("[.]");
             String ext = parts[parts.length - 1].toLowerCase();
             boolean expected = ext.equals("pcap");
-            System.out.println(fileName);
+
             assertEquals(PcapDataBlockReader.isFileSupported(file), expected, fileName);
         }
     }
--- a/stress-tester/src/test/java/com/passus/st/reader/pcapng/PcapNgReaderTest.java	Mon Jun 22 14:03:13 2020 +0200
+++ b/stress-tester/src/test/java/com/passus/st/reader/pcapng/PcapNgReaderTest.java	Mon Jun 22 14:13:57 2020 +0200
@@ -30,7 +30,7 @@
             String[] parts = fileName.split("[.]");
             String ext = parts[parts.length - 1].toLowerCase();
             boolean expected = !ext.equals("pcap");
-            System.out.println(fileName);
+
             assertEquals(PcapNgReader.isFileSupported(file), expected, fileName);
         }
     }
--- a/stress-tester/src/test/java/com/passus/st/scanner/FlowAnalyzerCommandTest.java	Mon Jun 22 14:03:13 2020 +0200
+++ b/stress-tester/src/test/java/com/passus/st/scanner/FlowAnalyzerCommandTest.java	Mon Jun 22 14:13:57 2020 +0200
@@ -16,7 +16,7 @@
         File dir = TestResourceUtils.createTmpDir();
         File target = new File(dir, "script.py");
         target.deleteOnExit();
-        System.out.println("Extracting to " + target.getAbsolutePath());
+
         FlowAnalyzerCommand.extractEmbeddedScript(target);
         assertTrue(target.length() > 10240);
     }
--- a/stress-tester/src/test/java/com/passus/st/scanner/HttpUrlStatsMetricTest.java	Mon Jun 22 14:03:13 2020 +0200
+++ b/stress-tester/src/test/java/com/passus/st/scanner/HttpUrlStatsMetricTest.java	Mon Jun 22 14:13:57 2020 +0200
@@ -1,22 +1,19 @@
 package com.passus.st.scanner;
 
 import com.passus.st.utils.TestResourceUtils;
+import org.apache.commons.lang3.mutable.MutableInt;
+import org.testng.annotations.Test;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStreamReader;
 import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import org.apache.commons.lang3.mutable.MutableInt;
-import static org.testng.AssertJUnit.*;
-import org.testng.annotations.Test;
+import java.util.*;
+
+import static org.testng.AssertJUnit.assertEquals;
 
 /**
- *
  * @author mikolaj.podbielski
  */
 public class HttpUrlStatsMetricTest {
@@ -27,9 +24,9 @@
 
         File file = TestResourceUtils.getFile("com/passus/st/scanner/nginx.csv");
         try (FileInputStream fis = new FileInputStream(file);
-                InputStreamReader isr = new InputStreamReader(fis, StandardCharsets.UTF_8);
-                BufferedReader br = new BufferedReader(isr)) {
-            for (String line; (line = br.readLine()) != null;) {
+             InputStreamReader isr = new InputStreamReader(fis, StandardCharsets.UTF_8);
+             BufferedReader br = new BufferedReader(isr)) {
+            for (String line; (line = br.readLine()) != null; ) {
                 instance.addUrl(line);
             }
         }
@@ -60,7 +57,6 @@
         assertEquals(858, keysValues.get("clientid=production_au.client/2689116").intValue());
         assertEquals(854, keysValues.get("clientid=production_au.provider/3231350").intValue());
         assertEquals(102, keysValues.get("capability={\"*\":[\"*\"]}").intValue());
-        System.out.println("");
     }
 
     static int sumValues(HashMap<String, MutableInt> m) {
--- a/stress-tester/src/test/java/com/passus/st/utils/server/SimpleDatagramServer.java	Mon Jun 22 14:03:13 2020 +0200
+++ b/stress-tester/src/test/java/com/passus/st/utils/server/SimpleDatagramServer.java	Mon Jun 22 14:13:57 2020 +0200
@@ -27,7 +27,6 @@
             return;
         }
 
-        System.out.println("start() Thread: " + Thread.currentThread().getName());
         try {
             serverSocket = new DatagramSocket(port, InetAddress.getByName(host));
             logger.debug("Datagram socket created.");
@@ -45,7 +44,6 @@
             return;
         }
 
-        System.out.println("stop() Thread: " + Thread.currentThread().getName());
         try {
             serverSocket.close();
         } catch (Exception e) {