def test_failure( self ): consumer = MQConsumer(mqManager = self.myManager, mqURI = "fake.cern.ch::Queue::FakeQueue", consumerId ='consumer4') result = consumer.close() self.assertTrue(result['OK']) result = consumer.close() self.assertFalse(result['OK']) self.assertEqual(result['Message'], 'MQ connection failure ( 1142 : Failed to stop the connection!The messenger consumer4 does not exist!)')
def test_failure(self): consumer = MQConsumer(mqManager=self.myManager, mqURI="fake.cern.ch::Queue::FakeQueue", consumerId='consumer1') result = consumer.get() self.assertFalse(result['OK']) self.assertEqual(result['Message'], 'No messages ( 1141 : No messages in queue)')
def test_failure(self): consumer = MQConsumer(mqManager=self.myManager, mqURI="fake.cern.ch::Queues::FakeQueue", consumerId="consumer1") result = consumer.get() self.assertFalse(result["OK"]) self.assertEqual(result["Message"], "No messages ( 1141 : No messages in queue)")
def test_failure(self): consumer = MQConsumer(mqManager=self.myManager, mqURI="fake.cern.ch::Queues::FakeQueue", consumerId='consumer4') result = consumer.close() self.assertTrue(result['OK']) result = consumer.close() self.assertFalse(result['OK']) self.assertEqual( result['Message'], 'MQ connection failure ( 1142 : Failed to stop the connection!The messenger consumer4 does not exist!)')
def createConsumer(mqURI, callback=generateDefaultCallback()): """ Function creates MQConsumer. All parameters are taken from the Configuration Service based on the mqURI value. Args: mqURI(str):Pseudo URI identifing MQ service. It has the following format mqConnection::DestinationType::DestinationName e.g. blabla.cern.ch::Queue::MyQueue1 callback: callback function that can be used to process the incoming messages Returns: S_OK/S_ERROR: with the consumer object in S_OK. """ result = _setupConnection(mqURI=mqURI, mType="consumer") if not result['OK']: gLogger.error('Failed to createConsumer:', result['Message']) return result return S_OK( MQConsumer(mqManager=connectionManager, mqURI=mqURI, consumerId=result['Value'], callback=callback))
def test_failure2(self): consumer = MQConsumer(mqManager=self.myManager, mqURI="fake.cern.ch::Queues::FakeQueue", consumerId="consumer4") consumer2 = MQConsumer(mqManager=self.myManager, mqURI="fake.cern.ch::Queues::FakeQueue", consumerId="consumer2") result = consumer.close() self.assertTrue(result["OK"]) result = consumer.close() self.assertFalse(result["OK"]) self.assertEqual( result["Message"], "MQ connection failure ( 1142 : Failed to stop the connection!The messenger consumer4 does not exist!)", ) result = consumer2.close() self.assertTrue(result["OK"]) result = consumer2.close() self.assertFalse(result["OK"]) self.assertEqual( result["Message"], "MQ connection failure ( 1142 : Failed to stop the connection!The messenger consumer2 does not exist!)", )
def test_success(self): consumer = MQConsumer(mqManager=self.myManager, mqURI="fake.cern.ch::Queue::FakeQueue", consumerId='consumer4') result = consumer.close() self.assertTrue(result['OK'])
def test_sucess(self): consumer = MQConsumer(mqManager=self.myManager, mqURI="bad.cern.ch::Queue::FakeQueue", consumerId='consumer1') result = consumer.get() self.assertFalse(result['OK'])
def test_success( self ): consumer = MQConsumer(mqManager = self.myManager, mqURI = "fake.cern.ch::Queue::FakeQueue", consumerId ='consumer4') result = consumer.close() self.assertTrue(result['OK'])
def test_sucess( self ): consumer = MQConsumer(mqManager = self.myManager, mqURI = "bad.cern.ch::Queue::FakeQueue", consumerId = 'consumer1') result = consumer.get() self.assertFalse(result['OK'])
def test_failure( self ): consumer = MQConsumer(mqManager = self.myManager, mqURI = "fake.cern.ch::Queue::FakeQueue", consumerId = 'consumer1') result = consumer.get() self.assertFalse(result['OK']) self.assertEqual(result['Message'], 'No messages ( 1141 : No messages in queue)')