|
|
package com.yoho.ops.kafka;
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
@RunWith(SpringRunner.class)
|
|
|
@SpringBootTest
|
|
|
public class SpringKafkaApplicationTests {
|
|
|
|
|
|
@Autowired
|
|
|
private Sender sender;
|
|
|
|
|
|
@Autowired
|
|
|
private Receiver receiver;
|
|
|
|
|
|
@Test
|
|
|
public void testReceive() throws Exception {
|
|
|
sender.send("helloworld.t", "Hello Spring Kafka!");
|
|
|
|
|
|
Thread.sleep(100000);
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |