Search in sources :

Example 51 with OrganizationImpl

use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl in project che-server by eclipse-che.

the class OrganizationDaoTest method shouldThrowConflictExceptionOnUpdatingOrganizationNameToExistingOne.

@Test(expectedExceptions = ConflictException.class)
public void shouldThrowConflictExceptionOnUpdatingOrganizationNameToExistingOne() throws Exception {
    final OrganizationImpl toUpdate = new OrganizationImpl(organizations[0].getId(), organizations[1].getName(), "new-parent");
    organizationDao.update(toUpdate);
}
Also used : OrganizationImpl(org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl) Test(org.testng.annotations.Test)

Example 52 with OrganizationImpl

use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl in project che-server by eclipse-che.

the class OrganizationDaoTest method setUp.

@BeforeMethod
private void setUp() throws TckRepositoryException {
    organizations = new OrganizationImpl[2];
    organizations[0] = new OrganizationImpl(NameGenerator.generate("organization", 10), "test1", null);
    organizations[1] = new OrganizationImpl(NameGenerator.generate("organization", 10), "test2", null);
    tckRepository.createAll(asList(organizations));
}
Also used : OrganizationImpl(org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 53 with OrganizationImpl

use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl in project che-server by eclipse-che.

the class OrganizationDaoTest method shouldThrowConflictExceptionOnCreatingOrganizationWithExistingName.

@Test(expectedExceptions = ConflictException.class)
public void shouldThrowConflictExceptionOnCreatingOrganizationWithExistingName() throws Exception {
    final OrganizationImpl organization = new OrganizationImpl("organization123", organizations[0].getName(), null);
    organizationDao.create(organization);
    assertEquals(organizationDao.getById(organization.getId()), organization);
}
Also used : OrganizationImpl(org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl) Test(org.testng.annotations.Test)

Example 54 with OrganizationImpl

use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl in project che-server by eclipse-che.

the class OrganizationDaoTest method shouldGetOrganizationById.

@Test
public void shouldGetOrganizationById() throws Exception {
    final OrganizationImpl organization = organizations[0];
    final OrganizationImpl found = organizationDao.getById(organization.getId());
    assertEquals(organization, found);
}
Also used : OrganizationImpl(org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl) Test(org.testng.annotations.Test)

Example 55 with OrganizationImpl

use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl in project che-server by eclipse-che.

the class OrganizationDaoTest method shouldCreateOrganization.

@Test
public void shouldCreateOrganization() throws Exception {
    final OrganizationImpl organization = new OrganizationImpl("organization123", "Test", null);
    organizationDao.create(organization);
    assertEquals(organizationDao.getById(organization.getId()), organization);
}
Also used : OrganizationImpl(org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl) Test(org.testng.annotations.Test)

Aggregations

OrganizationImpl (org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl)100 Test (org.testng.annotations.Test)56 Transactional (com.google.inject.persist.Transactional)18 BeforeMethod (org.testng.annotations.BeforeMethod)16 EntityManager (javax.persistence.EntityManager)14 MemberImpl (org.eclipse.che.multiuser.organization.spi.impl.MemberImpl)14 Organization (org.eclipse.che.multiuser.organization.shared.model.Organization)13 Response (io.restassured.response.Response)12 Page (org.eclipse.che.api.core.Page)10 ServerException (org.eclipse.che.api.core.ServerException)8 UserImpl (org.eclipse.che.api.user.server.model.impl.UserImpl)8 OrganizationDao (org.eclipse.che.multiuser.organization.spi.OrganizationDao)8 OrganizationDistributedResourcesImpl (org.eclipse.che.multiuser.organization.spi.impl.OrganizationDistributedResourcesImpl)7 TypeLiteral (com.google.inject.TypeLiteral)6 JpaPersistModule (com.google.inject.persist.jpa.JpaPersistModule)6 NotFoundException (org.eclipse.che.api.core.NotFoundException)6 OrganizationDto (org.eclipse.che.multiuser.organization.shared.dto.OrganizationDto)6 UserDevfilePermissionImpl (org.eclipse.che.multiuser.permission.devfile.server.model.impl.UserDevfilePermissionImpl)6 TckResourcesCleaner (org.eclipse.che.commons.test.tck.TckResourcesCleaner)5 DBInitializer (org.eclipse.che.core.db.DBInitializer)5