Search in sources :

Example 56 with ConcurrentLinkedQueue

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

the class ConcurrentLinkedQueueTest method testIteratorOrdering.

/**
     * iterator ordering is FIFO
     */
public void testIteratorOrdering() {
    final ConcurrentLinkedQueue q = new ConcurrentLinkedQueue();
    q.add(one);
    q.add(two);
    q.add(three);
    int k = 0;
    for (Iterator it = q.iterator(); it.hasNext(); ) {
        assertEquals(++k, it.next());
    }
    assertEquals(3, k);
}
Also used : Iterator(java.util.Iterator) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue)

Example 57 with ConcurrentLinkedQueue

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

the class ConcurrentLinkedQueueTest method testToArray1_BadArg.

/**
     * toArray(incompatible array type) throws ArrayStoreException
     */
public void testToArray1_BadArg() {
    ConcurrentLinkedQueue q = populatedQueue(SIZE);
    try {
        q.toArray(new String[10]);
        shouldThrow();
    } catch (ArrayStoreException success) {
    }
}
Also used : ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue)

Example 58 with ConcurrentLinkedQueue

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

the class ConcurrentLinkedQueueTest method testOfferNull.

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

Example 59 with ConcurrentLinkedQueue

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

the class ConcurrentLinkedQueueTest method testAddAll5.

/**
     * Queue contains all elements, in traversal order, of successful addAll
     */
public void testAddAll5() {
    Integer[] empty = new Integer[0];
    Integer[] ints = new Integer[SIZE];
    for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i);
    ConcurrentLinkedQueue q = new ConcurrentLinkedQueue();
    assertFalse(q.addAll(Arrays.asList(empty)));
    assertTrue(q.addAll(Arrays.asList(ints)));
    for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll());
}
Also used : ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue)

Example 60 with ConcurrentLinkedQueue

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

the class ConcurrentLinkedQueueTest method testConstructor6.

/**
     * Queue contains all elements of collection used to initialize
     */
public void testConstructor6() {
    Integer[] ints = new Integer[SIZE];
    for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i);
    ConcurrentLinkedQueue q = new ConcurrentLinkedQueue(Arrays.asList(ints));
    for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll());
}
Also used : ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue)

Aggregations

ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)236 Test (org.junit.Test)102 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)56 Watermark (org.apache.flink.streaming.api.watermark.Watermark)52 KeyedOneInputStreamOperatorTestHarness (org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness)43 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)40 Tuple2 (org.apache.flink.api.java.tuple.Tuple2)40 CountDownLatch (java.util.concurrent.CountDownLatch)37 ArrayList (java.util.ArrayList)31 TimeWindow (org.apache.flink.streaming.api.windowing.windows.TimeWindow)28 ListStateDescriptor (org.apache.flink.api.common.state.ListStateDescriptor)18 ReducingStateDescriptor (org.apache.flink.api.common.state.ReducingStateDescriptor)17 IOException (java.io.IOException)15 Tuple3 (org.apache.flink.api.java.tuple.Tuple3)15 StreamRecord (org.apache.flink.streaming.runtime.streamrecord.StreamRecord)14 ExecutionException (java.util.concurrent.ExecutionException)13 ExecutorService (java.util.concurrent.ExecutorService)13 Map (java.util.Map)12 OperatorStateHandles (org.apache.flink.streaming.runtime.tasks.OperatorStateHandles)12 Iterator (java.util.Iterator)11