Class SharedKafkaTestResource

java.lang.Object
com.salesforce.kafka.test.AbstractKafkaTestResource<SharedKafkaTestResource>
com.salesforce.kafka.test.junit5.SharedKafkaTestResource
All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.Extension

public class SharedKafkaTestResource extends AbstractKafkaTestResource<SharedKafkaTestResource> implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback
Creates and stands up an internal test kafka server to be shared across test cases within the same test class. Example within your Test class. @RegisterExtension public static final SharedKafkaTestResource sharedKafkaTestResource = new SharedKafkaTestResource(); Within your test case method: sharedKafkaTestResource.getKafkaTestServer()...
  • Constructor Details

    • SharedKafkaTestResource

      public SharedKafkaTestResource()
      Default constructor.
    • SharedKafkaTestResource

      public SharedKafkaTestResource(Properties brokerProperties)
      Constructor allowing passing additional broker properties.
      Parameters:
      brokerProperties - properties for Kafka broker.
  • Method Details

    • beforeAll

      public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
      Here we stand up an internal test kafka and zookeeper service. Once for all tests that use this shared resource.
      Specified by:
      beforeAll in interface org.junit.jupiter.api.extension.BeforeAllCallback
      Throws:
      Exception
    • afterAll

      public void afterAll(org.junit.jupiter.api.extension.ExtensionContext context)
      Here we shut down the internal test kafka and zookeeper services.
      Specified by:
      afterAll in interface org.junit.jupiter.api.extension.AfterAllCallback