Search in sources :

Example 1 with StoppingSystemServiceEvent

use of org.eclipse.che.api.system.shared.event.service.StoppingSystemServiceEvent 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 2 with StoppingSystemServiceEvent

use of org.eclipse.che.api.system.shared.event.service.StoppingSystemServiceEvent in project che by eclipse.

the class SystemTerminatorTest method executesTerminations.

@Test
public void executesTerminations() throws Exception {
    terminator.terminateAll();
    verify(termination1).terminate();
    verify(termination2).terminate();
    verify(eventService).publish(new StoppingSystemServiceEvent("service1"));
    verify(eventService).publish(new SystemServiceStoppedEvent("service1"));
    verify(eventService).publish(new StoppingSystemServiceEvent("service2"));
    verify(eventService).publish(new SystemServiceStoppedEvent("service2"));
}
Also used : StoppingSystemServiceEvent(org.eclipse.che.api.system.shared.event.service.StoppingSystemServiceEvent) SystemServiceStoppedEvent(org.eclipse.che.api.system.shared.event.service.SystemServiceStoppedEvent) Test(org.testng.annotations.Test)

Example 3 with StoppingSystemServiceEvent

use of org.eclipse.che.api.system.shared.event.service.StoppingSystemServiceEvent in project che by eclipse.

the class ServiceTerminator method terminateAll.

/**
     * Terminates system services.
     *
     * @throws InterruptedException
     *         when termination is interrupted
     */
void terminateAll() throws InterruptedException {
    for (ServiceTermination termination : terminations) {
        LOG.info("Shutting down '{}' service", termination.getServiceName());
        eventService.publish(new StoppingSystemServiceEvent(termination.getServiceName()));
        try {
            termination.terminate();
        } catch (InterruptedException x) {
            LOG.error("Interrupted while waiting for '{}' service to shutdown", termination.getServiceName());
            throw x;
        }
        LOG.info("Service '{}' is shut down", termination.getServiceName());
        eventService.publish(new SystemServiceStoppedEvent(termination.getServiceName()));
    }
}
Also used : StoppingSystemServiceEvent(org.eclipse.che.api.system.shared.event.service.StoppingSystemServiceEvent) SystemServiceStoppedEvent(org.eclipse.che.api.system.shared.event.service.SystemServiceStoppedEvent)

Example 4 with StoppingSystemServiceEvent

use of org.eclipse.che.api.system.shared.event.service.StoppingSystemServiceEvent in project che by eclipse.

the class DtoConverterTest method convertsSystemServiceStoppingEvent.

@Test
public void convertsSystemServiceStoppingEvent() {
    StoppingSystemServiceEvent event = new StoppingSystemServiceEvent("service1");
    SystemServiceEventDto dto = DtoConverter.asDto(event);
    assertEquals(dto.getType(), EventType.STOPPING_SERVICE);
    assertEquals(dto.getService(), event.getServiceName());
}
Also used : SystemServiceEventDto(org.eclipse.che.api.system.shared.dto.SystemServiceEventDto) StoppingSystemServiceEvent(org.eclipse.che.api.system.shared.event.service.StoppingSystemServiceEvent) Test(org.testng.annotations.Test)

Aggregations

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