Beispiel #1
0
 def __activate__(self, context):
     response = context["response"]
     log = context["log"]
     writer = response.getPrintWriter("text/plain; charset=UTF-8")
     try:
         writer.println("Alert script has been started")
         alerts = NewAlerts()
         alerts.run(context)
         writer.println("Alert script has completed")
     except Exception, e:
         writer.println("The alert system had a problem - check logs")
         log.error("Exception in alerts code: %s" % (e.message))
         raise
Beispiel #2
0
 def __activate__(self, context):
     response = context["response"]
     log = context["log"]
     writer = response.getPrintWriter("text/plain; charset=UTF-8")
     try:
         writer.println("Alert script has been started")
         alerts = NewAlerts()
         alerts.run(context)
         writer.println("Alert script has completed")
     except Exception, e:
         writer.println("The alert system had a problem - check logs")
         log.error("Exception in alerts code: %s" % (e.message))
         raise
Beispiel #3
0
def main(config):
    config = getConfig(config)
    alert = NewAlerts()
    alert.log = Log()
    alert.run(config)
Beispiel #4
0
 def test_run_alert(self):
     config = self.__getConfig("system-config-new.json")
     alert = NewAlerts()
     alert.log = Log()
     self.assertTrue(alert.run(config))
Beispiel #5
0
 def test_no_alert_config(self):
     # Tests that we handle situations where the config has no alerts config
     config = self.__getConfig("system-config.1.json")
     alert = NewAlerts()
     self.assertFalse(alert.run(config))
Beispiel #6
0
 def test_run_alert(self):
     config = self.__getConfig("system-config-new.json")
     alert = NewAlerts()
     alert.log = Log()
     self.assertTrue(alert.run(config))
Beispiel #7
0
 def test_incorrect_config(self):
     config = self.__getConfig("system-config.2.json")
     alert = NewAlerts()
     self.assertRaises(AlertException, alert.run, config)
Beispiel #8
0
 def test_no_alert_config(self):
     #Tests that we handle situations where the config has no alerts config
     config = self.__getConfig("system-config.1.json")
     alert = NewAlerts()
     self.assertFalse(alert.run(config))
Beispiel #9
0
 def test_no_config(self):
     #Tests that we handle situations where the config is missing redbox.version.string
     config = self.__getConfig("system-config.0.json")
     alert = alert = NewAlerts()
     self.assertRaises(AlertException, alert.run, config)
Beispiel #10
0
def main(config):
    config = getConfig(config)
    alert = NewAlerts()
    alert.log = Log()
    alert.run(config)