Packages

c

org.apache.pekko.kafka.testkit

TestcontainersKafkaTest

abstract class TestcontainersKafkaTest extends KafkaTest

JUnit 5 base class using Testcontainers to start a Kafka broker in a Docker container. The Kafka broker will be kept around across multiple test classes, unless stopKafka() is called (eg. from an @AfterAll-annotated method.

Extending classes must be annotated with @TestInstance(Lifecycle.PER_CLASS) to create a single instance of the test class with @BeforeAll and @AfterAll annotated methods called by the test framework.

The Testcontainers dependency has to be added explicitly.

Annotations
@SuppressWarnings()
Source
TestcontainersKafkaTest.java
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TestcontainersKafkaTest
  2. KafkaTest
  3. BaseKafkaTest
  4. KafkaTestKitClass
  5. KafkaTestKit
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. val DefaultKey: String
    Definition Classes
    KafkaTestKit
  2. val StringDeserializer: StringDeserializer
    Definition Classes
    KafkaTestKit
  3. val StringSerializer: StringSerializer
    Definition Classes
    KafkaTestKit
  4. def adminClient: Admin

    Access to the Kafka Admin client

    Access to the Kafka Admin client

    Definition Classes
    KafkaTestKit
  5. val bootstrapServers: String
    Definition Classes
    KafkaTestKitClassKafkaTestKit
  6. def checkForStageLeaks(): Unit
    Definition Classes
    KafkaTest
    Annotations
    @AfterEach()
  7. def cleanUpAdmin(): Unit
    Definition Classes
    KafkaTest
    Annotations
    @AfterAll()
  8. def cleanUpAdminClient(): Unit

    Close internal admin client instances.

    Close internal admin client instances.

    Definition Classes
    KafkaTestKit
  9. def committerDefaults: CommitterSettings
    Definition Classes
    KafkaTestKit
  10. def consumerDefaults[K, V](keyDeserializer: Deserializer[K], valueDeserializer: Deserializer[V]): ConsumerSettings[K, V]
    Definition Classes
    KafkaTestKit
  11. def consumerDefaults: ConsumerSettings[String, String]
    Definition Classes
    KafkaTestKit
  12. def createGroupId(suffix: Int): String

    Return a unique group id with a given suffix.

    Return a unique group id with a given suffix.

    Definition Classes
    KafkaTestKit
  13. def createGroupId(): String

    Return a unique group id with a default suffix.

    Return a unique group id with a default suffix.

    Definition Classes
    KafkaTestKit
  14. def createTopic(suffix: Int, partitions: Int, replication: Int, config: Map[String, String]): String

    Java Api

    Java Api

    Create a topic with given suffix, partition number, replication factor, and topic configuration.

    This method will block and return only when the topic has been successfully created.

    Definition Classes
    KafkaTestKit
  15. def createTopic(suffix: Int, partitions: Int, replication: Int, config: Map[String, String]): String

    Create a topic with given suffix, partition number, replication factor, and topic configuration.

    Create a topic with given suffix, partition number, replication factor, and topic configuration.

    This method will block and return only when the topic has been successfully created.

    Definition Classes
    KafkaTestKit
  16. def createTopic(suffix: Int, partitions: Int, replication: Int): String

    Create a topic with given suffix, partition number, replication factor, and no topic configuration.

    Create a topic with given suffix, partition number, replication factor, and no topic configuration.

    This method will block and return only when the topic has been successfully created.

    Definition Classes
    KafkaTestKit
  17. def createTopic(suffix: Int, partitions: Int): String

    Create a topic with a given suffix, partition number, a replication factor of one, and no topic configuration.

    Create a topic with a given suffix, partition number, a replication factor of one, and no topic configuration.

    This method will block and return only when the topic has been successfully created.

    Definition Classes
    KafkaTestKit
  18. def createTopic(suffix: Int): String

    Create a topic with a given suffix, single partitions, a replication factor of one, and no topic configuration.

    Create a topic with a given suffix, single partitions, a replication factor of one, and no topic configuration.

    This method will block and return only when the topic has been successfully created.

    Definition Classes
    KafkaTestKit
  19. def createTopic(): String

    Create a topic with a default suffix, single partition, a replication factor of one, and no topic configuration.

    Create a topic with a default suffix, single partition, a replication factor of one, and no topic configuration.

    This method will block and return only when the topic has been successfully created.

    Definition Classes
    KafkaTestKit
  20. def createTopicName(suffix: Int): String

    Return a unique topic name.

    Return a unique topic name.

    Definition Classes
    KafkaTestKit
  21. def createTransactionalId(suffix: Int): String

    Return a unique transactional id with a given suffix.

    Return a unique transactional id with a given suffix.

    Definition Classes
    KafkaTestKit
  22. def createTransactionalId(): String

    Return a unique transactional id with a default suffix.

    Return a unique transactional id with a default suffix.

    Definition Classes
    KafkaTestKit
  23. def log(): Logger
    Definition Classes
    BaseKafkaTestKafkaTestKit
    Annotations
    @Override()
  24. def producerDefaults[K, V](keySerializer: Serializer[K], valueSerializer: Serializer[V]): ProducerSettings[K, V]
    Definition Classes
    KafkaTestKit
  25. def producerDefaults: ProducerSettings[String, String]
    Definition Classes
    KafkaTestKit
  26. def setUpAdminClient(): Unit

    Create internal admin clients.

    Create internal admin clients. Gives access to adminClient, be sure to call cleanUpAdminClient after the tests are done.

    Definition Classes
    KafkaTestKit
  27. val settings: KafkaTestkitSettings
    Definition Classes
    KafkaTestKit
  28. def setupAdmin(): Unit
    Definition Classes
    KafkaTest
    Annotations
    @BeforeAll()
  29. def sleepMillis(ms: Long, msg: String): Unit
    Definition Classes
    KafkaTestKit
  30. def sleepSeconds(s: Int, msg: String): Unit
    Definition Classes
    KafkaTestKit
  31. val system: ActorSystem
    Definition Classes
    KafkaTestKitClassKafkaTestKit
  32. def waitUntilCluster(predicate: Predicate[DescribeClusterResult]): Unit

    Periodically checks if a given predicate on cluster state holds.

    Periodically checks if a given predicate on cluster state holds.

    If the predicate does not hold after configured amount of time, throws an exception.

    Definition Classes
    BaseKafkaTest
  33. def waitUntilConsumerGroup(groupId: String, predicate: Predicate[ConsumerGroupDescription]): Unit

    Periodically checks if the given predicate on consumer group state holds.

    Periodically checks if the given predicate on consumer group state holds.

    If the predicate does not hold after configured amount of time, throws an exception.

    Definition Classes
    BaseKafkaTest
  34. def waitUntilConsumerSummary(groupId: String, predicate: Predicate[Collection[MemberDescription]]): Unit

    Periodically checks if the given predicate on consumer summary holds.

    Periodically checks if the given predicate on consumer summary holds.

    If the predicate does not hold after configured amount of time, throws an exception.

    Definition Classes
    BaseKafkaTest