use of ru.ydn.wicket.wicketorientdb.model.ODocumentLinksDataProvider in project wicket-orientdb by OrienteerBAP.
the class TestModels method testODocumentLinksDataProvider.
@Test
public void testODocumentLinksDataProvider() {
ODocument doc1 = new ODocument("ClassA");
doc1.field("name", "doc1Ext");
doc1.save();
ODocument doc2 = new ODocument("ClassA");
doc2.field("name", "doc2Ext");
doc2.field("other", Arrays.asList(doc1));
try {
ODocumentModel documentModel = new ODocumentModel(doc2);
OPropertyModel propertyModel = new OPropertyModel("ClassA", "other");
ODocumentLinksDataProvider provider = new ODocumentLinksDataProvider(documentModel, propertyModel);
assertEquals(1, provider.size());
assertEquals(doc1, provider.iterator(0, 1).next());
doc2.save();
provider.detach();
assertEquals(1, provider.size());
assertEquals(doc1, provider.iterator(0, 1).next());
} finally {
doc1.delete();
doc2.delete();
}
}
Aggregations