def run(self): """ Sends the Tasks to the queue Wait for the results to come back Close the connection """ if self._is_run: raise TaskRunnerException("This TaskRunner has already been run") self._is_run = True if not queue_exists(self._host, self._username, self._password, self._vhost, self._routing_key): raise OtsQueueDoesNotExistError("No queue for %s" %\ (self._routing_key)) LOGGER.debug("Sending Tasks") try: self._dispatch_tasks() self._wait_for_all_tasks() LOGGER.info("All Tasks completed") finally: send_monitor_event(MonitorType.TESTRUN_ENDED, __name__) LOGGER.debug("stopping...") self.timeout_handler.stop() self._close()
def test_queue_exists_negative(self): exists = queue_exists(self.host, self.user_id, self.password, self.virtual_host, "nokia") self.assertFalse(exists)
def test_queue_exists_positive(self): exists = queue_exists(self.host, self.user_id, self.password, self.virtual_host, "foo") self.assertTrue(exists)