Ejemplo n.º 1
0
 /** @see net.gaia.taskprocessor.api.processor.TaskProcessor#getPendingTaskCount() */
 public int getPendingTaskCount() {
   int cantidadPendiente = 0;
   for (int i = 0; i < colasCompartidas.length; i++) {
     final BlockingDeque<SubmittedTask> colaCompartida = colasCompartidas[i];
     cantidadPendiente += colaCompartida.size();
   }
   return cantidadPendiente;
 }
  @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();
  }