Пример #1
0
 def ztest_tokyo_queue(self):
     """ test for the internal tokyo cabinet queue """
     
     sql_queue = TokyoCabinetQueue()
     
     print("Queue size = %d\n" %(sql_queue.size()) )
                  
     #insertion
     for i in range(10):
         if i % 2 == 0:
             p = 0
         else:
             p = 1
         item = NMSQueueItem(p,"data %s" % (i))
         item.set_uuid()
         sql_queue.put(item.dictify())
         #time.sleep(0.5)
     
     size = sql_queue.size()
         
     while size != 0:
         the_dict = sql_queue.pop()
         item = NMSQueueItem.create_from_dict(the_dict)
         print("size = %d, item = %s\n" % (size, item))
         size = sql_queue.size()
     
     print("size = %s" % size )
     
     
     
     
     
         
         
Пример #2
0
 def ztest_sql_queue(self):
     """ test for the internal sqlqueue """
     
     sql_queue = SQLQueue()
            
     #insertion
     for i in range(10):
         item = NMSQueueItem(5,"data %s" % (i))
         item.set_uuid()
         sql_queue.put(item.dictify())
     
     size = sql_queue.size()
         
     while size != 0:
         the_dict = sql_queue.pop()
         item = NMSQueueItem.create_from_dict(the_dict)
         print("size = %d, item = %s\n" % (size, item))
         size = sql_queue.size()
     
     print("size = %s" % size )