use of io.lumeer.storage.mongodb.model.MorphiaOrganization 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.MorphiaOrganization in project engine by Lumeer.
the class MorphiaOrganizationDaoTest method testUpdateOrganizationExistingCode.
@Test
public void testUpdateOrganizationExistingCode() {
MorphiaOrganization organization = prepareOrganization(CODE1);
datastore.save(organization);
MorphiaOrganization organization2 = prepareOrganization(CODE2);
datastore.save(organization2);
organization2.setCode(CODE1);
assertThatThrownBy(() -> organizationDao.updateOrganization(organization2.getId(), organization2)).isInstanceOf(DuplicateKeyException.class);
}
use of io.lumeer.storage.mongodb.model.MorphiaOrganization in project engine by Lumeer.
the class MorphiaOrganizationDaoTest method testUpdateOrganizationCode.
@Test
public void testUpdateOrganizationCode() {
MorphiaOrganization organization = prepareOrganization(CODE1);
String id = datastore.save(organization).getId().toString();
assertThat(id).isNotNull().isNotEmpty();
MorphiaOrganization organization2 = prepareOrganization(CODE2);
organizationDao.updateOrganization(id, organization2);
MorphiaOrganization storedOrganization = datastore.get(MorphiaOrganization.class, new ObjectId(id));
assertThat(storedOrganization).isNotNull();
assertThat(storedOrganization.getCode()).isEqualTo(CODE2);
}
use of io.lumeer.storage.mongodb.model.MorphiaOrganization in project engine by Lumeer.
the class ViewServiceIT 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);
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.MorphiaOrganization in project engine by Lumeer.
the class ProjectServicePermissionsIT method configureProject.
@Before
public void configureProject() {
MorphiaOrganization organization = new MorphiaOrganization();
organization.setCode(organizationCode);
organization.setName(organizationName);
organization.setPermissions(new MorphiaPermissions());
organization.getPermissions().updateUserPermissions(new MorphiaPermission(userEmail, Role.toStringRoles(new HashSet<>(Arrays.asList(Role.WRITE, Role.READ, Role.MANAGE)))));
Organization storedOrganization = organizationDao.createOrganization(organization);
projectDao.setOrganization(storedOrganization);
workspaceKeeper.setOrganization(organizationCode);
User user = new User(userEmail);
userDao.createUser(user);
}
Aggregations