use of com.orientechnologies.orient.core.record.impl.ODirtyManager in project orientdb by orientechnologies.
the class ODirtyManagerTest method testEmbeddedCollection.
@Test
public void testEmbeddedCollection() {
ODocument doc = new ODocument();
doc.field("test", "ddd");
List<ODocument> lst = new ArrayList<ODocument>();
ODocument doc1 = new ODocument();
lst.add(doc1);
doc.field("list", lst, OType.EMBEDDEDLIST);
Set<ODocument> set = new HashSet<ODocument>();
ODocument doc2 = new ODocument();
set.add(doc2);
doc.field("set", set, OType.EMBEDDEDSET);
ODocumentInternal.convertAllMultiValuesToTrackedVersions(doc);
ODirtyManager manager = ORecordInternal.getDirtyManager(doc);
assertEquals(1, manager.getNewRecords().size());
}
use of com.orientechnologies.orient.core.record.impl.ODirtyManager in project orientdb by orientechnologies.
the class ODirtyManagerTest method testLinkOther.
@Test
public void testLinkOther() {
ODocument doc = new ODocument();
doc.field("test", "ddd");
ODocument doc1 = new ODocument();
doc.field("test1", doc1);
ODirtyManager manager = ORecordInternal.getDirtyManager(doc1);
assertEquals(2, manager.getNewRecords().size());
assertEquals(1, manager.getPointed(doc).size());
assertEquals(doc1, manager.getPointed(doc).get(0));
}
use of com.orientechnologies.orient.core.record.impl.ODirtyManager in project orientdb by orientechnologies.
the class ODirtyManagerTest method testLinkCollectionRemove.
@Test
public void testLinkCollectionRemove() {
ODocument doc = new ODocument();
doc.field("test", "ddd");
List<ODocument> lst = new ArrayList<ODocument>();
ODocument doc1 = new ODocument();
lst.add(doc1);
doc.field("list", lst);
doc.removeField("list");
Set<ODocument> set = new HashSet<ODocument>();
ODocument doc2 = new ODocument();
set.add(doc2);
doc.field("set", set);
doc.removeField("set");
ODocumentInternal.convertAllMultiValuesToTrackedVersions(doc);
ODirtyManager manager = ORecordInternal.getDirtyManager(doc);
assertEquals(1, manager.getNewRecords().size());
assertEquals(null, manager.getPointed(doc));
}
use of com.orientechnologies.orient.core.record.impl.ODirtyManager in project orientdb by orientechnologies.
the class ODirtyManagerTest method testLinkListLoop.
@Test
public void testLinkListLoop() {
ODocument doc1 = new ODocument().field("name", "doc1");
ODocument doc2 = new ODocument().field("name", "doc2");
ODocument doc3 = new ODocument().field("name", "doc3");
doc1.field("other", Arrays.asList(doc2, doc3));
doc2.field("other", Arrays.asList(doc1, doc3));
doc3.field("other", Arrays.asList(doc1, doc2));
ODocumentInternal.convertAllMultiValuesToTrackedVersions(doc1);
ODirtyManager manager = ORecordInternal.getDirtyManager(doc1);
assertEquals(3, manager.getNewRecords().size());
assertTrue(manager.getPointed(doc1).contains(doc2));
assertTrue(manager.getPointed(doc1).contains(doc3));
assertTrue(manager.getPointed(doc2).contains(doc1));
assertTrue(manager.getPointed(doc2).contains(doc3));
assertTrue(manager.getPointed(doc3).contains(doc1));
assertTrue(manager.getPointed(doc3).contains(doc2));
}
use of com.orientechnologies.orient.core.record.impl.ODirtyManager in project orientdb by orientechnologies.
the class ODirtyManagerTest method testEmbeddedDocument.
@Test
public void testEmbeddedDocument() {
ODocument doc = new ODocument();
ODocument doc1 = new ODocument();
doc.field("test", doc1, OType.EMBEDDED);
ODocument doc2 = new ODocument();
doc1.field("test2", doc2);
ODirtyManager manager = ORecordInternal.getDirtyManager(doc);
assertEquals(2, manager.getNewRecords().size());
assertEquals(1, manager.getPointed(doc).size());
assertEquals(doc2, manager.getPointed(doc).get(0));
}
Aggregations