@Test public void testTaskContext() throws Exception {

  try {
    AngelApplicationMaster angelAppMaster = LocalClusterContext.get().getMaster().getAppMaster();
    assertTrue(angelAppMaster != null);
    AMTaskManager taskManager = angelAppMaster.getAppContext().getTaskManager();
    assertTrue(taskManager != null);
    WorkerManager workerManager = angelAppMaster.getAppContext().getWorkerManager();
    assertTrue(workerManager != null);
    Worker worker = LocalClusterContext.get().getWorker(worker0Attempt0Id).getWorker();
    assertTrue(worker != null);
    PSAgent psAgent = worker.getPSAgent();
    assertTrue(psAgent != null);
    PSAgentContext psAgentContext = PSAgentContext.get();
    assertTrue(psAgentContext.getPsAgent() != null);
    TaskContext taskContext1 = psAgentContext.getTaskContext(1);
    TaskContext taskContext2 = psAgentContext.getTaskContext(2);
    assertTrue(taskContext1 != null);
    assertTrue(taskContext2 != null);
    assertEquals(taskContext1.getIndex(), 1);
    assertEquals(taskContext2.getIndex(), 2);
    assertEquals(taskContext1.getEpoch(), 0);
    assertEquals(taskContext2.getEpoch(), 0);
    assertEquals(taskContext1.getMatrixClock(1), 0);
    assertEquals(taskContext2.getMatrixClock(2), 0);
    assertEquals(taskContext1.getMatrixClocks().size(), 1);
    assertEquals(taskContext2.getMatrixClocks().size(), 1);
    assertEquals(taskContext1.getProgress(), 0.0, 1e-5);
    assertEquals(taskContext2.getProgress(), 0.0, 1e-5);
  } catch (Exception x) {
    LOG.error("run testTaskContext failed ", x);
    throw x;
  }
}