}
public void testGetCollectionMetaData() throws Exception {
// Get meta service
Collection col = this.client.getCollection(TEST_COLLECTION_PATH);
MetaService service = (MetaService) col.getService("MetaService", "1.0");
// Get meta data
MetaData data = service.getMetaData();
assertNotNull("MetaData is not found for the collection!", data);
assertTrue("Creation time is 0!", data.getCreatedTime() != 0);
assertTrue("Modification time is 0!", data.getLastModifiedTime() != 0);
long created0 = data.getCreatedTime();
long modified0 = data.getLastModifiedTime();
// Sleep and get it again
Thread.sleep(150);
data = service.getMetaData();
long created1 = data.getCreatedTime();
long modified1 = data.getLastModifiedTime();
assertEquals("Creation time changed on 2nd get (diff: "+ (created1 - created0) +")!", created0, created1);
assertEquals("Modification time changed on 2nd get (diff: "+ (modified1 - modified0) +")!", modified0, modified1);
// Sleep, add new document, and get metadata again
Thread.sleep(150);
this.client.insertDocument(TEST_COLLECTION_PATH, DOCUMENT_ID2, DOCUMENT2);
data = service.getMetaData();
assertNotNull("MetaData is not found for the collection after update!", data);
long created2 = data.getCreatedTime();
long modified2 = data.getLastModifiedTime();
assertEquals("Creation time changed on update (diff: "+ (created2 - created1) +")!", created1, created2);
assertTrue("Modification time has not changed on update!", modified1 != modified2);