use of com.orientechnologies.orient.core.db.record.OMultiValueChangeTimeLine in project orientdb by orientechnologies.
the class DocumentTrackingTest method testDocumentLinkMapTrackingAfterSaveWithClass.
public void testDocumentLinkMapTrackingAfterSaveWithClass() {
final ODocument docOne = new ODocument();
docOne.save();
final ODocument docTwo = new ODocument();
docTwo.save();
final ODocument document = new ODocument("DocumentTrackingTestClass");
final Map<String, ORID> map = new HashMap<String, ORID>();
map.put("key1", docOne.getIdentity());
document.field("linkmap", map);
document.field("val", 1);
document.save();
Assert.assertFalse(document.isDirty());
Assert.assertEquals(document.getDirtyFields(), new String[] {});
final Map<String, ORID> trackedMap = document.field("linkmap");
trackedMap.put("key2", docTwo.getIdentity());
final OMultiValueChangeTimeLine timeLine = document.getCollectionTimeLine("linkmap");
Assert.assertNotNull(timeLine);
Assert.assertEquals(document.getDirtyFields(), new String[] { "linkmap" });
}
use of com.orientechnologies.orient.core.db.record.OMultiValueChangeTimeLine in project orientdb by orientechnologies.
the class DocumentTrackingTest method testDocumentLinkListTrackingAfterSave.
public void testDocumentLinkListTrackingAfterSave() {
final ODocument docOne = new ODocument();
docOne.save();
final ODocument docTwo = new ODocument();
docTwo.save();
final ODocument document = new ODocument();
final List<ORID> list = new ArrayList<ORID>();
list.add(docOne.getIdentity());
document.field("linklist", list, OType.LINKLIST);
document.field("val", 1);
document.save();
Assert.assertFalse(document.isDirty());
Assert.assertEquals(document.getDirtyFields(), new String[] {});
final List<ORID> trackedList = document.field("linklist");
trackedList.add(docTwo.getIdentity());
Assert.assertTrue(document.isDirty());
final OMultiValueChangeTimeLine timeLine = document.getCollectionTimeLine("linklist");
Assert.assertNotNull(timeLine);
Assert.assertEquals(document.getDirtyFields(), new String[] { "linklist" });
}
Aggregations