# Path: monasca_notification/notification.py
# class Notification(object):
#     def __init__(self, id, type, name, address, period, retry_count, alarm):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def to_json(self):
# 
# Path: monasca_notification/processors/alarm_processor.py
# CONF = cfg.CONF
# class AlarmProcessor(object):
#     def __init__(self):
#     def _parse_alarm(alarm_data):
#     def _alarm_is_valid(self, alarm):
#     def _build_notification(self, alarm):
#     def to_notification(self, raw_alarm):
# 
# Path: tests/base.py
# class DisableStatsdFixture(fixtures.Fixture):
# class ConfigFixture(oo_cfg.Config):
# class BaseTestCase(oslotest_base.BaseTestCase):
# class PluginTestCase(BaseTestCase):
#     def setUp(self):
#     def __init__(self):
#     def setUp(self):
#     def _clean_config_loaded_flag():
#     def setUp(self):
#     def conf_override(**kw):
#     def conf_default(**kw):
#     def setUp(self, register_opts=None):


import collections
import json
import time
from unittest import mock
from monasca_common.kafka import legacy_kafka_message
from monasca_notification import notification as m_notification
from monasca_notification.processors import alarm_processor
from tests import base
                                                        'me@here.com', 0, 0, alarm_dict)

        self.assertEqual(notifications, [test_notification])
        self.assertEqual(partition, 0)
        self.assertEqual(offset, 4)

    def test_two_valid_notifications(self):
        alarm_dict = {
            "tenantId": "0",
            "alarmDefinitionId": "0",
            "alarmId": "1",
            "alarmName": "test Alarm",
            "oldState": "OK",
            "newState": "ALARM",
            "stateChangeReason": "I am alarming!",
            "timestamp": time.time() * 1000,
            "actionsEnabled": 1,
            "metrics": "cpu_util",
            "severity": "LOW",
            "link": "http://some-place.com",
            "lifecycleState": "OPEN"}

        alarm = self._create_raw_alarm(0, 5, alarm_dict)

        sql_response = [[1, 'EMAIL', 'test notification', 'me@here.com', 0],
                        [2, 'EMAIL', 'test notification2', 'me@here.com', 0]]
        notifications, partition, offset = self._run_alarm_processor(alarm, sql_response)

        test_notification = m_notification.Notification(1, 'email', 'test notification',
                                                        'me@here.com', 0, 0, alarm_dict)

# Path: monasca_notification/notification.py
# class Notification(object):
#     def __init__(self, id, type, name, address, period, retry_count, alarm):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def to_json(self):
# 
# Path: monasca_notification/processors/alarm_processor.py
# CONF = cfg.CONF
# class AlarmProcessor(object):
#     def __init__(self):
#     def _parse_alarm(alarm_data):
#     def _alarm_is_valid(self, alarm):
#     def _build_notification(self, alarm):
#     def to_notification(self, raw_alarm):
# 
# Path: tests/base.py
# class DisableStatsdFixture(fixtures.Fixture):
# class ConfigFixture(oo_cfg.Config):
# class BaseTestCase(oslotest_base.BaseTestCase):
# class PluginTestCase(BaseTestCase):
#     def setUp(self):
#     def __init__(self):
#     def setUp(self):
#     def _clean_config_loaded_flag():
#     def setUp(self):
#     def conf_override(**kw):
#     def conf_default(**kw):
#     def setUp(self, register_opts=None):


# Path: tests/test_alarm_processor.py
import collections
import json
import time
from unittest import mock
from monasca_common.kafka import legacy_kafka_message
from monasca_notification import notification as m_notification
from monasca_notification.processors import alarm_processor
from tests import base

                                                        'me@here.com', 0, 0, alarm_dict)

        self.assertEqual(notifications, [test_notification])
        self.assertEqual(partition, 0)
        self.assertEqual(offset, 4)

    def test_two_valid_notifications(self):
        alarm_dict = {
            "tenantId": "0",
            "alarmDefinitionId": "0",
            "alarmId": "1",
            "alarmName": "test Alarm",
            "oldState": "OK",
            "newState": "ALARM",
            "stateChangeReason": "I am alarming!",
            "timestamp": time.time() * 1000,
            "actionsEnabled": 1,
            "metrics": "cpu_util",
            "severity": "LOW",
            "link": "http://some-place.com",
            "lifecycleState": "OPEN"}

        alarm = self._create_raw_alarm(0, 5, alarm_dict)

        sql_response = [[1, 'EMAIL', 'test notification', 'me@here.com', 0],
                        [2, 'EMAIL', 'test notification2', 'me@here.com', 0]]
        notifications, partition, offset = self._run_alarm_processor(alarm, sql_response)

        test_notification = m_notification.Notification(1, 'email', 'test notification',
                                                        'me@here.com', 0, 0, alarm_dict)

        test_notification2 = m_notification.Notification(2, 'email', 'test notification2',