Search in sources :

Example 91 with WorkspaceImpl

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);
}
Also used : WorkspaceImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl) Test(org.testng.annotations.Test)

Example 92 with WorkspaceImpl

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");
}
Also used : WorkspaceImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl) Test(org.testng.annotations.Test)

Example 93 with WorkspaceImpl

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);
}
Also used : WorkspaceImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl) Test(org.testng.annotations.Test)

Example 94 with WorkspaceImpl

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);
}
Also used : WorkspaceImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl) Test(org.testng.annotations.Test)

Example 95 with WorkspaceImpl

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));
}
Also used : WorkspaceImpl(org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl) Test(org.testng.annotations.Test)

Aggregations

WorkspaceImpl (org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl)165 Test (org.testng.annotations.Test)130 Response (com.jayway.restassured.response.Response)34 WorkspaceRuntimeImpl (org.eclipse.che.api.workspace.server.model.impl.WorkspaceRuntimeImpl)15 ServerException (org.eclipse.che.api.core.ServerException)14 SnapshotImpl (org.eclipse.che.api.machine.server.model.impl.SnapshotImpl)12 ApiOperation (io.swagger.annotations.ApiOperation)11 ApiResponses (io.swagger.annotations.ApiResponses)11 AccountImpl (org.eclipse.che.account.spi.AccountImpl)11 Path (javax.ws.rs.Path)10 Produces (javax.ws.rs.Produces)10 WorkspaceDto (org.eclipse.che.api.workspace.shared.dto.WorkspaceDto)10 EnvironmentImpl (org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl)9 WorkspaceConfigImpl (org.eclipse.che.api.workspace.server.model.impl.WorkspaceConfigImpl)9 NotFoundException (org.eclipse.che.api.core.NotFoundException)8 MachineImpl (org.eclipse.che.api.machine.server.model.impl.MachineImpl)8 Consumes (javax.ws.rs.Consumes)7 ConflictException (org.eclipse.che.api.core.ConflictException)7 ExtendedMachineImpl (org.eclipse.che.api.workspace.server.model.impl.ExtendedMachineImpl)7 ProjectConfigImpl (org.eclipse.che.api.workspace.server.model.impl.ProjectConfigImpl)7