use of ru.ydn.wicket.wicketorientdb.model.OQueryDataProvider in project wicket-orientdb by OrienteerBAP.
the class TestModels method testOQueryProvider.
@Test
public void testOQueryProvider() {
OQueryDataProvider<OUser> provider = new OQueryDataProvider<OUser>("select from OUser where name <> :other", OUser.class);
provider.setSort("name", SortOrder.ASCENDING);
provider.setParameter("other", Model.of("blalba"));
Iterator<OUser> it = provider.iterator(0, -1);
List<ODocument> allUsers = wicket.getTester().getMetadata().getSecurity().getAllUsers();
assertTrue(provider.size() == allUsers.size());
while (it.hasNext()) {
OUser oUser = it.next();
assertTrue(allUsers.contains(provider.model(oUser).getObject().getDocument()));
}
provider.detach();
assertTrue(provider.size() == allUsers.size());
}
use of ru.ydn.wicket.wicketorientdb.model.OQueryDataProvider in project wicket-orientdb by OrienteerBAP.
the class TestFilters method testProvider.
@Test
@SuppressWarnings("unchecked")
public void testProvider() {
IFilterCriteriaManager manager = new FilterCriteriaManager(wicket.getProperty(NUMBER_FIELD));
IFilterCriteria equalsFilterCriteria = manager.createEqualsFilterCriteria(Model.of(NUM_VALUE_1), Model.of(true));
manager.addFilterCriteria(equalsFilterCriteria);
String numField = wicket.getProperty(NUMBER_FIELD).getObject().getName();
queryModel.addFilterCriteriaManager(numField, manager);
OQueryDataProvider provider = new OQueryDataProvider(queryModel);
assertTrue(queryModel.size() == queryModel.getObject().size());
assertTrue(provider.size() == queryModel.getObject().size());
}
Aggregations