use of org.eclipse.che.api.system.shared.event.SystemStatusChangedEvent in project che by eclipse.
the class SystemManager method doStopServices.
/** Synchronously stops corresponding services. */
private void doStopServices() {
LOG.info("Preparing system to shutdown");
eventService.publish(new SystemStatusChangedEvent(RUNNING, PREPARING_TO_SHUTDOWN));
try {
terminator.terminateAll();
statusRef.set(READY_TO_SHUTDOWN);
eventService.publish(new SystemStatusChangedEvent(PREPARING_TO_SHUTDOWN, READY_TO_SHUTDOWN));
LOG.info("System is ready to shutdown");
} catch (InterruptedException x) {
LOG.error("Interrupted while waiting for system service to shutdown components");
Thread.currentThread().interrupt();
} finally {
shutdownLatch.countDown();
}
}
use of org.eclipse.che.api.system.shared.event.SystemStatusChangedEvent in project che by eclipse.
the class DtoConverterTest method convertsSystemStatusChangedEvent.
@Test
public void convertsSystemStatusChangedEvent() {
SystemStatusChangedEvent event = new SystemStatusChangedEvent(RUNNING, PREPARING_TO_SHUTDOWN);
SystemStatusChangedEventDto dto = DtoConverter.asDto(event);
assertEquals(dto.getType(), EventType.STATUS_CHANGED);
assertEquals(dto.getPrevStatus(), event.getPrevStatus());
assertEquals(dto.getStatus(), event.getStatus());
}
use of org.eclipse.che.api.system.shared.event.SystemStatusChangedEvent in project che by eclipse.
the class SystemEventsWebsocketBroadcasterTest method eventToDto.
@DataProvider(name = "eventToDto")
private static Object[][] eventToDto() {
SystemStatusChangedEvent statusChanged = new SystemStatusChangedEvent(RUNNING, PREPARING_TO_SHUTDOWN);
StoppingSystemServiceEvent stoppingService = new StoppingSystemServiceEvent("service1");
SystemServiceStoppedEvent serviceStopped = new SystemServiceStoppedEvent("service1");
SystemServiceItemStoppedEvent itemStopped = new SystemServiceItemStoppedEvent("service1", "item1", 5, 10);
return new Object[][] { { statusChanged, DtoConverter.asDto(statusChanged) }, { stoppingService, DtoConverter.asDto(stoppingService) }, { serviceStopped, DtoConverter.asDto(serviceStopped) }, { itemStopped, DtoConverter.asDto(itemStopped) } };
}
use of org.eclipse.che.api.system.shared.event.SystemStatusChangedEvent in project che by eclipse.
the class SystemManagerTest method verifyShutdownCompleted.
private void verifyShutdownCompleted() throws InterruptedException {
verify(terminator, timeout(2000)).terminateAll();
verify(eventService, times(2)).publish(eventsCaptor.capture());
Iterator<SystemStatusChangedEvent> eventsIt = eventsCaptor.getAllValues().iterator();
assertEquals(eventsIt.next(), new SystemStatusChangedEvent(RUNNING, PREPARING_TO_SHUTDOWN));
assertEquals(eventsIt.next(), new SystemStatusChangedEvent(PREPARING_TO_SHUTDOWN, READY_TO_SHUTDOWN));
}
Aggregations