예제 #1
0
  @Test
  public void shouldCreateTopic() {
    ZkClient zkClient = KafkaUtils.createZkClient(KAFKA.getZkConnectString());

    assertThat(KAFKA.isTopicAvailable(TOPIC), is(true));
    checkLists(Lists.newArrayList(TOPIC), KafkaUtils.listTopics(zkClient));
    assertThat(KafkaUtils.listPartitions(zkClient, TOPIC).size(), is(TOPIC_PART));
  }
예제 #2
0
  @Test
  public void shouldSendAndReceiveLogs() throws InterruptedException {
    List<SimplifiedLog> expected = createTestData();
    KAFKA.produce(expected, TOPIC);

    List<SimplifiedLog> retrieved = KAFKA.consume(TOPIC, TOPIC_PART, (MSG_AMOUNT / TOPIC_PART));

    checkLists(expected, retrieved);
  }
예제 #3
0
 @Override
 protected void after() {
   try {
     KAFKA.stop();
   } catch (IOException ignored) {
   }
 }
예제 #4
0
 @Override
 protected void before() throws Exception {
   KAFKA.start();
   KAFKA.createTopic(TOPIC, TOPIC_PART);
 }