test: HandoverIT-POC - Refactored / Cleaned up
authorKai Moritz <kai@juplo.de>
Fri, 1 Mar 2024 13:02:01 +0000 (14:02 +0100)
committerKai Moritz <kai@juplo.de>
Fri, 22 Mar 2024 10:38:24 +0000 (11:38 +0100)
src/test/java/de/juplo/kafka/chat/backend/AbstractHandoverIT.java

index f6580ba..e1e7813 100644 (file)
@@ -16,7 +16,6 @@ import reactor.core.publisher.Mono;
 import java.util.Arrays;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import java.util.stream.IntStream;
 
 
 @Testcontainers
@@ -47,12 +46,14 @@ public abstract class AbstractHandoverIT
         .toStream()
         .toArray(size -> new ChatRoomInfoTo[size]);
 
+    int port = containers.haproxy.getMappedPort(8400);
+
     TestWriter[] testWriters = Flux
-        .fromStream(IntStream.range(0, NUM_CLIENTS).mapToObj(i -> "user-" + Integer.toString(i)))
+        .range(0, NUM_CLIENTS)
         .map(i -> new TestWriter(
-            containers.haproxy.getMappedPort(8400),
+            port,
             chatRooms,
-            i))
+            "user-" + Integer.toString(i)))
         .doOnNext(testClient -> executorService.execute(testClient))
         .toStream()
         .toArray(size -> new TestWriter[size]);