Search in sources :

Example 11 with ConcurrentLinkedDeque

use of java.util.concurrent.ConcurrentLinkedDeque in project mapdb by jankotek.

the class ConcurrentLinkedDequeTest method testAddFirstNull.

/**
     * addFirst(null) throws NPE
     */
public void testAddFirstNull() {
    ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
    try {
        q.addFirst(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}
Also used : ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque)

Example 12 with ConcurrentLinkedDeque

use of java.util.concurrent.ConcurrentLinkedDeque in project mapdb by jankotek.

the class ConcurrentLinkedDequeTest method testFirstElement.

/**
     * getFirst() returns first element, or throws NSEE if empty
     */
public void testFirstElement() {
    ConcurrentLinkedDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.getFirst());
        assertEquals(i, q.pollFirst());
    }
    try {
        q.getFirst();
        shouldThrow();
    } catch (NoSuchElementException success) {
    }
}
Also used : NoSuchElementException(java.util.NoSuchElementException) ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque)

Example 13 with ConcurrentLinkedDeque

use of java.util.concurrent.ConcurrentLinkedDeque in project mapdb by jankotek.

the class ConcurrentLinkedDequeTest method testPoll.

/**
     * poll() succeeds unless empty
     */
public void testPoll() {
    ConcurrentLinkedDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.poll());
    }
    assertNull(q.poll());
}
Also used : ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque)

Example 14 with ConcurrentLinkedDeque

use of java.util.concurrent.ConcurrentLinkedDeque in project mapdb by jankotek.

the class ConcurrentLinkedDequeTest method testOfferFirstNull.

/**
     * offerFirst(null) throws NPE
     */
public void testOfferFirstNull() {
    ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
    try {
        q.offerFirst(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}
Also used : ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque)

Example 15 with ConcurrentLinkedDeque

use of java.util.concurrent.ConcurrentLinkedDeque in project mapdb by jankotek.

the class ConcurrentLinkedDequeTest method testPop.

/**
     * pop() removes first element, or throws NSEE if empty
     */
public void testPop() {
    ConcurrentLinkedDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.pop());
    }
    try {
        q.pop();
        shouldThrow();
    } catch (NoSuchElementException success) {
    }
}
Also used : NoSuchElementException(java.util.NoSuchElementException) ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque)

Aggregations

ConcurrentLinkedDeque (java.util.concurrent.ConcurrentLinkedDeque)209 Test (org.junit.Test)21 NoSuchElementException (java.util.NoSuchElementException)16 Iterator (java.util.Iterator)14 Random (java.util.Random)14 CountDownLatch (java.util.concurrent.CountDownLatch)14 Deque (java.util.Deque)7 ExecutorService (java.util.concurrent.ExecutorService)7 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)6 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)6 ArrayList (java.util.ArrayList)5 Map (java.util.Map)5 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 IOException (java.io.IOException)4 List (java.util.List)4 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)4 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)4 BlockIdList (alluxio.grpc.BlockIdList)3 BlockStoreLocationProto (alluxio.grpc.BlockStoreLocationProto)3 LocationBlockIdListEntry (alluxio.grpc.LocationBlockIdListEntry)3