use of io.lumeer.storage.mongodb.model.MorphiaProject in project engine by Lumeer.
the class MorphiaProjectDaoTest method testGetProjects.
@Test
public void testGetProjects() {
MorphiaProject project = prepareProject(CODE1);
datastore.save(projectDao.databaseCollection(), project);
MorphiaProject project2 = prepareProject(CODE2);
datastore.save(projectDao.databaseCollection(), project2);
DatabaseQuery query = DatabaseQuery.createBuilder(USER).build();
List<MorphiaProject> projects = (List<MorphiaProject>) (List<?>) projectDao.getProjects(query);
assertThat(projects).extracting(Project::getCode).containsOnly(CODE1, CODE2);
}
use of io.lumeer.storage.mongodb.model.MorphiaProject in project engine by Lumeer.
the class MorphiaProjectDao method createProject.
@Override
public Project createProject(final Project project) {
ensureIndexes();
MorphiaProject morphiaProject = new MorphiaProject(project);
datastore.insert(databaseCollection(), morphiaProject);
return morphiaProject;
}
use of io.lumeer.storage.mongodb.model.MorphiaProject in project engine by Lumeer.
the class ViewFacadeIT method configureProject.
@Before
public void configureProject() {
MorphiaOrganization organization = new MorphiaOrganization();
organization.setCode(ORGANIZATION_CODE);
organization.setPermissions(new MorphiaPermissions());
Organization storedOrganization = organizationDao.createOrganization(organization);
projectDao.setOrganization(storedOrganization);
workspaceKeeper.setWorkspace(ORGANIZATION_CODE, PROJECT_CODE);
User user = new User(USER);
userDao.createUser(user);
MorphiaProject project = new MorphiaProject();
project.setCode(PROJECT_CODE);
project.setPermissions(new MorphiaPermissions());
Project storedProject = projectDao.createProject(project);
viewDao.setProject(storedProject);
}
use of io.lumeer.storage.mongodb.model.MorphiaProject in project engine by Lumeer.
the class MorphiaProjectDaoTest method testCreateProject.
@Test
public void testCreateProject() {
Project project = prepareProject(CODE1);
String id = projectDao.createProject(project).getId();
assertThat(id).isNotNull().isNotEmpty();
assertThat(ObjectId.isValid(id)).isTrue();
MorphiaProject storedProject = datastore.get(projectDao.databaseCollection(), MorphiaProject.class, new ObjectId(id));
assertThat(storedProject).isNotNull();
SoftAssertions assertions = new SoftAssertions();
assertions.assertThat(storedProject.getCode()).isEqualTo(CODE1);
assertions.assertThat(storedProject.getName()).isEqualTo(NAME);
assertions.assertThat(storedProject.getColor()).isEqualTo(COLOR);
assertions.assertThat(storedProject.getIcon()).isEqualTo(ICON);
assertions.assertThat(storedProject.getPermissions()).isEqualTo(PERMISSIONS);
assertions.assertAll();
}
use of io.lumeer.storage.mongodb.model.MorphiaProject in project engine by Lumeer.
the class MorphiaProjectDaoTest method prepareProject.
private MorphiaProject prepareProject(String code) {
MorphiaProject project = new MorphiaProject();
project.setCode(code);
project.setName(NAME);
project.setColor(COLOR);
project.setIcon(ICON);
project.setPermissions(new MorphiaPermissions(PERMISSIONS));
return project;
}
Aggregations