Exemple #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));
  }
Exemple #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);
  }
Exemple #3
0
 @Override
 protected void after() {
   try {
     KAFKA.stop();
   } catch (IOException ignored) {
   }
 }
Exemple #4
0
 @Override
 protected void before() throws Exception {
   KAFKA.start();
   KAFKA.createTopic(TOPIC, TOPIC_PART);
 }