@Override public void stop() throws Exception { kafkaCluster.shutdown(); } }
@After public void afterEach() { cluster.shutdown(); Testing.Files.delete(dataDir); }
@After public void afterEach() { try { if (history != null) history.stop(); } finally { history = null; try { if (kafka != null) kafka.shutdown(); } finally { kafka = null; } } }
@Test @SkipLongRunning public void shouldStartClusterWithOneBrokerAndRemoveData() throws Exception { cluster.addBrokers(1).startup(); cluster.onEachDirectory(this::assertValidDataDirectory); cluster.shutdown(); cluster.onEachDirectory(this::assertDoesNotExist); }
@Test @SkipLongRunning public void shouldStartClusterWithMultipleBrokerAndRemoveData() throws Exception { cluster.addBrokers(3).startup(); cluster.onEachDirectory(this::assertValidDataDirectory); cluster.shutdown(); cluster.onEachDirectory(this::assertDoesNotExist); }
@Test @SkipLongRunning public void shouldStartClusterWithOneBrokerAndLeaveData() throws Exception { cluster.deleteDataUponShutdown(false).addBrokers(1).startup(); cluster.onEachDirectory(this::assertValidDataDirectory); cluster.shutdown(); cluster.onEachDirectory(this::assertValidDataDirectory); }
@Test @SkipLongRunning public void shouldStartClusterWithMultipleBrokerAndLeaveData() throws Exception { cluster.deleteDataUponShutdown(false).addBrokers(3).startup(); cluster.onEachDirectory(this::assertValidDataDirectory); cluster.shutdown(); cluster.onEachDirectory(this::assertValidDataDirectory); }
@AfterClass public static void tearDown() { if (kafkaCluster != null) { kafkaCluster.shutdown(); kafkaCluster = null; boolean delete = dataDir.delete(); // If files are still locked and a test fails: delete on exit to allow subsequent test execution if(!delete) { dataDir.deleteOnExit(); } } } }
@AfterClass public static void tearDown() { if (kafkaCluster != null) { kafkaCluster.shutdown(); kafkaCluster = null; boolean delete = dataDir.delete(); // If files are still locked and a test fails: delete on exit to allow subsequent test execution if(!delete) { dataDir.deleteOnExit(); } } } }