def ztest_get_range_of_nms_queue_items(self):
     """ get range of nms queue items """
     queue = NMSQueue()
     
     result_set = queue.get_items_with_priority(1,1,0,1)
     
     for item in result_set:
         print("\nItem = %s\n" % (item) )
 def ztest_get_item(self):
     """ get an item using its uuid """
     
     queue = NMSQueue()
     
     result_set = queue.get_items_with_priority(1,1,0,1)
     
     for item in result_set:
         print("\nItem = %s\n" % (item) )
         newitem = queue.get_item(item.uuid)
         print("\nRetrieve the same from queue Item = %s\n" % (newitem) )
 def ztest_delete_item(self):
     """ delete item """
     
     queue = NMSQueue()
     
     result_set = queue.get_items_with_priority(1,1,0,1)
     the_item = None
     for item in result_set:
         print("\nItem = %s\n" % (item) )
         the_item = item
         print("\nItem with uuid %s deleted" % (item.uuid) )
     
     queue.delete_item(the_item.uuid)
 def ztest_get_from_uuid(self):
     """ test get from uuid """
     
     queue = NMSQueue()
     
     item = NMSQueueItem(5,"data %s" % (1))
     
     item.set_uuid()
     
     print("item = %s\n" %(item))
     
     queue.put(item)
     
     newitem = queue.get_item(item.uuid)
     
     print("new item = %s\n" % (newitem) )
 def ztest_change_status(self):
     """ change status """
     queue = NMSQueue()
     
     result_set = queue.get_items_with_priority(1,1,0,1)
     
     the_item = None
     
     for item in result_set:
         print("\nItem = %s\n" % (item) )
         the_item = item
     
     queue.change_item_status(the_item.uuid, "BURIED")
     
     result_set = queue.get_items_with_priority(1,1,0,10)
     
     for item in result_set:
         print("\nItem = %s\n" % (item) )
 def test_consprod(self):
     """ test consumer, producer """
     
     queue = NMSQueue()
     
     start_producers(1,10,queue)
      
     time.sleep(1)    
               
     start_workers(1,queue)  
     
     #wait for queue to be empty
     queue.join()
     
     print("After join \n")
     
     stop_workers()
     
     print("No more elements in the queue\n")