use of com.orientechnologies.orient.core.record.impl.ODirtyManager in project orientdb by orientechnologies.
the class ODirtyManagerRidbagTest method testRidBagTree.
@Test
public void testRidBagTree() {
Object value = OGlobalConfiguration.RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD.getValue();
OGlobalConfiguration.RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD.setValue(-1);
try {
ODocument doc = new ODocument();
doc.field("test", "ddd");
ORidBag bag = new ORidBag();
ODocument doc1 = new ODocument();
bag.add(doc1);
doc.field("bag", bag);
ODocumentInternal.convertAllMultiValuesToTrackedVersions(doc);
ODirtyManager manager = ORecordInternal.getDirtyManager(doc1);
assertEquals(2, manager.getNewRecords().size());
} finally {
OGlobalConfiguration.RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD.setValue(value);
}
}
use of com.orientechnologies.orient.core.record.impl.ODirtyManager in project orientdb by orientechnologies.
the class ODirtyManagerTest method testSetToNullLink.
@Test
public void testSetToNullLink() {
ODocument doc = new ODocument();
doc.field("test", "ddd");
ODocument doc2 = new ODocument();
doc.field("test1", doc2);
doc.field("test1", (Object) null);
ODirtyManager manager = ORecordInternal.getDirtyManager(doc);
assertEquals(2, manager.getNewRecords().size());
assertEquals(0, manager.getPointed(doc).size());
}
use of com.orientechnologies.orient.core.record.impl.ODirtyManager in project orientdb by orientechnologies.
the class ODirtyManagerTest method testNestedMapDocRidBag.
@Test
public void testNestedMapDocRidBag() {
ODocument doc = new ODocument();
Map<String, ODocument> embeddedMap = new HashMap<String, ODocument>();
ODocument embeddedMapDoc = new ODocument();
ORidBag embeddedMapDocRidBag = new ORidBag();
ODocument link = new ODocument();
embeddedMapDocRidBag.add(link);
embeddedMapDoc.field("ridBag", embeddedMapDocRidBag);
embeddedMap.put("k1", embeddedMapDoc);
doc.field("embeddedMap", embeddedMap, OType.EMBEDDEDMAP);
ODocumentInternal.convertAllMultiValuesToTrackedVersions(doc);
ODirtyManager manager = ORecordInternal.getDirtyManager(doc);
assertEquals(2, manager.getNewRecords().size());
assertEquals(1, manager.getPointed(doc).size());
// TODO: double check this, it's an overhead
assertEquals(1, manager.getPointed(embeddedMapDoc).size());
assertTrue(manager.getPointed(doc).contains(link));
}
use of com.orientechnologies.orient.core.record.impl.ODirtyManager in project orientdb by orientechnologies.
the class ODirtyManagerTest method testLinkSetNoConvert.
@Test
public void testLinkSetNoConvert() {
ODocument doc = new ODocument();
doc.field("test", "ddd");
Set<OIdentifiable> set = new ORecordLazySet(doc);
ODocument link = new ODocument();
set.add(link);
doc.field("set", set, OType.LINKSET);
ODirtyManager manager = ORecordInternal.getDirtyManager(doc);
assertEquals(2, manager.getNewRecords().size());
assertEquals(1, manager.getPointed(doc).size());
assertTrue(manager.getPointed(doc).contains(link));
}
use of com.orientechnologies.orient.core.record.impl.ODirtyManager in project orientdb by orientechnologies.
the class ODirtyManagerTest method testEmbeddedMap.
@Test
public void testEmbeddedMap() {
ODocument doc = new ODocument();
doc.field("test", "ddd");
Map<String, Object> map = new HashMap<String, Object>();
ODocument doc1 = new ODocument();
map.put("bla", "bla");
map.put("some", doc1);
doc.field("list", map, OType.EMBEDDEDMAP);
ODocumentInternal.convertAllMultiValuesToTrackedVersions(doc);
ODirtyManager manager = ORecordInternal.getDirtyManager(doc);
assertEquals(1, manager.getNewRecords().size());
}
Aggregations