From 53ecbc5e02e077692232d45ea62d236e1ec3abfb Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 2 Mar 2024 10:15:11 +0100 Subject: [PATCH] WIP --- .../de/juplo/kafka/chat/backend/AbstractHandoverIT.java | 8 ++++++-- .../java/de/juplo/kafka/chat/backend/TestListener.java | 8 +++++--- src/test/java/de/juplo/kafka/chat/backend/TestWriter.java | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/test/java/de/juplo/kafka/chat/backend/AbstractHandoverIT.java b/src/test/java/de/juplo/kafka/chat/backend/AbstractHandoverIT.java index 87b17705..bbb2fbb5 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/AbstractHandoverIT.java +++ b/src/test/java/de/juplo/kafka/chat/backend/AbstractHandoverIT.java @@ -61,16 +61,20 @@ public abstract class AbstractHandoverIT .run() .toFuture(); - log.info("Sleepint for 3 seconds..."); + log.info("Sleeping for 3 seconds..."); Thread.sleep(3000); for (int i = 0; i < NUM_CLIENTS; i++) { testWriters[i].running = false; testWriterFutures[i].join(); - log.info("Joined TestWriter {}", testWriters[i]); + log.info("Joined TestWriter {}", testWriters[i].user); } + + log.info("Sleeping for 3 seconds..."); + Thread.sleep(3000); + log.info("Joining TestListener..."); testListener.running = false; testListenerFuture.join(); log.info("Joined TestListener"); diff --git a/src/test/java/de/juplo/kafka/chat/backend/TestListener.java b/src/test/java/de/juplo/kafka/chat/backend/TestListener.java index 3f282eef..e413c52d 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/TestListener.java +++ b/src/test/java/de/juplo/kafka/chat/backend/TestListener.java @@ -29,6 +29,7 @@ public class TestListener .fromArray(chatRooms) .flatMap(chatRoom -> { + log.info("Requesting messages from chat-room {}", chatRoom); List list = new LinkedList<>(); receivedMessages.put(chatRoom.getId(), list); return receiveMessages(chatRoom) @@ -48,14 +49,15 @@ public class TestListener list.add(message); log.info( "Received a message from chat-room {}: {}", - chatRoom, + chatRoom.getName(), message); }) - .take(30); + .take(10); }) + .take(100) .takeUntil(message -> !running) .doOnComplete(() -> log.info("TestListener is done")) - .parallel() + .parallel(chatRooms.length) .runOn(Schedulers.parallel()) .then(); } diff --git a/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java b/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java index ab3713cb..8f7bc816 100644 --- a/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java +++ b/src/test/java/de/juplo/kafka/chat/backend/TestWriter.java @@ -65,7 +65,7 @@ public class TestWriter }) .takeUntil(message -> !running) .doOnComplete(() -> log.info("TestWriter {} is done", user)) - .parallel() + .parallel(1) .runOn(Schedulers.parallel()) .then(); } -- 2.20.1