Search in sources :

Example 1 with SystemStatusChangedEvent

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();
    }
}
Also used : SystemStatusChangedEvent(org.eclipse.che.api.system.shared.event.SystemStatusChangedEvent)

Example 2 with SystemStatusChangedEvent

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());
}
Also used : SystemStatusChangedEvent(org.eclipse.che.api.system.shared.event.SystemStatusChangedEvent) SystemStatusChangedEventDto(org.eclipse.che.api.system.shared.dto.SystemStatusChangedEventDto) Test(org.testng.annotations.Test)

Example 3 with SystemStatusChangedEvent

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) } };
}
Also used : SystemStatusChangedEvent(org.eclipse.che.api.system.shared.event.SystemStatusChangedEvent) SystemServiceItemStoppedEvent(org.eclipse.che.api.system.shared.event.service.SystemServiceItemStoppedEvent) StoppingSystemServiceEvent(org.eclipse.che.api.system.shared.event.service.StoppingSystemServiceEvent) SystemServiceStoppedEvent(org.eclipse.che.api.system.shared.event.service.SystemServiceStoppedEvent) DataProvider(org.testng.annotations.DataProvider)

Example 4 with SystemStatusChangedEvent

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));
}
Also used : SystemStatusChangedEvent(org.eclipse.che.api.system.shared.event.SystemStatusChangedEvent)

Aggregations

SystemStatusChangedEvent (org.eclipse.che.api.system.shared.event.SystemStatusChangedEvent)4 SystemStatusChangedEventDto (org.eclipse.che.api.system.shared.dto.SystemStatusChangedEventDto)1 StoppingSystemServiceEvent (org.eclipse.che.api.system.shared.event.service.StoppingSystemServiceEvent)1 SystemServiceItemStoppedEvent (org.eclipse.che.api.system.shared.event.service.SystemServiceItemStoppedEvent)1 SystemServiceStoppedEvent (org.eclipse.che.api.system.shared.event.service.SystemServiceStoppedEvent)1 DataProvider (org.testng.annotations.DataProvider)1 Test (org.testng.annotations.Test)1