BAEL-845 TransferQueueTest.java (#1719)
This commit is contained in:
parent
4d17d26405
commit
b0df0937f2
@ -12,7 +12,7 @@ import static junit.framework.TestCase.assertEquals;
|
|||||||
public class TransferQueueTest {
|
public class TransferQueueTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenTransferQueue_whenUseMultipleConsumersAndMultipleProducers_thenShouldProcessAllMessages() throws InterruptedException {
|
public void whenMultipleConsumersAndProducers_thenProcessAllMessages() throws InterruptedException {
|
||||||
//given
|
//given
|
||||||
TransferQueue<String> transferQueue = new LinkedTransferQueue<>();
|
TransferQueue<String> transferQueue = new LinkedTransferQueue<>();
|
||||||
ExecutorService exService = Executors.newFixedThreadPool(3);
|
ExecutorService exService = Executors.newFixedThreadPool(3);
|
||||||
@ -28,7 +28,7 @@ public class TransferQueueTest {
|
|||||||
exService.execute(consumer2);
|
exService.execute(consumer2);
|
||||||
|
|
||||||
//then
|
//then
|
||||||
exService.awaitTermination(10_000, TimeUnit.MILLISECONDS);
|
exService.awaitTermination(5000, TimeUnit.MILLISECONDS);
|
||||||
exService.shutdown();
|
exService.shutdown();
|
||||||
|
|
||||||
assertEquals(producer1.numberOfProducedMessages.intValue(), 3);
|
assertEquals(producer1.numberOfProducedMessages.intValue(), 3);
|
||||||
@ -36,7 +36,7 @@ public class TransferQueueTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenTransferQueue_whenUseOneConsumerAndOneProducer_thenShouldProcessAllMessages() throws InterruptedException {
|
public void whenUseOneConsumerAndOneProducer_thenShouldProcessAllMessages() throws InterruptedException {
|
||||||
//given
|
//given
|
||||||
TransferQueue<String> transferQueue = new LinkedTransferQueue<>();
|
TransferQueue<String> transferQueue = new LinkedTransferQueue<>();
|
||||||
ExecutorService exService = Executors.newFixedThreadPool(2);
|
ExecutorService exService = Executors.newFixedThreadPool(2);
|
||||||
@ -56,7 +56,7 @@ public class TransferQueueTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenTransferQueue_whenUseOneProducerAndNoConsumers_thenShouldFailWithTimeout() throws InterruptedException {
|
public void whenUseOneProducerAndNoConsumers_thenShouldFailWithTimeout() throws InterruptedException {
|
||||||
//given
|
//given
|
||||||
TransferQueue<String> transferQueue = new LinkedTransferQueue<>();
|
TransferQueue<String> transferQueue = new LinkedTransferQueue<>();
|
||||||
ExecutorService exService = Executors.newFixedThreadPool(2);
|
ExecutorService exService = Executors.newFixedThreadPool(2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user