/// <exception cref="System.IO.IOException"/>
        public virtual void TestStartLocalizer()
        {
            IPEndPoint address = IPEndPoint.CreateUnresolved("localhost", 8040);
            Path       nmPrivateCTokensPath = new Path("file:///bin/nmPrivateCTokensPath");

            try
            {
                mockExec.StartLocalizer(nmPrivateCTokensPath, address, "test", "application_0", "12345"
                                        , dirsHandler);
                IList <string> result = ReadMockParams();
                NUnit.Framework.Assert.AreEqual(result.Count, 17);
                NUnit.Framework.Assert.AreEqual(result[0], YarnConfiguration.DefaultNmNonsecureModeLocalUser
                                                );
                NUnit.Framework.Assert.AreEqual(result[1], "test");
                NUnit.Framework.Assert.AreEqual(result[2], "0");
                NUnit.Framework.Assert.AreEqual(result[3], "application_0");
                NUnit.Framework.Assert.AreEqual(result[4], "/bin/nmPrivateCTokensPath");
                NUnit.Framework.Assert.AreEqual(result[8], "-classpath");
                NUnit.Framework.Assert.AreEqual(result[11], "org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ContainerLocalizer"
                                                );
                NUnit.Framework.Assert.AreEqual(result[12], "test");
                NUnit.Framework.Assert.AreEqual(result[13], "application_0");
                NUnit.Framework.Assert.AreEqual(result[14], "12345");
                NUnit.Framework.Assert.AreEqual(result[15], "localhost");
                NUnit.Framework.Assert.AreEqual(result[16], "8040");
            }
            catch (Exception e)
            {
                Log.Error("Error:" + e.Message, e);
                NUnit.Framework.Assert.Fail();
            }
        }
        public virtual void TestContainerLocalizer()
        {
            if (!ShouldRun())
            {
                return;
            }
            IList <string> localDirs = dirsHandler.GetLocalDirs();
            IList <string> logDirs   = dirsHandler.GetLogDirs();

            foreach (string localDir in localDirs)
            {
                Path userDir = new Path(localDir, ContainerLocalizer.Usercache);
                files.Mkdir(userDir, new FsPermission("777"), false);
                // $local/filecache
                Path fileDir = new Path(localDir, ContainerLocalizer.Filecache);
                files.Mkdir(fileDir, new FsPermission("777"), false);
            }
            string locId = "container_01_01";
            Path   nmPrivateContainerTokensPath = dirsHandler.GetLocalPathForWrite(ResourceLocalizationService
                                                                                   .NmPrivateDir + Path.Separator + string.Format(ContainerLocalizer.TokenFileNameFmt
                                                                                                                                  , locId));

            files.Create(nmPrivateContainerTokensPath, EnumSet.Of(CreateFlag.Create, CreateFlag
                                                                  .Overwrite));
            Configuration config = new YarnConfiguration(conf);
            IPEndPoint    nmAddr = config.GetSocketAddr(YarnConfiguration.NmBindHost, YarnConfiguration
                                                        .NmLocalizerAddress, YarnConfiguration.DefaultNmLocalizerAddress, YarnConfiguration
                                                        .DefaultNmLocalizerPort);
            string appId = "application_01_01";

            exec = new _LinuxContainerExecutor_258();
            exec.SetConf(conf);
            exec.StartLocalizer(nmPrivateContainerTokensPath, nmAddr, appSubmitter, appId, locId
                                , dirsHandler);
            string locId2 = "container_01_02";
            Path   nmPrivateContainerTokensPath2 = dirsHandler.GetLocalPathForWrite(ResourceLocalizationService
                                                                                    .NmPrivateDir + Path.Separator + string.Format(ContainerLocalizer.TokenFileNameFmt
                                                                                                                                   , locId2));

            files.Create(nmPrivateContainerTokensPath2, EnumSet.Of(CreateFlag.Create, CreateFlag
                                                                   .Overwrite));
            exec.StartLocalizer(nmPrivateContainerTokensPath2, nmAddr, appSubmitter, appId, locId2
                                , dirsHandler);
        }