use of org.eclipse.che.multiuser.resource.spi.impl.FreeResourcesLimitImpl in project che-server by eclipse-che.
the class FreeResourcesLimitDaoTest method shouldUpdateResourcesLimitWhenStoringExistentOne.
@Test
public void shouldUpdateResourcesLimitWhenStoringExistentOne() throws Exception {
// given
FreeResourcesLimitImpl toStore = new FreeResourcesLimitImpl(limits[0].getAccountId(), singletonList(new ResourceImpl(TEST_RESOURCE_TYPE, 1000, "unit")));
// when
limitDao.store(toStore);
// then
assertEquals(limitDao.get(toStore.getAccountId()), new FreeResourcesLimitImpl(toStore));
}
use of org.eclipse.che.multiuser.resource.spi.impl.FreeResourcesLimitImpl in project devspaces-images by redhat-developer.
the class FreeResourcesLimitDaoTest method shouldGetResourcesLimitForSpecifiedAccountId.
@Test
public void shouldGetResourcesLimitForSpecifiedAccountId() throws Exception {
// given
FreeResourcesLimitImpl stored = limits[0];
// when
FreeResourcesLimitImpl fetched = limitDao.get(stored.getAccountId());
// then
assertEquals(fetched, stored);
}
use of org.eclipse.che.multiuser.resource.spi.impl.FreeResourcesLimitImpl in project devspaces-images by redhat-developer.
the class FreeResourcesLimitDaoTest method shouldRemoveResourcesLimit.
@Test(expectedExceptions = NotFoundException.class)
public void shouldRemoveResourcesLimit() throws Exception {
// given
FreeResourcesLimitImpl existedLimit = limits[0];
// when
limitDao.remove(existedLimit.getAccountId());
// then
limitDao.get(existedLimit.getAccountId());
}
use of org.eclipse.che.multiuser.resource.spi.impl.FreeResourcesLimitImpl in project devspaces-images by redhat-developer.
the class FreeResourcesLimitDaoTest method shouldUpdateResourcesLimitWhenStoringExistentOne.
@Test
public void shouldUpdateResourcesLimitWhenStoringExistentOne() throws Exception {
// given
FreeResourcesLimitImpl toStore = new FreeResourcesLimitImpl(limits[0].getAccountId(), singletonList(new ResourceImpl(TEST_RESOURCE_TYPE, 1000, "unit")));
// when
limitDao.store(toStore);
// then
assertEquals(limitDao.get(toStore.getAccountId()), new FreeResourcesLimitImpl(toStore));
}
use of org.eclipse.che.multiuser.resource.spi.impl.FreeResourcesLimitImpl in project devspaces-images by redhat-developer.
the class ResourceTckModule 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<TckRepository<FreeResourcesLimitImpl>>() {
}).toInstance(new JpaTckRepository<>(FreeResourcesLimitImpl.class));
bind(new TypeLiteral<TckRepository<AccountImpl>>() {
}).toInstance(new JpaTckRepository<>(AccountImpl.class));
bind(FreeResourcesLimitDao.class).to(JpaFreeResourcesLimitDao.class);
}
Aggregations