assertEquals(extr.field("listMixed"), document.field("listMixed"));
}
@Test
public void testLinkCollections() {
ODatabaseDocument db = new ODatabaseDocumentTx("memory:ODocumentSchemalessBinarySerializationTest").create();
try {
ODocument document = new ODocument();
Set<ORecordId> linkSet = new HashSet<ORecordId>();
linkSet.add(new ORecordId(10, new OClusterPositionLong(20)));
linkSet.add(new ORecordId(10, new OClusterPositionLong(21)));
linkSet.add(new ORecordId(10, new OClusterPositionLong(22)));
linkSet.add(new ORecordId(11, new OClusterPositionLong(22)));
document.field("linkSet", linkSet, OType.LINKSET);
List<ORecordId> linkList = new ArrayList<ORecordId>();
linkList.add(new ORecordId(10, new OClusterPositionLong(20)));
linkList.add(new ORecordId(10, new OClusterPositionLong(21)));
linkList.add(new ORecordId(10, new OClusterPositionLong(22)));
linkList.add(new ORecordId(11, new OClusterPositionLong(22)));
document.field("linkList", linkList, OType.LINKLIST);
byte[] res = serializer.toStream(document, false);
ODocument extr = (ODocument) serializer.fromStream(res, new ODocument(), new String[] {});
assertEquals(extr.fields(), document.fields());
assertEquals(((Set<?>) extr.field("linkSet")).size(), ((Set<?>) document.field("linkSet")).size());
assertTrue(((Set<?>) extr.field("linkSet")).containsAll((Set<?>) document.field("linkSet")));
assertEquals(extr.field("linkList"), document.field("linkList"));
} finally {
db.drop();
}
}