AMSimulator extends TaskRunner.Task { public AMSimulator() { this.responseQueue = new LinkedBlockingQueue<>(); } AMSimulator(); @SuppressWarnings("checkstyle:parameternumber") void init(int heartbeatInterval,
      List<ContainerSimulator> containerList, ResourceManager resourceManager,
      SLSRunner slsRunnner, long startTime, long finishTime, String simUser,
      String simQueue, boolean tracked, String oldApp, long baseTimeMS,
      Resource amResource, String nodeLabelExpr, Map<String, String> params,
      Map<ApplicationId, AMSimulator> appIdAMSim); @Override void firstStep(); synchronized void notifyAMContainerLaunched(Container masterContainer); @Override void middleStep(); @Override void lastStep(); abstract void initReservation(
      ReservationId reservationId, long deadline, long now); void untrackApp(); String getQueue(); String getAMType(); long getDuration(); int getNumTasks(); ApplicationId getApplicationId(); ApplicationAttemptId getApplicationAttemptId();  }
@Test public void testAMSimulator() throws Exception { MockAMSimulator app = new MockAMSimulator(); String appId = "app1"; String queue = "default"; List<ContainerSimulator> containers = new ArrayList<>(); HashMap<ApplicationId, AMSimulator> map = new HashMap<>(); app.init(1000, containers, rm, null, 0, 1000000L, "user1", queue, true, appId, 0, SLSConfiguration.getAMContainerResource(conf), null, null, map); app.firstStep(); verifySchedulerMetrics(appId); Assert.assertEquals(1, rm.getRMContext().getRMApps().size()); Assert.assertNotNull(rm.getRMContext().getRMApps().get(app.appId)); app.lastStep(); }