use of net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue in project HugeCollections-OLD by peter-lawrey.
the class LocalJSR166TestCase method testToArray2.
/**
* toArray(a) contains all elements in FIFO order
*/
@Ignore
@Test
public void testToArray2() {
BlockingQueue q = new LocalConcurrentBlockingObjectQueue(SIZE);
for (int i = 0; i < SIZE; i++) {
checkToArray2(q);
q.add(i);
}
// Provoke wraparound
for (int i = 0; i < SIZE; i++) {
checkToArray2(q);
assertEquals(i, q.poll());
checkToArray2(q);
q.add(SIZE + i);
}
for (int i = 0; i < SIZE; i++) {
checkToArray2(q);
assertEquals(SIZE + i, q.poll());
}
}
use of net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue in project HugeCollections-OLD by peter-lawrey.
the class LocalJSR166TestCase method testIteratorRemove.
/**
* iterator.remove removes current element
*/
@Ignore
@Test
public void testIteratorRemove() {
final BlockingQueue q = new LocalConcurrentBlockingObjectQueue(3);
q.add(two);
q.add(one);
q.add(three);
Iterator it = q.iterator();
it.next();
it.remove();
it = q.iterator();
assertSame(it.next(), one);
assertSame(it.next(), three);
assertFalse(it.hasNext());
}
use of net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue in project HugeCollections-OLD by peter-lawrey.
the class LocalJSR166TestCase method testAddAll4.
/**
* addAll throws ISE if not enough room
*/
@Test
public void testAddAll4() {
try {
BlockingQueue q = new LocalConcurrentBlockingObjectQueue(1);
Integer[] ints = new Integer[SIZE];
for (int i = 0; i < SIZE; ++i) ints[i] = new Integer(i);
q.addAll(Arrays.asList(ints));
shouldThrow();
} catch (IllegalStateException success) {
}
}
use of net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue in project HugeCollections-OLD by peter-lawrey.
the class LocalJSR166TestCase method testOffer.
/**
* Offer succeeds if not full; fails if full
*/
@Test
public void testOffer() {
BlockingQueue q = new LocalConcurrentBlockingObjectQueue(1);
assertTrue(q.offer(zero));
assertFalse(q.offer(one));
}
use of net.openhft.chronicle.sandbox.queue.LocalConcurrentBlockingObjectQueue in project HugeCollections-OLD by peter-lawrey.
the class LocalJSR166TestCase method testAddAll5.
/**
* Queue contains all elements, in traversal order, of successful addAll
*/
@Test
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);
BlockingQueue q = new LocalConcurrentBlockingObjectQueue(SIZE);
assertFalse(q.addAll(Arrays.asList(empty)));
assertTrue(q.addAll(Arrays.asList(ints)));
for (int i = 0; i < SIZE; ++i) assertEquals(ints[i], q.poll());
}
Aggregations