use of io.lumeer.api.model.Project in project engine by Lumeer.
the class ProjectServiceIT method testUpdateProject.
@Test
public void testUpdateProject() {
createProject(CODE1);
Project updatedProject = new JsonProject(CODE2, NAME, ICON, COLOR, null, null);
Entity entity = Entity.json(updatedProject);
Response response = client.target(PROJECT_URL).path(CODE1).request(MediaType.APPLICATION_JSON).buildPut(entity).invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
Project returnedProject = response.readEntity(JsonProject.class);
SoftAssertions assertions = new SoftAssertions();
assertions.assertThat(returnedProject.getCode()).isEqualTo(CODE2);
assertions.assertThat(returnedProject.getName()).isEqualTo(NAME);
assertions.assertThat(returnedProject.getIcon()).isEqualTo(ICON);
assertions.assertThat(returnedProject.getColor()).isEqualTo(COLOR);
assertions.assertThat(returnedProject.getPermissions().getUserPermissions()).containsOnly(USER_PERMISSION);
assertions.assertThat(returnedProject.getPermissions().getGroupPermissions()).isEmpty();
assertions.assertAll();
Project storedProject = projectDao.getProjectByCode(CODE2);
assertThat(storedProject).isNotNull();
assertions = new SoftAssertions();
assertions.assertThat(storedProject.getCode()).isEqualTo(CODE2);
assertions.assertThat(storedProject.getName()).isEqualTo(NAME);
assertions.assertThat(storedProject.getIcon()).isEqualTo(ICON);
assertions.assertThat(storedProject.getColor()).isEqualTo(COLOR);
assertions.assertThat(storedProject.getPermissions().getUserPermissions()).containsOnly(USER_PERMISSION);
assertions.assertThat(storedProject.getPermissions().getGroupPermissions()).containsOnly(GROUP_PERMISSION);
assertions.assertAll();
}
use of io.lumeer.api.model.Project in project engine by Lumeer.
the class ProjectServiceIT method testGetProject.
@Test
public void testGetProject() {
createProject(CODE1);
Response response = client.target(PROJECT_URL).path(CODE1).request(MediaType.APPLICATION_JSON).buildGet().invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
Project returnedProject = response.readEntity(JsonProject.class);
SoftAssertions assertions = new SoftAssertions();
assertions.assertThat(returnedProject.getCode()).isEqualTo(CODE1);
assertions.assertThat(returnedProject.getName()).isEqualTo(NAME);
assertions.assertThat(returnedProject.getIcon()).isEqualTo(ICON);
assertions.assertThat(returnedProject.getColor()).isEqualTo(COLOR);
assertions.assertThat(returnedProject.getPermissions().getUserPermissions()).containsOnly(USER_PERMISSION);
assertions.assertThat(returnedProject.getPermissions().getGroupPermissions()).isEmpty();
assertions.assertAll();
}
use of io.lumeer.api.model.Project in project engine by Lumeer.
the class OrganizationServicePermissionsIT method testCreateProjectInOrganizationManageRole.
@Test
public void testCreateProjectInOrganizationManageRole() {
String name = "testCreateProjectInOrganizationManageRole";
String code = "testCreateProjectInOrganizationManageRole_code";
Organization organization = new JsonOrganization(code, name, "a", "b", null, null);
organizationFacade.createOrganization(organization);
String projectCode = "proj2";
String projectName = "proj2_code";
Project project = new JsonProject(projectCode, projectName, "a", "b", null, null);
Response response = client.target(TARGET_URI).path(PATH_PREFIX + code + "/projects").request(MediaType.APPLICATION_JSON).buildPost(Entity.json(project)).invoke();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
}
use of io.lumeer.api.model.Project in project engine by Lumeer.
the class ProjectServicePermissionsIT method testUpdateProjectNoRole.
@Test
public void testUpdateProjectNoRole() {
String projectCode = "testUpdateProjectNoRole_id";
String projectName = "testUpdateProjectNoRole";
createProject(projectCode, projectName);
projectFacade.removeUserPermission(projectCode, userEmail);
String newProjectName = "NewName2";
Project newProject = new JsonProject(projectCode, newProjectName, "a", "b", null, null);
Response response = client.target(TARGET_URI).path(PATH_PREFIX + projectCode).request(MediaType.APPLICATION_JSON).buildPut(Entity.json(newProject)).invoke();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.UNAUTHORIZED);
}
use of io.lumeer.api.model.Project in project engine by Lumeer.
the class ProjectFacadeIT method testCreateProject.
@Test
public void testCreateProject() {
Project project = new JsonProject(CODE1, NAME, ICON, COLOR, null, null);
Project returnedProject = projectFacade.createProject(project);
assertThat(returnedProject).isNotNull();
assertThat(returnedProject.getId()).isNotNull();
Project storedProject = projectDao.getProjectByCode(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().getUserPermissions()).containsOnly(USER_PERMISSION);
assertions.assertThat(storedProject.getPermissions().getGroupPermissions()).isEmpty();
assertions.assertAll();
}
Aggregations