use of io.lumeer.api.model.Project in project engine by Lumeer.
the class DocumentServiceIT method configureCollection.
@Before
public void configureCollection() {
JsonOrganization organization = new JsonOrganization();
organization.setCode(ORGANIZATION_CODE);
organization.setPermissions(new JsonPermissions());
Organization storedOrganization = organizationDao.createOrganization(organization);
projectDao.setOrganization(storedOrganization);
User user = new User(USER);
userDao.createUser(user);
JsonProject project = new JsonProject();
project.setCode(PROJECT_CODE);
JsonPermissions projectPermissions = new JsonPermissions();
projectPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
project.setPermissions(projectPermissions);
Project storedProject = projectDao.createProject(project);
collectionDao.setProject(storedProject);
collectionDao.createCollectionsRepository(storedProject);
JsonPermissions collectionPermissions = new JsonPermissions();
collectionPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
JsonCollection jsonCollection = new JsonCollection(COLLECTION_CODE, COLLECTION_NAME, COLLECTION_ICON, COLLECTION_COLOR, collectionPermissions);
collection = collectionDao.createCollection(jsonCollection);
documentDao.setProject(storedProject);
}
use of io.lumeer.api.model.Project in project engine by Lumeer.
the class CollectionFacadeIT method configureProject.
@Before
public void configureProject() {
JsonOrganization organization = new JsonOrganization();
organization.setCode(ORGANIZATION_CODE);
organization.setPermissions(new JsonPermissions());
Organization storedOrganization = organizationDao.createOrganization(organization);
projectDao.setOrganization(storedOrganization);
User user = new User(USER);
userDao.createUser(user);
JsonProject project = new JsonProject();
project.setCode(PROJECT_CODE);
JsonPermissions projectPermissions = new JsonPermissions();
projectPermissions.updateUserPermissions(new JsonPermission(USER, Role.toStringRoles(Project.ROLES)));
project.setPermissions(projectPermissions);
Project storedProject = projectDao.createProject(project);
workspaceKeeper.setWorkspace(ORGANIZATION_CODE, PROJECT_CODE);
collectionDao.setProject(storedProject);
}
use of io.lumeer.api.model.Project in project engine by Lumeer.
the class DocumentFacadeIT method configureCollection.
@Before
public void configureCollection() {
JsonOrganization organization = new JsonOrganization();
organization.setCode(ORGANIZATION_CODE);
organization.setPermissions(new JsonPermissions());
Organization storedOrganization = organizationDao.createOrganization(organization);
projectDao.setOrganization(storedOrganization);
User user = new User(USER);
userDao.createUser(user);
JsonProject project = new JsonProject();
project.setCode(PROJECT_CODE);
JsonPermissions projectPermissions = new JsonPermissions();
projectPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
project.setPermissions(projectPermissions);
Project storedProject = projectDao.createProject(project);
workspaceKeeper.setWorkspace(ORGANIZATION_CODE, PROJECT_CODE);
collectionDao.setProject(storedProject);
collectionDao.createCollectionsRepository(storedProject);
JsonPermissions collectionPermissions = new JsonPermissions();
collectionPermissions.updateUserPermissions(new JsonPermission(USER, Project.ROLES.stream().map(Role::toString).collect(Collectors.toSet())));
JsonCollection jsonCollection = new JsonCollection(null, COLLECTION_NAME, COLLECTION_ICON, COLLECTION_COLOR, collectionPermissions);
jsonCollection.setDocumentsCount(0);
collection = collectionDao.createCollection(jsonCollection);
}
use of io.lumeer.api.model.Project in project engine by Lumeer.
the class ProjectFacadeIT method testUpdateProject.
@Test
public void testUpdateProject() {
String id = createProject(CODE1).getId();
Project updatedProject = new JsonProject(CODE2, NAME, ICON, COLOR, null, null);
updatedProject.getPermissions().removeUserPermission(USER);
projectFacade.updateProject(CODE1, updatedProject);
Project storedProject = projectDao.getProjectByCode(CODE2);
assertThat(storedProject).isNotNull();
assertThat(storedProject.getId()).isEqualTo(id);
assertThat(storedProject.getName()).isEqualTo(NAME);
assertThat(storedProject.getIcon()).isEqualTo(ICON);
assertThat(storedProject.getColor()).isEqualTo(COLOR);
assertThat(storedProject.getPermissions().getUserPermissions()).containsOnly(USER_PERMISSION);
}
use of io.lumeer.api.model.Project in project engine by Lumeer.
the class ProjectFacadeIT method testGetProjectByCode.
@Test
public void testGetProjectByCode() {
createProject(CODE1);
Project storedProject = projectFacade.getProject(CODE1);
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().getGroupPermissions()).isEmpty();
assertions.assertAll();
assertPermissions(storedProject.getPermissions().getUserPermissions(), USER_PERMISSION);
}
Aggregations