działajaca aplikacja
This commit is contained in:
1 parent
205e653319
commit
52aa251534
5 files changed
+125
-3
No files matched your search
@@ -4,18 +4,24 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import kafka.server.KafkaServer;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.kafka.test.context.EmbeddedKafka;
|
||||
import org.springframework.kafka.test.rule.KafkaEmbedded;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@DirtiesContext
|
||||
public class SpringKafkaApplicationTest {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SpringKafkaApplicationTest.class);
|
||||
private static String BOOT_TOPIC = "boot.t";
|
||||
|
||||
@Autowired
|
||||
@@ -25,8 +31,8 @@ public class SpringKafkaApplicationTest {
|
||||
private Consumer receiver;
|
||||
|
||||
@ClassRule
|
||||
public static KafkaEmbedded embeddedKafka = new KafkaEmbedded(1, true, BOOT_TOPIC);
|
||||
|
||||
public static KafkaEmbedded embeddedKafka =
|
||||
new KafkaEmbedded(1, true, BOOT_TOPIC);
|
||||
@Test
|
||||
public void testReceive() throws Exception {
|
||||
sender.send(BOOT_TOPIC, "Hello Boot!");
|
||||
|
||||
Reference in new issue
Block a user