use of org.forgerock.openam.sm.datalayer.impl.tasks.CreateTask in project OpenAM by OpenRock.
the class SeriesTaskExecutorTest method shouldCatchTimeoutWhenOfferingTaskToQueue.
@Test
public void shouldCatchTimeoutWhenOfferingTaskToQueue() throws Exception {
// Given
given(configuration.getQueueTimeout()).willReturn(0);
given(configuration.getQueueSize()).willReturn(1);
given(configuration.getProcessors()).willReturn(2);
CreateTask task = mock(CreateTask.class);
executor.start();
// First create fills the queue
executor.execute("123", task);
// When
DataLayerException result = null;
try {
// Second create causes timeout.
executor.execute("123", task);
fail("Expected exception");
} catch (DataLayerException e) {
result = e;
}
// Then
assertThat(result).isNotNull();
}
Aggregations