
io.amient.affinity.kafka.EmbeddedService.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of test-util-kafka_2.1-scala_2.12 Show documentation
Show all versions of test-util-kafka_2.1-scala_2.12 Show documentation
Library for building fast, scalable, fault-tolerant Data APIs based on Akka, ZooKeeper and Kafka.
The newest version!
package io.amient.affinity.kafka
import java.io.{Closeable, File}
import java.nio.file.Files
private[kafka] trait EmbeddedService extends Closeable {
val testDir: File = Files.createTempDirectory(this.getClass.getSimpleName).toFile
testDir.mkdirs()
override def close(): Unit = {
def deleteDirectory(f: File): Unit = if (f.exists) {
if (f.isDirectory) f.listFiles.foreach(deleteDirectory)
if (!f.delete) throw new RuntimeException(s"Failed to delete ${f.getAbsolutePath}")
}
deleteDirectory(testDir)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy