@Test
  @Ignore
  public void drainToWithEmptyDeque() {
    BlockingDeque<String> deque = new TransactionalLinkedList<String>();

    Collection<String> c = new LinkedList<String>();
    long version = stm.getTime();
    int result = deque.drainTo(c);
    assertEquals(0, result);

    assertEquals(version, stm.getTime());
    assertTrue(c.isEmpty());
    assertEquals(0, deque.size());
    testIncomplete();
  }
  @Ignore
  @Test
  public void drainToWithNonEmptyDeque() {
    BlockingDeque<String> deque = new TransactionalLinkedList<String>();
    deque.add("1");
    deque.add("2");
    deque.add("3");

    Collection<String> c = new LinkedList<String>();
    long version = stm.getTime();
    int result = deque.drainTo(c);
    assertEquals(3, result);
    assertEquals(version + 1, stm.getTime());
    assertEquals("[1, 2, 3]", c.toString());
    assertEquals(0, deque.size());
    testIncomplete();
  }
Ejemplo n.º 3
0
 public List<BpmMessage> readAll() {
   List<BpmMessage> messages = new LinkedList<BpmMessage>();
   messageQueue.drainTo(messages);
   return Collections.unmodifiableList(messages);
 }