use of org.eclipse.che.api.workspace.server.spi.RuntimeStartInterruptedException in project che-server by eclipse-che.
the class StartSynchronizerTest method shouldRethrowOriginalExceptionIfStartCompletedExceptionallyOnCompletion.
@Test(expectedExceptions = RuntimeStartInterruptedException.class)
public void shouldRethrowOriginalExceptionIfStartCompletedExceptionallyOnCompletion() throws Exception {
// given
startSynchronizer.completeExceptionally(new RuntimeStartInterruptedException(runtimeId));
// when
startSynchronizer.complete();
}
use of org.eclipse.che.api.workspace.server.spi.RuntimeStartInterruptedException in project che-server by eclipse-che.
the class StartSynchronizerTest method shouldReturnStartFailureWhenItIsCompletedExceptionally.
@Test
public void shouldReturnStartFailureWhenItIsCompletedExceptionally() {
// given
InfrastructureException toThrow = new RuntimeStartInterruptedException(runtimeId);
startSynchronizer.completeExceptionally(toThrow);
// when
InfrastructureException startFailure = startSynchronizer.getStartFailureNow();
// then
assertTrue(startFailure instanceof RuntimeStartInterruptedException);
assertEquals(startFailure, toThrow);
}
use of org.eclipse.che.api.workspace.server.spi.RuntimeStartInterruptedException in project che-server by eclipse-che.
the class StartSynchronizerTest method shouldAwaitTerminationWhenItIsCompletedExceptionally.
@Test
public void shouldAwaitTerminationWhenItIsCompletedExceptionally() throws Exception {
// given
startSynchronizer.completeExceptionally(new RuntimeStartInterruptedException(runtimeId));
// when
boolean isInterrupted = startSynchronizer.awaitInterruption(1, TimeUnit.SECONDS);
// then
assertTrue(isInterrupted);
}
use of org.eclipse.che.api.workspace.server.spi.RuntimeStartInterruptedException in project che-server by eclipse-che.
the class StartSynchronizerTest method testFailureStartCompletion.
@Test
public void testFailureStartCompletion() throws Exception {
// given
startSynchronizer.setStartThread();
RuntimeStartInterruptedException expected = new RuntimeStartInterruptedException(runtimeId);
// when
startSynchronizer.completeExceptionally(expected);
// then
assertTrue(startSynchronizer.isCompleted());
assertTrue(startSynchronizer.getStartFailure().isCompletedExceptionally());
try {
startSynchronizer.getStartFailure().getNow(null);
fail("Start failure is empty");
} catch (CompletionException actual) {
assertEquals(actual.getCause(), expected);
}
}
use of org.eclipse.che.api.workspace.server.spi.RuntimeStartInterruptedException in project che-server by eclipse-che.
the class StartSynchronizerTest method shouldThrowExceptionOnCheckingFailureIfStartIsCompletedExceptionally.
@Test(expectedExceptions = RuntimeStartInterruptedException.class)
public void shouldThrowExceptionOnCheckingFailureIfStartIsCompletedExceptionally() throws Exception {
// given
startSynchronizer.start();
RuntimeStartInterruptedException expected = new RuntimeStartInterruptedException(runtimeId);
startSynchronizer.completeExceptionally(expected);
// when
startSynchronizer.checkFailure();
}
Aggregations