@Override @Test public void notifiesOnProgressChangeViaAdd() { List<Object> updates = new LinkedList<>(); TransactionStub upload1 = new TransactionStub(); WindowedTransactionGroup group = new WindowedTransactionGroup(); upload1.setSize(100); group.addObserver((o, arg) -> updates.add(arg)); group.add(upload1); assertEquals(1, updates.size()); }
@Override public void add(Transaction transaction) { if (!isDone(transaction)) { transaction.onProgress(() -> { if (isDone(transaction)) { runningTransactions.remove(transaction); } if (runningTransactions.isEmpty()) { clear(); } }); super.add(transaction); runningTransactions.add(transaction); } }
WindowedTransactionGroup extends TransactionGroup { @Override public void add(Transaction transaction) { if (!isDone(transaction)) { transaction.onProgress(() -> { if (isDone(transaction)) { runningTransactions.remove(transaction); } if (runningTransactions.isEmpty()) { clear(); } }); super.add(transaction); runningTransactions.add(transaction); } } }
WindowedTransactionGroup extends TransactionGroup { @Override public void add(Transaction transaction) { if (!isDone(transaction)) { transaction.onProgress(() -> { if (isDone(transaction)) { runningTransactions.remove(transaction); } if (runningTransactions.isEmpty()) { clear(); } }); super.add(transaction); runningTransactions.add(transaction); } }  }
WindowedTransactionGroup extends TransactionGroup { @Override public void add(Transaction transaction) { if (!isDone(transaction)) { transaction.onProgress(() -> { if (isDone(transaction)) { runningTransactions.remove(transaction); } if (runningTransactions.isEmpty()) { clear(); } }); super.add(transaction); runningTransactions.add(transaction); } }  @Override void add(Transaction transaction); @Override long finishedElements(); }
WindowedTransactionGroup extends TransactionGroup { @Override public void add(Transaction transaction) { if (!isDone(transaction)) { transaction.onProgress(() -> { if (isDone(transaction)) { runningTransactions.remove(transaction); } if (runningTransactions.isEmpty()) { clear(); } }); super.add(transaction); runningTransactions.add(transaction); } }  @Override void add(Transaction transaction); @Override long finishedElements();  }