Search in sources :

Example 76 with ConcurrentLinkedDeque

use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.

the class ConcurrentLinkedDequeTest method testPeekFirst.

/**
 * peekFirst() returns next element, or null if empty
 */
public void testPeekFirst() {
    ConcurrentLinkedDeque q = populatedDeque(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.peekFirst());
        assertEquals(i, q.pollFirst());
        assertTrue(q.peekFirst() == null || !q.peekFirst().equals(i));
    }
    assertNull(q.peekFirst());
}
Also used : ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque)

Example 77 with ConcurrentLinkedDeque

use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.

the class ConcurrentLinkedDequeTest method testContainsAll.

/**
 * containsAll(c) is true when c contains a subset of elements
 */
public void testContainsAll() {
    ConcurrentLinkedDeque q = populatedDeque(SIZE);
    ConcurrentLinkedDeque p = new ConcurrentLinkedDeque();
    for (int i = 0; i < SIZE; ++i) {
        assertTrue(q.containsAll(p));
        assertFalse(p.containsAll(q));
        p.add(new Integer(i));
    }
    assertTrue(p.containsAll(q));
}
Also used : ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque)

Example 78 with ConcurrentLinkedDeque

use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.

the class ConcurrentLinkedDequeTest method testAddFirst.

/**
 * addFirst(x) succeeds
 */
public void testAddFirst() {
    ConcurrentLinkedDeque q = new ConcurrentLinkedDeque();
    q.addFirst(zero);
    q.addFirst(one);
    assertSame(one, q.peekFirst());
    assertSame(zero, q.peekLast());
}
Also used : ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque)

Example 79 with ConcurrentLinkedDeque

use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.

the class ConcurrentLinkedDequeTest method testPushNull.

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

Example 80 with ConcurrentLinkedDeque

use of java.util.concurrent.ConcurrentLinkedDeque in project j2objc by google.

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)

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