}
public void testGetDocumentMetaData() 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(DOCUMENT_ID1);
assertNotNull("MetaData is not found for document " + DOCUMENT_ID1 + "!", 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(DOCUMENT_ID1);
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 and update the document and get data again
Thread.sleep(150);
this.client.updateDocument(TEST_COLLECTION_PATH, DOCUMENT_ID1, DOCUMENT2);
data = service.getMetaData(DOCUMENT_ID1);
assertNotNull("MetaData is not found for document " + DOCUMENT_ID1 + " 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);