Class GlobalEmbeddedKafkaTestExecutionListener
java.lang.Object
org.springframework.kafka.test.junit.GlobalEmbeddedKafkaTestExecutionListener
- All Implemented Interfaces:
org.junit.platform.launcher.TestExecutionListener
public class GlobalEmbeddedKafkaTestExecutionListener
extends Object
implements org.junit.platform.launcher.TestExecutionListener
The
TestExecutionListener
to start an EmbeddedKafkaBroker
in the beginning of the test plan and stop in the end.
This approach ensures one global Kafka cluster for all the unit tests to execute.
The GlobalEmbeddedKafkaTestExecutionListener
is disabled by default.
Set LISTENER_ENABLED_PROPERTY_NAME
system property (or respective ConfigurationParameters.CONFIG_FILE_NAME
entry)
to enable it.
- Since:
- 3.0
- Author:
- Artem Bilan, Gary Russell
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The location for a properties file with Kafka broker configuration.static final String
The number of brokers forEmbeddedKafkaBroker
.static final String
The number of partitions on topics to create on the embedded broker(s).static final String
Property name used to enable theGlobalEmbeddedKafkaTestExecutionListener
.static final String
The number of partitions on topics to create on the embedded broker(s).static final String
The port(s) to expose embedded broker(s).static final String
The topics to create on the embedded broker(s). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
testPlanExecutionFinished
(org.junit.platform.launcher.TestPlan testPlan) void
testPlanExecutionStarted
(org.junit.platform.launcher.TestPlan testPlan) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.junit.platform.launcher.TestExecutionListener
dynamicTestRegistered, executionFinished, executionSkipped, executionStarted, reportingEntryPublished
-
Field Details
-
LISTENER_ENABLED_PROPERTY_NAME
Property name used to enable theGlobalEmbeddedKafkaTestExecutionListener
. TheGlobalEmbeddedKafkaTestExecutionListener
is registered automatically via Java'sServiceLoader
mechanism but disabled by default. Set the value of this property totrue
to enable this listener.- See Also:
-
COUNT_PROPERTY_NAME
The number of brokers forEmbeddedKafkaBroker
.- See Also:
-
PORTS_PROPERTY_NAME
The port(s) to expose embedded broker(s).- See Also:
-
TOPICS_PROPERTY_NAME
The topics to create on the embedded broker(s).- See Also:
-
PARTITIONS_PROPERTY_NAME
The number of partitions on topics to create on the embedded broker(s).- See Also:
-
KRAFT_PROPERTY_NAME
The number of partitions on topics to create on the embedded broker(s).- See Also:
-
BROKER_PROPERTIES_LOCATION_PROPERTY_NAME
The location for a properties file with Kafka broker configuration.- See Also:
-
-
Constructor Details
-
GlobalEmbeddedKafkaTestExecutionListener
public GlobalEmbeddedKafkaTestExecutionListener()
-
-
Method Details
-
testPlanExecutionStarted
public void testPlanExecutionStarted(org.junit.platform.launcher.TestPlan testPlan) - Specified by:
testPlanExecutionStarted
in interfaceorg.junit.platform.launcher.TestExecutionListener
-
testPlanExecutionFinished
public void testPlanExecutionFinished(org.junit.platform.launcher.TestPlan testPlan) - Specified by:
testPlanExecutionFinished
in interfaceorg.junit.platform.launcher.TestExecutionListener
-