Backport von Verbesserungen / Erweiterungen der Tests:
[demos/kafka/training] / src / test / java / de / juplo / kafka / ApplicationTests.java
index 8369a7b..1781b1d 100644 (file)
@@ -1,16 +1,13 @@
 package de.juplo.kafka;
 
-import org.apache.kafka.clients.consumer.ConsumerRecord;
 import org.apache.kafka.clients.producer.ProducerRecord;
 import org.apache.kafka.common.serialization.LongSerializer;
 import org.apache.kafka.common.serialization.StringSerializer;
 import org.apache.kafka.common.utils.Bytes;
 import org.springframework.boot.test.context.TestConfiguration;
 import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Primary;
 import org.springframework.test.context.ContextConfiguration;
 
-import java.util.Set;
 import java.util.function.Consumer;
 
 
@@ -36,12 +33,12 @@ public class ApplicationTests extends GenericApplicationTests<String, Long>
 
             for (int partition = 0; partition < 10; partition++)
             {
-              for (int key = 0; key < 10; key++)
+              for (int key = 0; key < 10000; key++)
               {
                 i++;
 
                 Bytes value = new Bytes(longSerializer.serialize(TOPIC, (long)i));
-                if (i == 77)
+                if (i == 99977)
                 {
                   if (logicErrors)
                   {
@@ -73,9 +70,8 @@ public class ApplicationTests extends GenericApplicationTests<String, Long>
   @TestConfiguration
   public static class Configuration
   {
-    @Primary
     @Bean
-    public Consumer<ConsumerRecord<String, Long>> consumer()
+    public RecordHandler<String, Long> recordHandler()
     {
       return (record) ->
       {