X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fde%2Fjuplo%2Fkafka%2FApplicationTests.java;h=1e730405e93d7f64f22ca1f8127e3ff3bff25e3a;hb=4bff99449827596fd62a16165da42225d5956804;hp=1272124cbe58981aeea2fd5483fd79b9bb53540a;hpb=27768041f2c2f4b1cbb8c45c9a5d665490050f76;p=demos%2Fkafka%2Ftraining diff --git a/src/test/java/de/juplo/kafka/ApplicationTests.java b/src/test/java/de/juplo/kafka/ApplicationTests.java index 1272124..1e73040 100644 --- a/src/test/java/de/juplo/kafka/ApplicationTests.java +++ b/src/test/java/de/juplo/kafka/ApplicationTests.java @@ -27,28 +27,30 @@ public class ApplicationTests extends GenericApplicationTests @Override - public void generate( - Set poisonPills, - Set logicErrors, + public int generate( + boolean poisonPills, + boolean logicErrors, Consumer> messageSender) { int i = 0; for (int partition = 0; partition < 10; partition++) { - for (int key = 0; key < 10; key++) + for (int key = 0; key < 10000; key++) { - if (++i > 100) - return; + i++; Bytes value = new Bytes(longSerializer.serialize(TOPIC, (long)i)); - if (logicErrors.contains(i)) + if (i == 99977) { - value = new Bytes(longSerializer.serialize(TOPIC, Long.MIN_VALUE)); - } - if (poisonPills.contains(i)) - { - value = new Bytes(stringSerializer.serialize(TOPIC, "BOOM (Poison-Pill)!")); + if (logicErrors) + { + value = new Bytes(longSerializer.serialize(TOPIC, Long.MIN_VALUE)); + } + if (poisonPills) + { + value = new Bytes(stringSerializer.serialize(TOPIC, "BOOM (Poison-Pill)!")); + } } ProducerRecord record = @@ -61,6 +63,8 @@ public class ApplicationTests extends GenericApplicationTests messageSender.accept(record); } } + + return i; } }); }