use of org.eclipse.che.api.core.model.workspace.Runtime in project che-server by eclipse-che.
the class WorkspaceManagerTest method startsWorkspaceShouldCleanPreferences.
@Test
public void startsWorkspaceShouldCleanPreferences() throws Exception {
final WorkspaceImpl workspace = createAndMockWorkspace();
Runtime runtime = mockRuntime(workspace, WorkspaceStatus.RUNNING);
workspace.setRuntime(runtime);
mockAnyWorkspaceStart();
workspaceManager.startWorkspace(workspace.getId(), workspace.getConfig().getDefaultEnv(), emptyMap());
verify(runtimes).startAsync(workspace, workspace.getConfig().getDefaultEnv(), emptyMap());
assertNotNull(workspace.getAttributes().get(UPDATED_ATTRIBUTE_NAME));
verify(preferenceManager).remove("owner", Arrays.asList(LAST_ACTIVITY_TIME, LAST_ACTIVE_INFRASTRUCTURE_NAMESPACE));
}
use of org.eclipse.che.api.core.model.workspace.Runtime in project devspaces-images by redhat-developer.
the class WorkspaceManagerTest method startsWorkspaceShouldCleanPreferences.
@Test
public void startsWorkspaceShouldCleanPreferences() throws Exception {
final WorkspaceImpl workspace = createAndMockWorkspace();
Runtime runtime = mockRuntime(workspace, WorkspaceStatus.RUNNING);
workspace.setRuntime(runtime);
mockAnyWorkspaceStart();
workspaceManager.startWorkspace(workspace.getId(), workspace.getConfig().getDefaultEnv(), emptyMap());
verify(runtimes).startAsync(workspace, workspace.getConfig().getDefaultEnv(), emptyMap());
assertNotNull(workspace.getAttributes().get(UPDATED_ATTRIBUTE_NAME));
verify(preferenceManager).remove("owner", Arrays.asList(LAST_ACTIVITY_TIME, LAST_ACTIVE_INFRASTRUCTURE_NAMESPACE));
}
use of org.eclipse.che.api.core.model.workspace.Runtime in project che-server by eclipse-che.
the class RemoveWorkspaceBeforeAccountRemovedEventSubscriberTest method shouldThrowExceptionIfWorkspaceStopping.
@Test(expectedExceptions = ConflictException.class)
public void shouldThrowExceptionIfWorkspaceStopping() throws Exception {
workspace.setStatus(WorkspaceStatus.STARTING);
Runtime runtime = mock(Runtime.class);
when(runtime.getOwner()).thenReturn(otherUser);
workspace.setRuntime(runtime);
EnvironmentContext.getCurrent().setSubject(SUBJECT);
subscriber.onCascadeEvent(new BeforeAccountRemovedEvent(account));
verify(workspaceManager).stopWorkspace(workspaceId, of(REMOVE_WORKSPACE_AFTER_STOP, "true"));
}
use of org.eclipse.che.api.core.model.workspace.Runtime in project devspaces-images by redhat-developer.
the class RemoveWorkspaceBeforeAccountRemovedEventSubscriberTest method shouldThrowExceptionIfWorkspaceStopping.
@Test(expectedExceptions = ConflictException.class)
public void shouldThrowExceptionIfWorkspaceStopping() throws Exception {
workspace.setStatus(WorkspaceStatus.STARTING);
Runtime runtime = mock(Runtime.class);
when(runtime.getOwner()).thenReturn(otherUser);
workspace.setRuntime(runtime);
EnvironmentContext.getCurrent().setSubject(SUBJECT);
subscriber.onCascadeEvent(new BeforeAccountRemovedEvent(account));
verify(workspaceManager).stopWorkspace(workspaceId, of(REMOVE_WORKSPACE_AFTER_STOP, "true"));
}
Aggregations