use of com.orientechnologies.orient.core.record.impl.ODirtyManager in project orientdb by orientechnologies.
the class ODirtyManagerTest method testRemoveLink.
@Test
public void testRemoveLink() {
ODocument doc = new ODocument();
doc.field("test", "ddd");
ODocument doc2 = new ODocument();
doc.field("test1", doc2);
doc.removeField("test1");
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 testLinkCollection.
@Test
public void testLinkCollection() {
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);
Set<ODocument> set = new HashSet<ODocument>();
ODocument doc2 = new ODocument();
set.add(doc2);
doc.field("set", set);
ODocumentInternal.convertAllMultiValuesToTrackedVersions(doc);
ODirtyManager manager = ORecordInternal.getDirtyManager(doc);
assertEquals(3, manager.getNewRecords().size());
assertEquals(2, manager.getPointed(doc).size());
assertTrue(manager.getPointed(doc).contains(doc1));
assertTrue(manager.getPointed(doc).contains(doc2));
}
use of com.orientechnologies.orient.core.record.impl.ODirtyManager in project orientdb by orientechnologies.
the class DirtyManagerGraph method testLoopOfNewTree.
@Test
public void testLoopOfNewTree() {
OrientGraph graph = new OrientGraph("memory:" + DirtyManagerGraph.class.getSimpleName());
Object prev = OGlobalConfiguration.RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD.getValue();
OGlobalConfiguration.RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD.setValue(-1);
try {
graph.createEdgeType("next");
OrientVertex vertex = graph.addVertex(null);
OrientVertex vertex1 = graph.addVertex(null);
OrientVertex vertex2 = graph.addVertex(null);
OrientVertex vertex3 = graph.addVertex(null);
OrientEdge edge1 = (OrientEdge) vertex.addEdge("next", vertex1);
OrientEdge edge2 = (OrientEdge) vertex1.addEdge("next", vertex2);
OrientEdge edge3 = (OrientEdge) vertex2.addEdge("next", vertex3);
OrientEdge edge4 = (OrientEdge) vertex3.addEdge("next", vertex);
ODocument rec = vertex.getRecord();
ODirtyManager manager = ORecordInternal.getDirtyManager(rec);
List<OIdentifiable> pointed = manager.getPointed(vertex.getRecord());
assertEquals(2, pointed.size());
assertTrue(pointed.contains(edge1.getRecord()));
assertTrue(pointed.contains(edge4.getRecord()));
pointed = manager.getPointed(vertex1.getRecord());
assertEquals(2, pointed.size());
assertTrue(pointed.contains(edge1.getRecord()));
assertTrue(pointed.contains(edge2.getRecord()));
pointed = manager.getPointed(vertex2.getRecord());
assertEquals(2, pointed.size());
assertTrue(pointed.contains(edge2.getRecord()));
assertTrue(pointed.contains(edge3.getRecord()));
pointed = manager.getPointed(vertex3.getRecord());
assertEquals(2, pointed.size());
assertTrue(pointed.contains(edge3.getRecord()));
assertTrue(pointed.contains(edge4.getRecord()));
pointed = manager.getPointed(edge1.getRecord());
assertEquals(2, pointed.size());
assertTrue(pointed.contains(vertex.getRecord()));
assertTrue(pointed.contains(vertex1.getRecord()));
pointed = manager.getPointed(edge2.getRecord());
assertEquals(2, pointed.size());
assertTrue(pointed.contains(vertex1.getRecord()));
assertTrue(pointed.contains(vertex2.getRecord()));
pointed = manager.getPointed(edge3.getRecord());
assertEquals(2, pointed.size());
assertTrue(pointed.contains(vertex2.getRecord()));
assertTrue(pointed.contains(vertex3.getRecord()));
pointed = manager.getPointed(edge4.getRecord());
assertEquals(2, pointed.size());
assertTrue(pointed.contains(vertex3.getRecord()));
assertTrue(pointed.contains(vertex.getRecord()));
} finally {
OGlobalConfiguration.RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD.setValue(prev);
graph.drop();
}
}
Aggregations