List<OperationResult> operationResults = new ArrayList<OperationResult>();
int i = 0;
for (NodeQueue nodeQueue : nodeQueues) {
NodeOperation nodeOperation = nodeQueue.peek();
assertNotNull(nodeOperation);
OperationResult result = new OperationResult(_nodes.get(i).getName());
operationResults.add(result);
nodeQueue.complete(result);
i++;
}
operationWatchdog.join();
assertTrue(operationWatchdog.isDone());
assertEquals(0, operationWatchdog.getOpenOperationCount());
ArgumentCaptor<List> argument = ArgumentCaptor.forClass(List.class);
verify(_masterOperation, times(1)).nodeOperationsComplete(eq(_context), argument.capture());
List<OperationResult> capturedResults = argument.getValue();
assertEquals(operationResults.size(), capturedResults.size());
for (OperationResult result : capturedResults) {
assertNotNull(result);
assertNotNull(result.getNodeName());
}
}