use of io.lumeer.storage.mongodb.model.MorphiaView in project engine by Lumeer.
the class MorphiaViewDaoTest method prepareView.
private MorphiaView prepareView() {
MorphiaView view = new MorphiaView();
view.setCode(CODE);
view.setName(NAME);
view.setColor(COLOR);
view.setIcon(ICON);
view.setPermissions(new MorphiaPermissions(PERMISSIONS));
view.setQuery(QUERY);
view.setPerspective(PERSPECTIVE);
view.setConfig(CONFIG);
return view;
}
use of io.lumeer.storage.mongodb.model.MorphiaView in project engine by Lumeer.
the class MorphiaViewDaoTest method testUpdateViewExistingName.
@Test
public void testUpdateViewExistingName() {
MorphiaView view = prepareView();
datastore.save(viewDao.databaseCollection(), view);
MorphiaView view2 = prepareView();
view2.setCode(CODE2);
view2.setName(NAME2);
datastore.save(viewDao.databaseCollection(), view2);
view2.setName(NAME);
assertThatThrownBy(() -> viewDao.updateView(view2.getId(), view2)).isInstanceOf(DuplicateKeyException.class);
}
use of io.lumeer.storage.mongodb.model.MorphiaView 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.mongodb.model.MorphiaView 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.mongodb.model.MorphiaView in project engine by Lumeer.
the class MorphiaViewDaoTest method createView.
private MorphiaView createView(String code, String name) {
MorphiaView morphiaView = prepareView();
morphiaView.setCode(code);
morphiaView.setName(name);
datastore.insert(viewDao.databaseCollection(), morphiaView);
return morphiaView;
}
Aggregations