Search in sources :

Example 1 with RuntimeStartInterruptedException

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();
}
Also used : RuntimeStartInterruptedException(org.eclipse.che.api.workspace.server.spi.RuntimeStartInterruptedException) Test(org.testng.annotations.Test)

Example 2 with RuntimeStartInterruptedException

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);
}
Also used : RuntimeStartInterruptedException(org.eclipse.che.api.workspace.server.spi.RuntimeStartInterruptedException) InternalInfrastructureException(org.eclipse.che.api.workspace.server.spi.InternalInfrastructureException) InfrastructureException(org.eclipse.che.api.workspace.server.spi.InfrastructureException) Test(org.testng.annotations.Test)

Example 3 with RuntimeStartInterruptedException

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);
}
Also used : RuntimeStartInterruptedException(org.eclipse.che.api.workspace.server.spi.RuntimeStartInterruptedException) Test(org.testng.annotations.Test)

Example 4 with RuntimeStartInterruptedException

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);
    }
}
Also used : RuntimeStartInterruptedException(org.eclipse.che.api.workspace.server.spi.RuntimeStartInterruptedException) CompletionException(java.util.concurrent.CompletionException) Test(org.testng.annotations.Test)

Example 5 with RuntimeStartInterruptedException

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();
}
Also used : RuntimeStartInterruptedException(org.eclipse.che.api.workspace.server.spi.RuntimeStartInterruptedException) Test(org.testng.annotations.Test)

Aggregations

RuntimeStartInterruptedException (org.eclipse.che.api.workspace.server.spi.RuntimeStartInterruptedException)16 Test (org.testng.annotations.Test)10 InfrastructureException (org.eclipse.che.api.workspace.server.spi.InfrastructureException)6 InternalInfrastructureException (org.eclipse.che.api.workspace.server.spi.InternalInfrastructureException)6 CompletableFuture (java.util.concurrent.CompletableFuture)4 ExecutionException (java.util.concurrent.ExecutionException)4 TimeoutException (java.util.concurrent.TimeoutException)4 Scope (io.opentracing.Scope)2 Span (io.opentracing.Span)2 LinkedHashMap (java.util.LinkedHashMap)2 CompletionException (java.util.concurrent.CompletionException)2 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)2 ValidationException (org.eclipse.che.api.core.ValidationException)2 StateException (org.eclipse.che.api.workspace.server.spi.StateException)2 EnvironmentContext (org.eclipse.che.commons.env.EnvironmentContext)2 KubernetesMachineImpl (org.eclipse.che.workspace.infrastructure.kubernetes.model.KubernetesMachineImpl)2