use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl in project che by eclipse.
the class WorkspaceManagerTest method createsSnapshotBeforeStoppingWorkspace.
@Test
public void createsSnapshotBeforeStoppingWorkspace() throws Exception {
WorkspaceImpl workspace = createAndMockWorkspace();
mockRuntime(workspace, RUNNING);
workspaceManager.stopWorkspace(workspace.getId(), true);
captureRunAsyncCallsAndRunSynchronously();
verify(runtimes).snapshot(workspace.getId());
}
use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl in project che by eclipse.
the class WorkspaceManagerTest method workspaceUpdateShouldReturnWorkspaceWithStatusEqualToItsRuntimeStatus.
@Test
public void workspaceUpdateShouldReturnWorkspaceWithStatusEqualToItsRuntimeStatus() throws Exception {
final WorkspaceImpl workspace = createAndMockWorkspace();
mockRuntime(workspace, STARTING);
final WorkspaceImpl updated = workspaceManager.updateWorkspace(workspace.getId(), workspace);
assertEquals(updated.getStatus(), STARTING);
}
use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl in project che by eclipse.
the class WorkspaceManagerTest method shouldBeAbleToGetWorkspacesByNamespace.
@Test
public void shouldBeAbleToGetWorkspacesByNamespace() throws Exception {
// given
final WorkspaceImpl workspace = createAndMockWorkspace();
mockRuntime(workspace, RUNNING);
// when
final List<WorkspaceImpl> result = workspaceManager.getByNamespace(workspace.getNamespace(), true);
// then
assertEquals(result.size(), 1);
final WorkspaceImpl res1 = result.get(0);
assertEquals(res1.getStatus(), RUNNING, "Workspace status wasn't changed to the runtime instance status");
assertFalse(res1.isTemporary(), "Workspace must be permanent");
}
use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl in project che by eclipse.
the class WorkspaceManagerTest method shouldRemoveTemporaryWorkspaceAfterStartFailed.
@Test
public void shouldRemoveTemporaryWorkspaceAfterStartFailed() throws Exception {
WorkspaceImpl workspace = createAndMockWorkspace();
workspace.setTemporary(true);
mockRuntime(workspace, RUNNING);
doThrow(new ServerException("")).when(runtimes).stop(workspace.getId());
workspaceManager.stopWorkspace(workspace.getId());
captureRunAsyncCallsAndRunSynchronously();
verify(workspaceDao).remove(workspace.getId());
}
use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl in project che by eclipse.
the class WorkspaceManagerTest method passedCreateSnapshotParameterIsUsedInPreferenceToAttribute.
@Test
public void passedCreateSnapshotParameterIsUsedInPreferenceToAttribute() throws Exception {
final WorkspaceImpl workspace = createAndMockWorkspace();
workspace.getAttributes().put(AUTO_CREATE_SNAPSHOT, "true");
mockRuntime(workspace, RUNNING);
workspaceManager.stopWorkspace(workspace.getId(), false);
captureRunAsyncCallsAndRunSynchronously();
verify(runtimes, never()).snapshot(workspace.getId());
}
Aggregations