use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationDistributedResourcesImpl in project devspaces-images by redhat-developer.
the class OrganizationDistributedResourcesDaoTest method shouldRemoveDistributedResources.
@Test(expectedExceptions = NotFoundException.class)
public void shouldRemoveDistributedResources() throws Exception {
// given
OrganizationDistributedResourcesImpl distributedResource = distributedResources[0];
// when
distributedResourcesDao.remove(distributedResource.getOrganizationId());
// then
distributedResourcesDao.get(distributedResource.getOrganizationId());
}
use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationDistributedResourcesImpl in project devspaces-images by redhat-developer.
the class OrganizationDistributedResourcesDaoTest method shouldGetDistributedResourcesForSpecifiedOrganizationId.
@Test
public void shouldGetDistributedResourcesForSpecifiedOrganizationId() throws Exception {
// given
OrganizationDistributedResourcesImpl stored = distributedResources[0];
// when
OrganizationDistributedResourcesImpl fetched = distributedResourcesDao.get(stored.getOrganizationId());
// then
assertEquals(fetched, copy(stored));
}
use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationDistributedResourcesImpl in project devspaces-images by redhat-developer.
the class JpaOrganizationDistributedResourcesDao method doRemove.
@Transactional
protected void doRemove(String id) {
EntityManager manager = managerProvider.get();
OrganizationDistributedResourcesImpl distributedResources = manager.find(OrganizationDistributedResourcesImpl.class, id);
if (distributedResources != null) {
manager.remove(distributedResources);
manager.flush();
}
}
use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationDistributedResourcesImpl in project devspaces-images by redhat-developer.
the class JpaOrganizationDistributedResourcesDao method doStore.
@Transactional
protected void doStore(OrganizationDistributedResourcesImpl distributedResources) throws ServerException {
EntityManager manager = managerProvider.get();
final OrganizationDistributedResourcesImpl existingDistributedResources = manager.find(OrganizationDistributedResourcesImpl.class, distributedResources.getOrganizationId());
if (existingDistributedResources == null) {
manager.persist(distributedResources);
} else {
existingDistributedResources.getResourcesCap().clear();
existingDistributedResources.getResourcesCap().addAll(distributedResources.getResourcesCap());
}
manager.flush();
}
use of org.eclipse.che.multiuser.organization.spi.impl.OrganizationDistributedResourcesImpl in project devspaces-images by redhat-developer.
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);
}
Aggregations