use of io.lumeer.storage.api.query.SearchQuery in project engine by Lumeer.
the class MorphiaCollectionDaoTest method testGetCollectionsPagination.
@Test
public void testGetCollectionsPagination() {
createCollection(CODE, NAME);
createCollection(CODE2, NAME2);
createCollection(CODE3, NAME3);
SearchQuery searchQuery = SearchQuery.createBuilder(USER).page(1).pageSize(1).build();
List<Collection> collections = collectionDao.getCollections(searchQuery);
assertThat(collections).extracting(Resource::getCode).containsOnly(CODE2);
}
use of io.lumeer.storage.api.query.SearchQuery in project engine by Lumeer.
the class MorphiaCollectionDaoTest method testGetCollections.
@Test
public void testGetCollections() {
MorphiaCollection collection = prepareCollection(CODE, NAME);
datastore.save(collectionDao.databaseCollection(), collection);
MorphiaCollection collection2 = prepareCollection(CODE2, NAME2);
datastore.save(collectionDao.databaseCollection(), collection2);
SearchQuery query = SearchQuery.createBuilder(USER).build();
List<Collection> views = collectionDao.getCollections(query);
assertThat(views).extracting(Collection::getCode).containsOnly(CODE, CODE2);
}
use of io.lumeer.storage.api.query.SearchQuery in project engine by Lumeer.
the class MorphiaViewDaoTest method testGetViews.
@Test
public void testGetViews() {
MorphiaView view = prepareView();
datastore.save(viewDao.databaseCollection(), view);
MorphiaView view2 = prepareView();
view2.setCode(CODE2);
view2.setName(NAME2);
datastore.save(viewDao.databaseCollection(), view2);
SearchQuery query = SearchQuery.createBuilder(USER).build();
List<View> views = viewDao.getViews(query);
assertThat(views).extracting(View::getCode).containsOnly(CODE, CODE2);
}
use of io.lumeer.storage.api.query.SearchQuery in project engine by Lumeer.
the class MorphiaViewDaoTest method testGetViewsGroupRole.
@Test
public void testGetViewsGroupRole() {
MorphiaView view = prepareView();
datastore.save(viewDao.databaseCollection(), view);
MorphiaView view2 = prepareView();
view2.setCode(CODE2);
view2.setName(NAME2);
datastore.save(viewDao.databaseCollection(), view2);
SearchQuery query = SearchQuery.createBuilder(USER2).groups(Collections.singleton(GROUP)).build();
List<View> views = viewDao.getViews(query);
assertThat(views).extracting(View::getCode).containsOnly(CODE, CODE2);
}
use of io.lumeer.storage.api.query.SearchQuery in project engine by Lumeer.
the class MorphiaViewDaoTest method testGetViewsPagination.
@Test
public void testGetViewsPagination() {
MorphiaView view = prepareView();
datastore.save(viewDao.databaseCollection(), view);
MorphiaView view2 = prepareView();
view2.setCode(CODE2);
view2.setName(NAME2);
datastore.save(viewDao.databaseCollection(), view2);
SearchQuery query = SearchQuery.createBuilder(USER).page(1).pageSize(1).build();
List<View> views = viewDao.getViews(query);
assertThat(views).extracting(View::getCode).containsOnly(CODE2);
}
Aggregations