--- /dev/null
+# Copyright 2021 Xoriant Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#------------------------------------------------------------------------------
+# This is a config file for the dmaap-adapter.
+#
+
+[default]
+log_file = dmaap.log
+log_level = error
+kafka_broker = kafka
+enable_assert =
def get_config_path():
project_path = get_path()
- config_path = os.path.join(project_path, "dmaapadapter/adapter/config/adapter.conf")
+ config_path = os.path.join(project_path, "tests/dmaap_adaptor/test_config.conf")
return config_path
-# test __init__ of TpoicConsumer
+@mock.patch("confluent_kafka.Consumer")
+def test_consumeEvents(mock_consumer, prepareResponse, topic, resCode):
+ consumergroup = "test"
+ consumerid = "test1"
+ limit = 10
+ timeout = 1
+ mock_consumer.__name__ = "subscribe"
+ mock_consumer.__name__ = "poll"
+ mock_consumer.poll.return_value = None
+ EventConsumer.consumeEvents(
+ EventConsumer, prepareResponse, topic, consumergroup, consumerid, limit, timeout
+ )
+ resMsg = "[]"
+ assert resCode == prepareResponse.getResponseCode()
+ assert resMsg == prepareResponse.getResponseMsg()
+
+
+# test __init__()function of TpoicConsumer
@mock.patch("app_config.AppConfig.setLogger")
@mock.patch(
"argparse.ArgumentParser.parse_args",
mock_setLogger.assert_called_with("dmaap.log", "error")
-# test __init__ of EventConsumer
+# test __init__() function of EventConsumer
@mock.patch("app_config.AppConfig.setLogger")
@mock.patch(
"argparse.ArgumentParser.parse_args",
mock_setLogger.assert_called_with("dmaap.log", "error")
-@mock.patch("confluent_kafka.Consumer")
-def test_consumeEvents(mock_consumer, prepareResponse, topic, resCode):
- consumergroup = "test"
- consumerid = "test1"
- limit = 10
- timeout = 1
- mock_consumer.__name__ = "subscribe"
- mock_consumer.__name__ = "poll"
- mock_consumer.poll.return_value = None
- EventConsumer.consumeEvents(
- EventConsumer, prepareResponse, topic, consumergroup, consumerid, limit, timeout
- )
- resMsg = "[]"
- assert resCode == prepareResponse.getResponseCode()
- assert resMsg == prepareResponse.getResponseMsg()
-
-
# test consumeEvents for break
@mock.patch("confluent_kafka.Consumer")
def test_consumeEvents_break(mock_consumer, prepareResponse, topic, resCode):