Exemplo n.º 1
0
 def ensure_after_execute(self):
   LOGGER.debug("ensure_after_execute")
   try:
     RabbitMqAgent.ensure_after_execute(self)
   except Exception, ex:
     LOGGER.error("Error on error calling parent ensure_after_execute")
     raise MpdRmqException, MpdRmqException(ex), sys.exc_info()[2] # keep stacktrace
Exemplo n.º 2
0
  def test_rabbitmqagent_ensure_after_execute_call_super(self, method):
    rmqagent = RabbitMqAgent({},{})

    rmq = Mock()
    rmqagent.rmqclient = rmq

    rmqagent.ensure_after_execute()

    method.assert_called_once_with(rmqagent)
Exemplo n.º 3
0
  def test_rabbitmqagent_ensure_after_execute(self):
    rmqagent = RabbitMqAgent({},{})

    rmq = Mock()
    rmqagent.rmqclient = rmq

    rmqagent.ensure_after_execute()

    rmq.disconnect.assert_called_once_with()
Exemplo n.º 4
0
  def test_rabbitmqagent_basicpublish(self):
    import json
    conf={"channel":{"exchange":"ex","type":"type"},"messages":{"routing_key":"rt"}}
    rmqagent = RabbitMqAgent(conf, {})

    rmq = Mock()
    rmqagent.rmqclient = rmq
    
    obj={"aa":1, "bb":{"cc":2}}
    rmqagent.basic_publish_json(obj)

    expected = {}
    expected["id"] = rmqagent.id
    expected["payload"] = obj
    message=json.dumps(expected)
    rmq.basic_publish_json.assert_called_once_with(conf["channel"]["exchange"], conf["channel"]["type"], conf["messages"]["routing_key"], expected)
Exemplo n.º 5
0
 def after_execute(self):
   LOGGER.debug("after_execute")
   RabbitMqAgent.after_execute(self)
Exemplo n.º 6
0
 def before_execute(self):
   LOGGER.debug("before_execute")
   self.mpdclient.connect()
   RabbitMqAgent.before_execute(self)
Exemplo n.º 7
0
 def __init__(self, config={}, mpdconf={}, rmqconf={}):
   RabbitMqAgent.__init__(self, config, rmqconf)
   self.mpdclient = MpdClient(mpdconf)
Exemplo n.º 8
0
 def ensure_after_execute(self):
   try:
     RabbitMqAgent.ensure_after_execute(self)
   except Exception, ex:
     LOGGER.error("Error calling RabbitMqAgent.ensure_after_execute")
     raise TelnetRmqAgenException, TelnetRmqAgenException(ex), sys.exc_info()[2] # keep stacktrace
Exemplo n.º 9
0
 def after_execute(self):
   RabbitMqAgent.after_execute(self)
Exemplo n.º 10
0
 def before_execute(self):
   RabbitMqAgent.before_execute(self)
   self.telnetclient.connect()
Exemplo n.º 11
0
 def __init__(self, config, telnetconf={}, rmqconf={}):
   RabbitMqAgent.__init__(self, config, rmqconf)
   self.telnetclient = TelnetClient(telnetconf)
Exemplo n.º 12
0
 def __init__(self, config, xbmcconf={}, rmqconf={}):
   RabbitMqAgent.__init__(self,config,rmqconf)
   self.xbmc=XbmcClient(xbmcconf)
Exemplo n.º 13
0
 def before_execute(self):
   RabbitMqAgent.before_execute(self)