use of org.eclipse.che.api.workspace.server.event.RuntimeAbnormalStoppingEvent in project che-server by eclipse-che.
the class WorkspaceRuntimesTest method stoppingStatusIsSetWhenRuntimeAbnormallyStopping.
@Test
public void stoppingStatusIsSetWhenRuntimeAbnormallyStopping() throws Exception {
String error = "Some kind of error happened";
EventService localEventService = new EventService();
WorkspaceRuntimes localRuntimes = new WorkspaceRuntimes(localEventService, ImmutableMap.of(TEST_ENVIRONMENT_TYPE, testEnvFactory), infrastructure, sharedPool, workspaceDao, dbInitializer, probeScheduler, statuses, lockService, devfileConverter, false);
localRuntimes.init();
RuntimeIdentityDto identity = DtoFactory.newDto(RuntimeIdentityDto.class).withWorkspaceId("workspace123").withEnvName("my-env").withOwnerId("myId");
mockWorkspaceWithConfig(identity);
RuntimeContext context = mockContext(identity);
when(context.getRuntime()).thenReturn(new TestInternalRuntime(context));
RuntimeAbnormalStoppingEvent event = new RuntimeAbnormalStoppingEvent(identity, error);
localRuntimes.recoverOne(infrastructure, identity);
// when
localEventService.publish(event);
// then
verify(statuses).replace("workspace123", WorkspaceStatus.STOPPING);
}
use of org.eclipse.che.api.workspace.server.event.RuntimeAbnormalStoppingEvent in project devspaces-images by redhat-developer.
the class WorkspaceRuntimesTest method stoppingStatusIsSetWhenRuntimeAbnormallyStopping.
@Test
public void stoppingStatusIsSetWhenRuntimeAbnormallyStopping() throws Exception {
String error = "Some kind of error happened";
EventService localEventService = new EventService();
WorkspaceRuntimes localRuntimes = new WorkspaceRuntimes(localEventService, ImmutableMap.of(TEST_ENVIRONMENT_TYPE, testEnvFactory), infrastructure, sharedPool, workspaceDao, dbInitializer, probeScheduler, statuses, lockService, devfileConverter, false);
localRuntimes.init();
RuntimeIdentityDto identity = DtoFactory.newDto(RuntimeIdentityDto.class).withWorkspaceId("workspace123").withEnvName("my-env").withOwnerId("myId");
mockWorkspaceWithConfig(identity);
RuntimeContext context = mockContext(identity);
when(context.getRuntime()).thenReturn(new TestInternalRuntime(context));
RuntimeAbnormalStoppingEvent event = new RuntimeAbnormalStoppingEvent(identity, error);
localRuntimes.recoverOne(infrastructure, identity);
// when
localEventService.publish(event);
// then
verify(statuses).replace("workspace123", WorkspaceStatus.STOPPING);
}
Aggregations