Search in sources :

Example 11 with ServiceState

use of org.bboxdb.commons.ServiceState in project bboxdb by jnidzwetzki.

the class TestServiceState method testTransition6.

/**
 * Force dispatch
 * @throws InterruptedException
 */
@Test(timeout = 1000)
public void testTransition6() throws InterruptedException {
    final ServiceState state = new ServiceState();
    Assert.assertFalse(state.isInFinishedState());
    Assert.assertFalse(state.isInTerminatedState());
    state.forceDispatchToTerminated();
    Assert.assertTrue(state.isInFinishedState());
    Assert.assertTrue(state.isInTerminatedState());
}
Also used : ServiceState(org.bboxdb.commons.ServiceState) Test(org.junit.Test)

Example 12 with ServiceState

use of org.bboxdb.commons.ServiceState in project bboxdb by jnidzwetzki.

the class TestServiceState method testDispatchToStarting1.

/**
 * Dispath to starting
 */
@Test(timeout = 60000)
public void testDispatchToStarting1() {
    final ServiceState state = new ServiceState();
    final IllegalArgumentException exception = new IllegalArgumentException();
    state.dispatchToFailed(exception);
    state.dipatchToStarting();
    Assert.assertFalse(state.isInStartingState());
}
Also used : ServiceState(org.bboxdb.commons.ServiceState) Test(org.junit.Test)

Aggregations

ServiceState (org.bboxdb.commons.ServiceState)12 Test (org.junit.Test)12 Semaphore (java.util.concurrent.Semaphore)2 Consumer (java.util.function.Consumer)1 State (org.bboxdb.commons.ServiceState.State)1 Assert (org.junit.Assert)1