use of io.lumeer.api.model.Organization in project engine by Lumeer.
the class OrganizationFacadeIT method testUpdateOrganization.
@Test
public void testUpdateOrganization() {
String id = createOrganization(CODE1);
Organization updatedOrganization = new JsonOrganization(CODE2, NAME, ICON, COLOR, null, null);
organizationFacade.updateOrganization(CODE1, updatedOrganization);
Organization storedOrganization = organizationDao.getOrganizationByCode(CODE2);
assertThat(storedOrganization).isNotNull();
assertThat(storedOrganization.getId()).isEqualTo(id);
assertThat(storedOrganization.getName()).isEqualTo(NAME);
assertThat(storedOrganization.getIcon()).isEqualTo(ICON);
assertThat(storedOrganization.getColor()).isEqualTo(COLOR);
assertThat(storedOrganization.getPermissions().getUserPermissions()).containsOnly(USER_PERMISSION);
}
use of io.lumeer.api.model.Organization in project engine by Lumeer.
the class OrganizationFacadeIT method testCreateOrganization.
@Test
public void testCreateOrganization() {
Organization organization = new JsonOrganization(CODE1, NAME, ICON, COLOR, null, null);
Organization createdOrganization = organizationFacade.createOrganization(organization);
assertThat(createdOrganization).isNotNull();
assertThat(createdOrganization.getId()).isNotNull();
Organization storedOrganization = organizationDao.getOrganizationByCode(CODE1);
assertThat(storedOrganization).isNotNull();
SoftAssertions assertions = new SoftAssertions();
assertions.assertThat(storedOrganization.getCode()).isEqualTo(CODE1);
assertions.assertThat(storedOrganization.getName()).isEqualTo(NAME);
assertions.assertThat(storedOrganization.getColor()).isEqualTo(COLOR);
assertions.assertThat(storedOrganization.getIcon()).isEqualTo(ICON);
assertions.assertThat(storedOrganization.getPermissions().getUserPermissions()).containsOnly(USER_PERMISSION);
assertions.assertThat(storedOrganization.getPermissions().getGroupPermissions()).isEmpty();
assertions.assertAll();
}
use of io.lumeer.api.model.Organization in project engine by Lumeer.
the class ProjectFacadeIT method configureProject.
@Before
public void configureProject() {
MorphiaOrganization organization = new MorphiaOrganization();
organization.setCode(ORGANIZATION_CODE);
organization.setPermissions(new MorphiaPermissions());
organization.getPermissions().updateUserPermissions(new MorphiaPermission(USER, Role.toStringRoles(new HashSet<>(Arrays.asList(Role.WRITE, Role.READ, Role.MANAGE)))));
Organization storedOrganization = organizationDao.createOrganization(organization);
projectDao.setOrganization(storedOrganization);
User user = new User(USER);
userDao.createUser(user);
workspaceKeeper.setOrganization(ORGANIZATION_CODE);
}
use of io.lumeer.api.model.Organization in project engine by Lumeer.
the class OrganizationServiceIT method testUpdateOrganization.
@Test
public void testUpdateOrganization() {
createOrganization(CODE1);
Organization updatedOrganization = new JsonOrganization(CODE2, NAME, ICON, COLOR, null, null);
Entity entity = Entity.json(updatedOrganization);
Response response = client.target(ORGANIZATION_URL).path(CODE1).request(MediaType.APPLICATION_JSON).buildPut(entity).invoke();
assertThat(response).isNotNull();
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
Organization returnedOrganization = response.readEntity(JsonOrganization.class);
SoftAssertions assertions = new SoftAssertions();
assertions.assertThat(returnedOrganization.getCode()).isEqualTo(CODE2);
assertions.assertThat(returnedOrganization.getName()).isEqualTo(NAME);
assertions.assertThat(returnedOrganization.getIcon()).isEqualTo(ICON);
assertions.assertThat(returnedOrganization.getColor()).isEqualTo(COLOR);
assertions.assertThat(returnedOrganization.getPermissions().getUserPermissions()).containsOnly(USER_PERMISSION);
assertions.assertThat(returnedOrganization.getPermissions().getGroupPermissions()).isEmpty();
assertions.assertAll();
Organization storedOrganization = organizationFacade.getOrganization(CODE2);
assertThat(storedOrganization).isNotNull();
assertions = new SoftAssertions();
assertions.assertThat(storedOrganization.getCode()).isEqualTo(CODE2);
assertions.assertThat(storedOrganization.getName()).isEqualTo(NAME);
assertions.assertThat(storedOrganization.getIcon()).isEqualTo(ICON);
assertions.assertThat(storedOrganization.getColor()).isEqualTo(COLOR);
assertions.assertThat(storedOrganization.getPermissions().getUserPermissions()).containsOnly(USER_PERMISSION);
assertions.assertThat(returnedOrganization.getPermissions().getGroupPermissions()).isEmpty();
assertions.assertAll();
}
use of io.lumeer.api.model.Organization in project engine by Lumeer.
the class ProjectServiceIT method configureProject.
@Before
public void configureProject() {
MorphiaOrganization organization = new MorphiaOrganization();
organization.setCode(ORGANIZATION_CODE);
organization.setPermissions(new MorphiaPermissions());
organization.getPermissions().updateUserPermissions(new MorphiaPermission(USER, Role.toStringRoles(new HashSet<>(Arrays.asList(Role.WRITE, Role.READ, Role.MANAGE)))));
Organization storedOrganization = organizationDao.createOrganization(organization);
projectDao.setOrganization(storedOrganization);
User user = new User(USER);
userDao.createUser(user);
}
Aggregations