Exemplo n.º 1
0
 def run(self):
     Kafka.run_producer(name='kafka.producer.ConsoleProducer',
                        args=[
                            "--broker-list",
                            "{0}:{1}".format(CLUSTER_NAME,
                                             PORT), "--topic", "test123"
                        ])
Exemplo n.º 2
0
 def test_create_topic(self):
     name = uuid.uuid4()
     topic = Topic(name=name, zookeeper_host="sandbox.hortonworks.com:2181")
     self.assertFalse(topic.is_exists())
     Kafka.create_topic(name=name, replication_factor=1,
                        partitions=1,
                        zookeeper_host="sandbox.hortonworks.com:2181")
     self.assertTrue(topic.is_exists())
     self.assertTrue(str(name) in topic.get_metadata())
     topic.delete()
Exemplo n.º 3
0
 def test_create_topic(self):
     name = uuid.uuid4()
     topic = Topic(name=name, zookeeper_host="sandbox.hortonworks.com:2181")
     self.assertFalse(topic.is_exists())
     Kafka.create_topic(name=name,
                        replication_factor=1,
                        partitions=1,
                        zookeeper_host="sandbox.hortonworks.com:2181")
     self.assertTrue(topic.is_exists())
     self.assertTrue(str(name) in topic.get_metadata())
     topic.delete()
Exemplo n.º 4
0
 def run(self):
     Kafka.run_consumer(
         name='kafka.consumer.ConsoleConsumer',
         args=[
             "--zookeeper sandbox.hortonworks.com:2181 --from-beginning --topic test123"
         ])
Exemplo n.º 5
0
 def run(self):
     Kafka.start_broker(path_to_config=os.path.join(
         os.path.dirname(__file__), 'resources/kafka/server.properties'))
Exemplo n.º 6
0
 def test_get_list_topics(self):
     _command = "kafka-run-class.sh kafka.admin.TopicCommand --zookeeper master1.mycluster:2181 --list"
     Kafka.get_list_topics(zookeeper_host="master1.mycluster:2181", executor=mock_executor(expected_command=_command))
Exemplo n.º 7
0
 def test_stop_broker(self):
     _command = "kafka-server-stop.sh path/to/config"
     Kafka.stop_broker(path_to_config="path/to/config", executor=mock_executor(expected_command=_command))
Exemplo n.º 8
0
 def test_create_topic(self):
     _command = "kafka-run-class.sh kafka.admin.TopicCommand --create --zookeeper master1.mycluster:2181" \
                " --topic Topic --partitions 3 --replication-factor 1"
     Kafka.create_topic(name='Topic', replication_factor=1,
                        partitions=3, zookeeper_host="master1.mycluster:2181",
                        executor=mock_executor(expected_command=_command))
Exemplo n.º 9
0
 def test_run_producer(self):
     _command = "kafka-run-class.sh Producer conf1 conf2"
     Kafka.run_producer(name='Producer', args=["conf1", "conf2"], executor=mock_executor(expected_command=_command))
Exemplo n.º 10
0
 def test_run_consumer(self):
     _command = "kafka-run-class.sh Consumer --zookeeper lcoalhost"
     Kafka.run_consumer(name='Consumer', args={"--zookeeper": "lcoalhost"}, executor=mock_executor(expected_command=_command))
Exemplo n.º 11
0
 def run(self):
     Kafka.run_consumer(name='kafka.consumer.ConsoleConsumer', args=["--zookeeper sandbox.hortonworks.com:2181 --from-beginning --topic test123"])
Exemplo n.º 12
0
 def run(self):
     Kafka.run_producer(name='kafka.producer.ConsoleProducer', args=["--broker-list", "{0}:{1}".format(CLUSTER_NAME, PORT), "--topic", "test123"])
Exemplo n.º 13
0
 def run(self):
     Kafka.start_broker(path_to_config=os.path.join(os.path.dirname(__file__), 'resources/kafka/server.properties'))