use of org.eclipse.che.api.machine.server.model.impl.SnapshotImpl in project che by eclipse.
the class SnapshotDaoTest method shouldNotSaveSnapshotWithReservedId.
@Test(expectedExceptions = SnapshotException.class)
public void shouldNotSaveSnapshotWithReservedId() throws Exception {
final SnapshotImpl snapshot = snapshots[0];
snapshot.setWorkspaceId("new-workspace");
snapshot.setEnvName("new-env");
snapshot.setMachineName("new-machine");
snapshotDao.saveSnapshot(snapshot);
}
use of org.eclipse.che.api.machine.server.model.impl.SnapshotImpl in project che by eclipse.
the class CheEnvironmentEngineTest method shouldBeAbleToRemoveSnapshot.
@Test
public void shouldBeAbleToRemoveSnapshot() throws Exception {
// given
SnapshotImpl snapshot = mock(SnapshotImpl.class);
MachineSourceImpl machineSource = mock(MachineSourceImpl.class);
when(snapshot.getType()).thenReturn("docker");
when(snapshot.getMachineSource()).thenReturn(machineSource);
// when
engine.removeSnapshot(snapshot);
// then
verify(instanceProvider).removeInstanceSnapshot(machineSource);
}
use of org.eclipse.che.api.machine.server.model.impl.SnapshotImpl in project che by eclipse.
the class JpaTckModule method configure.
@Override
protected void configure() {
install(new JpaPersistModule("main"));
bind(DBInitializer.class).asEagerSingleton();
bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(H2TestHelper.inMemoryDefault(), "che-schema"));
bind(TckResourcesCleaner.class).to(H2JpaCleaner.class);
bind(new TypeLiteral<TckRepository<RecipeImpl>>() {
}).toInstance(new JpaTckRepository<>(RecipeImpl.class));
bind(new TypeLiteral<TckRepository<SnapshotImpl>>() {
}).toInstance(new JpaTckRepository<>(SnapshotImpl.class));
bind(new TypeLiteral<TckRepository<Workspace>>() {
}).toInstance(new TestWorkspacesTckRepository());
bind(new TypeLiteral<TckRepository<AccountImpl>>() {
}).toInstance(new JpaTckRepository<>(AccountImpl.class));
bind(RecipeDao.class).to(JpaRecipeDao.class);
bind(SnapshotDao.class).to(JpaSnapshotDao.class);
}
use of org.eclipse.che.api.machine.server.model.impl.SnapshotImpl in project che by eclipse.
the class SnapshotDaoTest method shouldRemoveSnapshot.
@Test(expectedExceptions = NotFoundException.class, dependsOnMethods = "shouldThrowNotFoundExceptionWhenGettingNonExistingSnapshot")
public void shouldRemoveSnapshot() throws Exception {
final SnapshotImpl snapshot = snapshots[0];
try {
snapshotDao.removeSnapshot(snapshot.getId());
} catch (NotFoundException x) {
fail("Should remove snapshot");
}
snapshotDao.getSnapshot(snapshot.getId());
}
use of org.eclipse.che.api.machine.server.model.impl.SnapshotImpl in project che by eclipse.
the class SnapshotDaoTest method shouldNotSaveSnapshotForMachineIfSnapshotForSuchMachineAlreadyExists.
@Test(expectedExceptions = SnapshotException.class)
public void shouldNotSaveSnapshotForMachineIfSnapshotForSuchMachineAlreadyExists() throws Exception {
final SnapshotImpl snapshot = snapshots[0];
snapshot.setId("new-id");
snapshotDao.saveSnapshot(snapshot);
}
Aggregations