public virtual void TestSuccessfulContainerLaunch() { FileContext localFS = FileContext.GetLocalFSFileContext(); localFS.Delete(new Path(localDir.GetAbsolutePath()), true); localFS.Delete(new Path(localLogDir.GetAbsolutePath()), true); localFS.Delete(new Path(remoteLogDir.GetAbsolutePath()), true); localDir.Mkdir(); localLogDir.Mkdir(); remoteLogDir.Mkdir(); YarnConfiguration conf = new YarnConfiguration(); Context context = new _NMContext_84(new NMContainerTokenSecretManager(conf), new NMTokenSecretManagerInNM(), null, null, new NMNullStateStoreService()); conf.Set(YarnConfiguration.NmLocalDirs, localDir.GetAbsolutePath()); conf.Set(YarnConfiguration.NmLogDirs, localLogDir.GetAbsolutePath()); conf.Set(YarnConfiguration.NmRemoteAppLogDir, remoteLogDir.GetAbsolutePath()); ContainerExecutor exec = new DefaultContainerExecutor(); exec.SetConf(conf); DeletionService del = new DeletionService(exec); Dispatcher dispatcher = new AsyncDispatcher(); NodeHealthCheckerService healthChecker = new NodeHealthCheckerService(); healthChecker.Init(conf); LocalDirsHandlerService dirsHandler = healthChecker.GetDiskHandler(); NodeManagerMetrics metrics = NodeManagerMetrics.Create(); NodeStatusUpdater nodeStatusUpdater = new _NodeStatusUpdaterImpl_106(context, dispatcher , healthChecker, metrics); // Don't start any updating thread. DummyContainerManager containerManager = new DummyContainerManager(context, exec, del, nodeStatusUpdater, metrics, new ApplicationACLsManager(conf), dirsHandler); nodeStatusUpdater.Init(conf); ((NodeManager.NMContext)context).SetContainerManager(containerManager); nodeStatusUpdater.Start(); containerManager.Init(conf); containerManager.Start(); ContainerLaunchContext launchContext = recordFactory.NewRecordInstance <ContainerLaunchContext >(); ApplicationId applicationId = ApplicationId.NewInstance(0, 0); ApplicationAttemptId applicationAttemptId = ApplicationAttemptId.NewInstance(applicationId , 0); ContainerId cID = ContainerId.NewContainerId(applicationAttemptId, 0); string user = "******"; StartContainerRequest scRequest = StartContainerRequest.NewInstance(launchContext , TestContainerManager.CreateContainerToken(cID, SimulatedRmIdentifier, context. GetNodeId(), user, context.GetContainerTokenSecretManager())); IList <StartContainerRequest> list = new AList <StartContainerRequest>(); list.AddItem(scRequest); StartContainersRequest allRequests = StartContainersRequest.NewInstance(list); containerManager.StartContainers(allRequests); BaseContainerManagerTest.WaitForContainerState(containerManager, cID, ContainerState .Running); IList <ContainerId> containerIds = new AList <ContainerId>(); containerIds.AddItem(cID); StopContainersRequest stopRequest = StopContainersRequest.NewInstance(containerIds ); containerManager.StopContainers(stopRequest); BaseContainerManagerTest.WaitForContainerState(containerManager, cID, ContainerState .Complete); containerManager.Stop(); }