use of org.eclipse.che.api.system.shared.event.service.SystemServiceStoppedEvent in project che by eclipse.
the class DtoConverterTest method convertsSystemServiceStoppedEvent.
@Test
public void convertsSystemServiceStoppedEvent() {
SystemServiceStoppedEvent event = new SystemServiceStoppedEvent("service1");
SystemServiceEventDto dto = DtoConverter.asDto(event);
assertEquals(dto.getType(), EventType.SERVICE_STOPPED);
assertEquals(dto.getService(), event.getServiceName());
}
use of org.eclipse.che.api.system.shared.event.service.SystemServiceStoppedEvent 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.SystemServiceStoppedEvent in project che by eclipse.
the class SystemEventsWebsocketBroadcasterTest method sendExceptionsAreLoggedAndNotThrown.
@Test
public void sendExceptionsAreLoggedAndNotThrown() throws Exception {
doThrow(new IOException("exception!")).when(messageCustomer).writeLine(anyString());
broadcaster.onEvent(new SystemServiceStoppedEvent("service1"));
}
use of org.eclipse.che.api.system.shared.event.service.SystemServiceStoppedEvent 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.SystemServiceStoppedEvent 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()));
}
}
Aggregations