use of io.lumeer.storage.api.query.SearchQuery in project engine by Lumeer.
the class MorphiaViewDaoTest method testGetViewsByFulltextDifferentUser.
@Test
public void testGetViewsByFulltextDifferentUser() {
createView(CODE, NAME);
createView(CODE2, NAME2);
createView(CODE3, NAME3);
SearchQuery query = SearchQuery.createBuilder(USER2).fulltext("fulltext").build();
List<View> views = viewDao.getViews(query);
assertThat(views).extracting(View::getCode).isEmpty();
}
use of io.lumeer.storage.api.query.SearchQuery in project engine by Lumeer.
the class MorphiaViewDaoTest method testGetViewsNoReadRole.
@Test
public void testGetViewsNoReadRole() {
MorphiaView view = prepareView();
Permission userPermission = new MorphiaPermission(USER2, Collections.singleton(Role.CLONE.toString()));
view.getPermissions().updateUserPermissions(userPermission);
datastore.save(viewDao.databaseCollection(), view);
MorphiaView view2 = prepareView();
view2.setCode(CODE2);
view2.setName(NAME2);
Permission groupPermission = new MorphiaPermission(GROUP2, Collections.singleton(Role.SHARE.toString()));
view2.getPermissions().updateGroupPermissions(groupPermission);
datastore.save(viewDao.databaseCollection(), view2);
SearchQuery query = SearchQuery.createBuilder(USER2).groups(Collections.singleton(GROUP2)).build();
List<View> views = viewDao.getViews(query);
assertThat(views).isEmpty();
}
use of io.lumeer.storage.api.query.SearchQuery in project engine by Lumeer.
the class MorphiaViewDaoTest method testGetViewsByFulltextAndPagination.
@Test
public void testGetViewsByFulltextAndPagination() {
createView(CODE, NAME);
createView(CODE2, NAME2);
createView(CODE3, NAME3);
SearchQuery query = SearchQuery.createBuilder(USER).fulltext("fulltext").page(1).pageSize(1).build();
List<View> views = viewDao.getViews(query);
assertThat(views).extracting(View::getCode).containsOnly(CODE2);
}
use of io.lumeer.storage.api.query.SearchQuery in project engine by Lumeer.
the class MorphiaViewDaoTest method testGetViewsByFulltext.
@Test
public void testGetViewsByFulltext() {
createView(CODE, NAME);
createView(CODE2, NAME2);
createView(CODE3, NAME3);
SearchQuery query = SearchQuery.createBuilder(USER).fulltext("fulltext").build();
List<View> views = viewDao.getViews(query);
assertThat(views).extracting(View::getCode).containsOnly(CODE2, CODE3);
}
Aggregations