'Test the dump_collection method
Cases:
1. no namespace set is set
2. include namespace set is set
3. exclude namespace set is set
empty oplog case has been tested in test_oplog_manager.py,
skip that here.'

def test_dump_collection(self):

    self.init_dbs()
    self.reset_opman([], [], {})
    self.opman.oplog = self.primary_conn['local']['oplog.rs']
    last_ts = self.opman.get_last_oplog_timestamp()
    self.assertEqual(last_ts, self.opman.dump_collection())
    self.assertEqual(len(self.opman.doc_managers[0]._search()), 10)
    self.reset_opman(['includedb1.*', 'includedb2.includecol1'], [], {})
    self.opman.oplog = self.primary_conn['local']['oplog.rs']
    last_ts = self.opman.get_last_oplog_timestamp()
    self.assertEqual(last_ts, self.opman.dump_collection())
    self.assertEqual(len(self.opman.doc_managers[0]._search()), 6)
    self.reset_opman([], ['includedb2.excludecol2', 'excludedb3.*'], {})
    self.opman.oplog = self.primary_conn['local']['oplog.rs']
    last_ts = self.opman.get_last_oplog_timestamp()
    self.assertEqual(last_ts, self.opman.dump_collection())
    self.assertEqual(len(self.opman.doc_managers[0]._search()), 6)
