use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl in project che-server by eclipse-che.
the class OrganizationDistributedResourcesDaoTest method setUp.
@BeforeMethod
private void setUp() throws Exception {
parentOrganization = new OrganizationImpl("parentOrg", "parentOrgName", null);
suborganizations = new OrganizationImpl[ORGANIZATION_RESOURCES_COUNT];
distributedResources = new OrganizationDistributedResourcesImpl[ORGANIZATION_RESOURCES_COUNT];
for (int i = 0; i < ORGANIZATION_RESOURCES_COUNT; i++) {
suborganizations[i] = new OrganizationImpl("suborgId-" + i, "suborgName" + i, parentOrganization.getId());
distributedResources[i] = new OrganizationDistributedResourcesImpl(suborganizations[i].getId(), singletonList(new ResourceImpl(TEST_RESOURCE_TYPE, i, "test")));
}
organizationsRepository.createAll(Collections.singletonList(parentOrganization));
organizationsRepository.createAll(Arrays.asList(suborganizations));
distributedResourcesRepository.createAll(Arrays.asList(distributedResources));
}
use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl in project che-server by eclipse-che.
the class OrganizationJpaTckModule method configure.
@Override
protected void configure() {
install(new JpaPersistModule("main"));
H2DBTestServer server = H2DBTestServer.startDefault();
bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
bind(DBInitializer.class).asEagerSingleton();
bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));
bind(new TypeLiteral<AbstractPermissionsDomain<MemberImpl>>() {
}).to(OrganizationDomain.class);
bind(new TypeLiteral<TckRepository<OrganizationImpl>>() {
}).to(JpaOrganizationImplTckRepository.class);
bind(new TypeLiteral<TckRepository<UserImpl>>() {
}).toInstance(new JpaTckRepository<>(UserImpl.class));
bind(new TypeLiteral<TckRepository<MemberImpl>>() {
}).toInstance(new JpaTckRepository<>(MemberImpl.class));
bind(new TypeLiteral<TckRepository<OrganizationDistributedResourcesImpl>>() {
}).toInstance(new JpaTckRepository<>(OrganizationDistributedResourcesImpl.class));
bind(OrganizationDao.class).to(JpaOrganizationDao.class);
bind(MemberDao.class).to(JpaMemberDao.class);
bind(OrganizationDistributedResourcesDao.class).to(JpaOrganizationDistributedResourcesDao.class);
}
use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl in project che-server by eclipse-che.
the class OrganizationResourceDistributionServicePermissionsFilterTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
lenient().when(manager.getById(SUBORGANIZATION)).thenReturn(new OrganizationImpl(SUBORGANIZATION, "testOrg", PARENT_ORGANIZATION));
lenient().when(manager.getById(PARENT_ORGANIZATION)).thenReturn(new OrganizationImpl(PARENT_ORGANIZATION, "parentOrg", null));
lenient().when(subject.hasPermission(anyString(), anyString(), anyString())).thenReturn(true);
}
use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl in project che-server by eclipse-che.
the class OrganizationDaoTest method shouldGetByParent.
@Test
public void shouldGetByParent() throws Exception {
final OrganizationImpl parent = organizations[0];
final OrganizationImpl child1 = new OrganizationImpl("child1", "childTest1", parent.getId());
final OrganizationImpl child2 = new OrganizationImpl("child2", "childTest2", parent.getId());
final OrganizationImpl child3 = new OrganizationImpl("child3", "childTest3", parent.getId());
tckRepository.createAll(asList(child1, child2, child3));
final Page<OrganizationImpl> children = organizationDao.getByParent(parent.getId(), 1, 1);
assertEquals(children.getTotalItemsCount(), 3);
assertEquals(children.getItemsCount(), 1);
assertTrue(children.getItems().contains(child1) ^ children.getItems().contains(child2) ^ children.getItems().contains(child3));
}
use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationImpl in project che-server by eclipse-che.
the class OrganizationDaoTest method shouldThrowConflictExceptionOnCreatingOrganizationWithExistingId.
@Test(expectedExceptions = ConflictException.class)
public void shouldThrowConflictExceptionOnCreatingOrganizationWithExistingId() throws Exception {
final OrganizationImpl organization = new OrganizationImpl(organizations[0].getId(), "Test", null);
organizationDao.create(organization);
assertEquals(organizationDao.getById(organization.getId()), organization);
}
Aggregations