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 )
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_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 )