diff options
author | dongwenjuan <dong.wenjuan@zte.com.cn> | 2017-07-11 19:07:22 +0800 |
---|---|---|
committer | dongwenjuan <dong.wenjuan@zte.com.cn> | 2017-07-29 12:48:56 +0800 |
commit | 162c3ae179f69bd326325b135c3831ae12843e49 (patch) | |
tree | 79ff7e3f9c4b90c61a912f72111d7fca4a3f533e /tests/consumer/__init__.py | |
parent | e52dccf724ee05a16b6e78e79d7045f5c0ac979f (diff) |
refactor sample consumer
JIRA: DOCTOR-113
Change-Id: I60f17953e9b1cdf31ea50f313b33f8ede0831bc2
Signed-off-by: dongwenjuan <dong.wenjuan@zte.com.cn>
Diffstat (limited to 'tests/consumer/__init__.py')
-rw-r--r-- | tests/consumer/__init__.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/consumer/__init__.py b/tests/consumer/__init__.py index 68cc5dc9..ccec8644 100644 --- a/tests/consumer/__init__.py +++ b/tests/consumer/__init__.py @@ -7,6 +7,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## from oslo_config import cfg +from oslo_utils import importutils OPTS = [ @@ -24,3 +25,13 @@ OPTS = [ help='the port of doctor consumer', required=True), ] + + +_consumer_name_class_mapping = { + 'sample': 'consumer.sample.SampleConsumer' +} + + +def get_consumer(conf, log): + consumer_class = _consumer_name_class_mapping.get(conf.consumer.type) + return importutils.import_object(consumer_class, conf, log)
\ No newline at end of file |