Search in sources :

Example 21 with JsonProject

use of io.lumeer.api.dto.JsonProject 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);
}
Also used : JsonProject(io.lumeer.api.dto.JsonProject) Project(io.lumeer.api.model.Project) JsonPermissions(io.lumeer.api.dto.JsonPermissions) Organization(io.lumeer.api.model.Organization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) User(io.lumeer.api.model.User) AuthenticatedUser(io.lumeer.core.AuthenticatedUser) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonPermission(io.lumeer.api.dto.JsonPermission) JsonCollection(io.lumeer.api.dto.JsonCollection) JsonProject(io.lumeer.api.dto.JsonProject) Before(org.junit.Before)

Example 22 with JsonProject

use of io.lumeer.api.dto.JsonProject 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);
}
Also used : JsonProject(io.lumeer.api.dto.JsonProject) Project(io.lumeer.api.model.Project) JsonPermissions(io.lumeer.api.dto.JsonPermissions) Organization(io.lumeer.api.model.Organization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) User(io.lumeer.api.model.User) AuthenticatedUser(io.lumeer.core.AuthenticatedUser) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonPermission(io.lumeer.api.dto.JsonPermission) JsonProject(io.lumeer.api.dto.JsonProject) Before(org.junit.Before)

Example 23 with JsonProject

use of io.lumeer.api.dto.JsonProject in project engine by Lumeer.

the class ConfigurationFacadeIT method setUp.

@Before
public void setUp() {
    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);
    projectDao.createProject(project);
    workspaceKeeper.setWorkspace(ORGANIZATION_CODE, PROJECT_CODE);
}
Also used : JsonPermissions(io.lumeer.api.dto.JsonPermissions) Organization(io.lumeer.api.model.Organization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) User(io.lumeer.api.model.User) AuthenticatedUser(io.lumeer.core.AuthenticatedUser) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonPermission(io.lumeer.api.dto.JsonPermission) JsonProject(io.lumeer.api.dto.JsonProject) Before(org.junit.Before)

Example 24 with JsonProject

use of io.lumeer.api.dto.JsonProject 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);
}
Also used : JsonProject(io.lumeer.api.dto.JsonProject) Project(io.lumeer.api.model.Project) JsonPermissions(io.lumeer.api.dto.JsonPermissions) Organization(io.lumeer.api.model.Organization) JsonOrganization(io.lumeer.api.dto.JsonOrganization) User(io.lumeer.api.model.User) AuthenticatedUser(io.lumeer.core.AuthenticatedUser) JsonOrganization(io.lumeer.api.dto.JsonOrganization) JsonPermission(io.lumeer.api.dto.JsonPermission) JsonCollection(io.lumeer.api.dto.JsonCollection) JsonProject(io.lumeer.api.dto.JsonProject) Before(org.junit.Before)

Example 25 with JsonProject

use of io.lumeer.api.dto.JsonProject 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);
}
Also used : JsonProject(io.lumeer.api.dto.JsonProject) Project(io.lumeer.api.model.Project) JsonProject(io.lumeer.api.dto.JsonProject) Test(org.junit.Test)

Aggregations

JsonProject (io.lumeer.api.dto.JsonProject)26 Project (io.lumeer.api.model.Project)25 Organization (io.lumeer.api.model.Organization)15 JsonOrganization (io.lumeer.api.dto.JsonOrganization)14 JsonPermission (io.lumeer.api.dto.JsonPermission)14 JsonPermissions (io.lumeer.api.dto.JsonPermissions)13 User (io.lumeer.api.model.User)13 AuthenticatedUser (io.lumeer.core.AuthenticatedUser)13 Before (org.junit.Before)13 Test (org.junit.Test)9 JsonCollection (io.lumeer.api.dto.JsonCollection)8 Response (javax.ws.rs.core.Response)7 SoftAssertions (org.assertj.core.api.SoftAssertions)4 SimplePermission (io.lumeer.core.model.SimplePermission)3 Entity (javax.ws.rs.client.Entity)3 LinkType (io.lumeer.api.model.LinkType)2 Permission (io.lumeer.api.model.Permission)1 Permissions (io.lumeer.api.model.Permissions)1 Resource (io.lumeer.api.model.Resource)1 Role (io.lumeer.api.model.Role)1