Package com.networknt.tram.test
Class KafkaTestEnvironmentImpl
- java.lang.Object
-
- com.networknt.tram.test.KafkaTestEnvironmentImpl
-
- All Implemented Interfaces:
KafkaTestEnvironment
public class KafkaTestEnvironmentImpl extends Object implements KafkaTestEnvironment
An implementation of the KafkaServerProvider for Kafka 0.11 .
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.networknt.tram.test.KafkaTestEnvironment
KafkaTestEnvironment.Config, KafkaTestEnvironment.KafkaOffsetHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.LoggerLOG-
Fields inherited from interface com.networknt.tram.test.KafkaTestEnvironment
KAFKA_HOST
-
-
Constructor Summary
Constructors Constructor Description KafkaTestEnvironmentImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KafkaTestEnvironment.KafkaOffsetHandlercreateOffsetHandler()voidcreateTestTopic(String topic, int numberOfPartitions, short replicationFactor)voidcreateTestTopic(String topic, int numberOfPartitions, short replicationFactor, Properties topicConfig)voiddeleteTestTopic(String topic)<K,V>
Collection<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>getAllRecordsFromTopic(Properties properties, String topic, int partition, long timeout)StringgetBrokerConnectionString()intgetBrokerId(kafka.server.KafkaServer server)List<kafka.server.KafkaServer>getBrokers()Map<String,Object>getDefaultClientConfig()protected kafka.server.KafkaServergetKafkaServer(int brokerId, File tmpFolder)intgetLeaderToShutDown(String topic)PropertiesgetSecureProperties()PropertiesgetStandardProperties()StringgetVersion()booleanisSecureRunSupported()voidprepare(KafkaTestEnvironment.Config config)voidrestartBroker(int leaderId)voidshutdown()
-
-
-
Method Detail
-
getBrokerConnectionString
public String getBrokerConnectionString()
- Specified by:
getBrokerConnectionStringin interfaceKafkaTestEnvironment
-
getStandardProperties
public Properties getStandardProperties()
- Specified by:
getStandardPropertiesin interfaceKafkaTestEnvironment
-
getSecureProperties
public Properties getSecureProperties()
- Specified by:
getSecurePropertiesin interfaceKafkaTestEnvironment
-
getVersion
public String getVersion()
- Specified by:
getVersionin interfaceKafkaTestEnvironment
-
getBrokers
public List<kafka.server.KafkaServer> getBrokers()
- Specified by:
getBrokersin interfaceKafkaTestEnvironment
-
getAllRecordsFromTopic
public <K,V> Collection<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>> getAllRecordsFromTopic(Properties properties, String topic, int partition, long timeout)
- Specified by:
getAllRecordsFromTopicin interfaceKafkaTestEnvironment
-
createOffsetHandler
public KafkaTestEnvironment.KafkaOffsetHandler createOffsetHandler()
- Specified by:
createOffsetHandlerin interfaceKafkaTestEnvironment
-
restartBroker
public void restartBroker(int leaderId) throws Exception- Specified by:
restartBrokerin interfaceKafkaTestEnvironment- Throws:
Exception
-
getLeaderToShutDown
public int getLeaderToShutDown(String topic) throws Exception
- Specified by:
getLeaderToShutDownin interfaceKafkaTestEnvironment- Throws:
Exception
-
getBrokerId
public int getBrokerId(kafka.server.KafkaServer server)
- Specified by:
getBrokerIdin interfaceKafkaTestEnvironment
-
isSecureRunSupported
public boolean isSecureRunSupported()
- Specified by:
isSecureRunSupportedin interfaceKafkaTestEnvironment
-
prepare
public void prepare(KafkaTestEnvironment.Config config)
- Specified by:
preparein interfaceKafkaTestEnvironment
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceKafkaTestEnvironment
-
createTestTopic
public void createTestTopic(String topic, int numberOfPartitions, short replicationFactor)
- Specified by:
createTestTopicin interfaceKafkaTestEnvironment
-
createTestTopic
public void createTestTopic(String topic, int numberOfPartitions, short replicationFactor, Properties topicConfig)
- Specified by:
createTestTopicin interfaceKafkaTestEnvironment
-
deleteTestTopic
public void deleteTestTopic(String topic)
- Specified by:
deleteTestTopicin interfaceKafkaTestEnvironment
-
-