use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl in project che-server by eclipse-che.
the class OrganizationServiceTest method shouldUpdateOrganization.
@Test
public void shouldUpdateOrganization() throws Exception {
when(orgManager.update(anyString(), any())).thenAnswer(invocationOnMock -> new OrganizationImpl((Organization) invocationOnMock.getArguments()[1]));
final OrganizationDto toUpdate = createOrganization();
final Response response = given().auth().basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD).contentType("application/json").body(toUpdate).when().post(SECURE_PATH + "/organization/organization123");
assertEquals(response.statusCode(), 200);
final OrganizationDto createdOrganization = unwrapDto(response, OrganizationDto.class);
assertEquals(createdOrganization, toUpdate);
verify(linksInjector).injectLinks(any(), any());
verify(orgManager).update(eq("organization123"), eq(toUpdate));
}
use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl in project che-server by eclipse-che.
the class OrganizationServiceTest method shouldCreateOrganization.
@Test
public void shouldCreateOrganization() throws Exception {
when(orgManager.create(any())).thenAnswer(invocationOnMock -> new OrganizationImpl((Organization) invocationOnMock.getArguments()[0]));
final OrganizationDto toCreate = createOrganization();
final Response response = given().auth().basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD).contentType("application/json").body(toCreate).when().post(SECURE_PATH + "/organization");
assertEquals(response.statusCode(), 201);
final OrganizationDto createdOrganization = unwrapDto(response, OrganizationDto.class);
assertEquals(createdOrganization, toCreate);
verify(linksInjector).injectLinks(any(), any());
verify(orgManager).create(eq(toCreate));
}
use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl in project che-server by eclipse-che.
the class OrganizationPermissionsFilterTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
lenient().when(subject.getUserId()).thenReturn(USER_ID);
lenient().when(manager.getById(anyString())).thenReturn(new OrganizationImpl("organization123", "test", null));
}
use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl in project che-server by eclipse-che.
the class OrganizationManagerTest method shouldGetOrganizationById.
@Test
public void shouldGetOrganizationById() throws Exception {
final OrganizationImpl toFetch = new OrganizationImpl("org123", "toFetchOrg", "org321");
when(organizationDao.getById(eq("org123"))).thenReturn(toFetch);
final Organization fetched = manager.getById("org123");
assertEquals(fetched, toFetch);
verify(organizationDao).getById("org123");
}
use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl in project che-server by eclipse-che.
the class OrganizationManagerTest method shouldGetOrganizationsByMember.
@Test
public void shouldGetOrganizationsByMember() throws Exception {
final OrganizationImpl toFetch = new OrganizationImpl("org123", "toFetchOrg", "org321");
when(memberDao.getOrganizations(eq("org123"), anyInt(), anyLong())).thenReturn(new Page<>(singletonList(toFetch), 0, 1, 1));
final Page<? extends Organization> organizations = manager.getByMember("org123", 30, 0);
assertEquals(organizations.getItemsCount(), 1);
assertEquals(organizations.getItems().get(0), toFetch);
verify(memberDao).getOrganizations("org123", 30, 0);
}
Aggregations