@Test
public void testCommandManager() throws InterruptedException {

  CommandManager cmdman = new CommandManager();
  List<Long> ids = new ArrayList<Long>();
  for (int i = 0; i < 10; i++) {
    LOG.info("command manager start stop " + i);
    Command cmd = new Command("noop");
    long id = cmdman.submit(cmd);
    ids.add(id);
    assertFalse(cmdman.isFailure(id));
    assertFalse(cmdman.isSuccess(id));
  }
  // all commands should be queued
  for (Long l : ids) {
    CommandStatus status = cmdman.getStatus(l);
    assertEquals("", status.getMessage());
    assertTrue(status.isQueued());
  }
  // this should be plenty of time to execute noops
  cmdman.start();
  Clock.sleep(200);
  cmdman.stop();
  // all commands should have executed successfully by now.
  for (Long l : ids) {
    CommandStatus status = cmdman.getStatus(l);
    assertEquals("", status.getMessage());
    assertTrue(status.isSuccess());
    assertFalse(cmdman.isFailure(l));
    assertTrue(cmdman.isSuccess(l));
  }
  LOG.info(cmdman.getMetrics());
}