use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl in project che by eclipse.
the class WorkspaceManagerTest method getsWorkspaceByIdWithoutRuntime.
@Test
public void getsWorkspaceByIdWithoutRuntime() throws Exception {
WorkspaceImpl workspace = createAndMockWorkspace();
final WorkspaceImpl result = workspaceManager.getWorkspace(workspace.getId());
assertEquals(result, workspace);
}
use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl in project che by eclipse.
the class WorkspaceManagerTest method shouldStopWorkspaceEventIfSnapshotCreationFailed.
@Test
public void shouldStopWorkspaceEventIfSnapshotCreationFailed() throws Exception {
WorkspaceImpl workspace = createAndMockWorkspace();
mockRuntime(workspace, RUNNING);
doThrow(new ServerException("Test")).when(runtimes).snapshot(workspace.getId());
workspaceManager.stopWorkspace(workspace.getId(), true);
captureRunAsyncCallsAndRunSynchronously();
verify(runtimes).stop(any());
}
use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl in project che by eclipse.
the class WorkspaceManagerTest method shouldNotRecoverWorkspaceWhenRecoverParameterIsTrueButSnapshotDoesNotExist.
@Test
public void shouldNotRecoverWorkspaceWhenRecoverParameterIsTrueButSnapshotDoesNotExist() throws Exception {
final WorkspaceImpl workspace = createAndMockWorkspace();
mockStart(workspace);
workspaceManager.startWorkspace(workspace.getId(), workspace.getConfig().getDefaultEnv(), true);
verify(runtimes).startAsync(workspace, workspace.getConfig().getDefaultEnv(), false);
assertNotNull(workspace.getAttributes().get(UPDATED_ATTRIBUTE_NAME));
}
use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl in project che by eclipse.
the class WorkspaceServiceTest method shouldRespond404WhenUpdatingCommandWhichDoesNotExist.
@Test
public void shouldRespond404WhenUpdatingCommandWhichDoesNotExist() throws Exception {
final WorkspaceImpl workspace = createWorkspace(createConfigDto());
when(wsManager.getWorkspace(workspace.getId())).thenReturn(workspace);
final Response response = given().auth().basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD).contentType("application/json").body(createCommandDto()).when().put(SECURE_PATH + "/workspace/" + workspace.getId() + "/command/fake");
assertEquals(response.getStatusCode(), 404);
assertEquals(unwrapError(response), "Workspace '" + workspace.getId() + "' doesn't contain command 'fake'");
verify(wsManager, never()).updateWorkspace(any(), any());
}
use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl in project che by eclipse.
the class WorkspaceServiceTest method shouldStopWorkspace.
@Test
public void shouldStopWorkspace() throws Exception {
final WorkspaceImpl workspace = createWorkspace(createConfigDto());
when(wsManager.getWorkspace(workspace.getId())).thenReturn(workspace);
final Response response = given().auth().basic(ADMIN_USER_NAME, ADMIN_USER_PASSWORD).when().delete(SECURE_PATH + "/workspace/" + workspace.getId() + "/runtime");
assertEquals(response.getStatusCode(), 204);
verify(wsManager).stopWorkspace(workspace.getId(), null);
}
Aggregations