use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl in project che by eclipse.
the class WorkspaceManagerTest method shouldStartWorkspaceFromSnapshotUsingDefaultValueForAutoRestore.
@Test
public void shouldStartWorkspaceFromSnapshotUsingDefaultValueForAutoRestore() throws Exception {
workspaceManager = new WorkspaceManager(workspaceDao, runtimes, eventService, accountManager, false, true, snapshotDao, sharedPool);
WorkspaceImpl workspace = createAndMockWorkspace();
mockStart(workspace);
mockSnapshots(workspace, 12345L);
workspaceManager.startWorkspace(workspace.getId(), workspace.getConfig().getDefaultEnv(), null);
verify(runtimes).startAsync(workspace, workspace.getConfig().getDefaultEnv(), true);
}
use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl in project che by eclipse.
the class WorkspaceManagerTest method snapshottedAtAttributeIncludedToWorkspaceWhenGettingByKey.
@Test
public void snapshottedAtAttributeIncludedToWorkspaceWhenGettingByKey() throws Exception {
WorkspaceImpl workspace = createAndMockWorkspace();
mockSnapshots(workspace, 12345);
WorkspaceImpl result = workspaceManager.getWorkspace(workspace.getId());
assertEquals(result.getAttributes().get(SNAPSHOTTED_AT_ATTRIBUTE_NAME), "12345");
}
use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl in project che by eclipse.
the class WorkspaceManagerTest method workspaceStartShouldUseDefaultEnvIfNullEnvNameProvided.
@Test
public void workspaceStartShouldUseDefaultEnvIfNullEnvNameProvided() throws Exception {
final WorkspaceImpl workspace = createAndMockWorkspace();
mockStart(workspace);
workspaceManager.startWorkspace(workspace.getId(), null, null);
verify(runtimes).startAsync(workspace, workspace.getConfig().getDefaultEnv(), false);
}
use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl in project che by eclipse.
the class WorkspaceManagerTest method shouldBeAbleToGetWorkspaceByKeyPreviousFormat.
@Test
public void shouldBeAbleToGetWorkspaceByKeyPreviousFormat() throws Exception {
WorkspaceImpl workspace = createAndMockWorkspace();
WorkspaceImpl result = workspaceManager.getWorkspace(workspace.getNamespace() + ":" + workspace.getConfig().getName());
assertEquals(result, workspace);
}
use of org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl in project che by eclipse.
the class WorkspaceManagerTest method shouldBeAbleToStopWorkspace.
@Test
public void shouldBeAbleToStopWorkspace() throws Exception {
WorkspaceImpl workspace = createAndMockWorkspace(createConfig(), NAMESPACE);
mockRuntime(workspace, RUNNING);
// when
workspaceManager.stopWorkspace(workspace.getId());
// then
captureRunAsyncCallsAndRunSynchronously();
verify(runtimes).stop(workspace.getId());
verify(workspaceDao).update(workspaceCaptor.capture());
WorkspaceImpl updated = workspaceCaptor.getValue();
assertNotNull(updated.getAttributes().get(UPDATED_ATTRIBUTE_NAME));
}
Aggregations