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) } };
}
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"));
}
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()));
}
}
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());
}
Aggregations