use of io.lumeer.api.dto.JsonView in project engine by Lumeer.
the class MongoViewDaoTest method testDeleteView.
@Test
public void testDeleteView() {
JsonView view = prepareView();
viewDao.databaseCollection().insertOne(view);
assertThat(view.getId()).isNotNull();
viewDao.deleteView(view.getId());
View storedView = viewDao.databaseCollection().find(MongoFilters.idFilter(view.getId())).first();
assertThat(storedView).isNull();
}
use of io.lumeer.api.dto.JsonView in project engine by Lumeer.
the class MongoViewDaoTest method testUpdateViewExistingCode.
@Test
public void testUpdateViewExistingCode() {
JsonView view = prepareView();
viewDao.databaseCollection().insertOne(view);
JsonView view2 = prepareView();
view2.setCode(CODE2);
view2.setName(NAME2);
viewDao.databaseCollection().insertOne(view2);
view2.setCode(CODE);
assertThatThrownBy(() -> viewDao.updateView(view2.getId(), view2)).isInstanceOf(StorageException.class);
}
use of io.lumeer.api.dto.JsonView in project engine by Lumeer.
the class MongoViewDaoTest method testCreateViewExistingCode.
@Test
public void testCreateViewExistingCode() {
JsonView view = prepareView();
viewDao.databaseCollection().insertOne(view);
JsonView view2 = prepareView();
view2.setName(NAME2);
assertThatThrownBy(() -> viewDao.createView(view2)).isInstanceOf(StorageException.class);
}
use of io.lumeer.api.dto.JsonView in project engine by Lumeer.
the class MongoViewDaoTest method testCreateView.
@Test
public void testCreateView() {
JsonView view = prepareView();
String id = viewDao.createView(view).getId();
assertThat(id).isNotNull().isNotEmpty();
assertThat(ObjectId.isValid(id)).isTrue();
View storedView = viewDao.databaseCollection().find(MongoFilters.idFilter(id)).first();
assertThat(storedView).isNotNull();
assertThat(storedView.getCode()).isEqualTo(CODE);
assertThat(storedView.getName()).isEqualTo(NAME);
assertThat(storedView.getColor()).isEqualTo(COLOR);
assertThat(storedView.getIcon()).isEqualTo(ICON);
assertThat(storedView.getPermissions()).isEqualTo(PERMISSIONS);
assertThat(storedView.getQuery()).isEqualTo(QUERY);
assertThat(storedView.getPerspective()).isEqualTo(PERSPECTIVE);
assertThat(storedView.getConfig()).isEqualTo(CONFIG);
}
use of io.lumeer.api.dto.JsonView in project engine by Lumeer.
the class MongoViewDaoTest method prepareView.
private JsonView prepareView() {
JsonView view = new JsonView();
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;
}
Aggregations