Beispiel #1
0
        public static void TestClusterCheck(string[] args)
        {
            if (args.Length < 2)
            {
                Console.Error.WriteLine("Error: ClusterCheck command needs argument: <dfsXmlPath>");
                return;
            }

            string dfspath = args[1];

            if (!dfspath.StartsWith(@"\\"))
            {
                Console.Error.WriteLine("Argument: <dfsXmlPath> must be a network path");
                return;
            }

            bool verbose = false;

            if (args.Length > 2 && string.Compare(args[2], "verbose", true) == 0)
            {
                verbose = true;
            }

#if DEBUG
            verbose = true;
#endif

            string surrogate = dfspath.Substring(2, dfspath.IndexOf(@"\", 2) - 2).ToUpper();
            int    si        = 2 + surrogate.Length + 1;
            string dir       = dfspath.Substring(si, dfspath.LastIndexOf(@"\") - si);

            System.Xml.XmlDocument dfs = new System.Xml.XmlDocument();
            string slavelist           = null;
            bool   cont = false;

            try
            {
                dfs.Load(dfspath);
                System.Xml.XmlNode node = dfs.SelectSingleNode("//SlaveList");
                if (node == null)
                {
                    Console.Error.WriteLine("SlaveList node is not found in dfs.xml");
                    return;
                }

                slavelist = node.InnerText.ToUpper();
                string[] parts = slavelist.Split(new char[] { ',', ';' });
                if (parts.Length < 2)
                {
                    Console.Error.WriteLine("Must have at least 2 hosts in SlaveList tag in dfs.xml");
                    return;
                }
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("Error loading dfs.xml: {0}", e.Message);
                return;
            }

            string dfsback = null;
            if (!DFSUtils.MakeFileBackup(dfspath, ref dfsback))
            {
                Console.Error.WriteLine("Error backing up dfs.xml");
                return;
            }

            string allhosts = slavelist;
            if (slavelist.IndexOf(surrogate) == -1)
            {
                allhosts += ";" + surrogate;
            }

            string exe = Exec.GetQizmtExe();

            //Participating surrogate.
            try
            {
                string sl = slavelist;
                if (sl.IndexOf(surrogate) == -1)
                {
                    sl += ";" + surrogate;
                    DFSUtils.ChangeDFSXMLSlaveList(dfs, dfspath, sl);
                }

                string result = Exec.Shell(exe + " clustercheck " + allhosts);

                if (verbose)
                {
                    Console.Write(result);
                }
                Console.WriteLine();
                Console.WriteLine("-");
                Console.WriteLine("Test case: Participating surrogate:");

                string expResult = @"Participating surrogate: \\" + surrogate.ToUpper();
                if (result.IndexOf(expResult) > -1)
                {
                    Console.WriteLine("[PASSED] - " + string.Join(" ", args));
                }
                else
                {
                    Console.WriteLine("[FAILED] - " + string.Join(" ", args));
                }
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("Error during participating surrogate test case: {0}", e.Message);
            }
            finally
            {
                cont = DFSUtils.UndoFileChanges(dfspath, dfsback);
            }

            if (!cont)
            {
                return;
            }

            //Non-particpating surrogate.
            try
            {
                if (slavelist.IndexOf(surrogate) > -1)
                {
                    string[] parts = slavelist.Split(new char[] { ',', ';' });
                    string   sl    = "";
                    foreach (string p in parts)
                    {
                        if (string.Compare(p, surrogate, true) != 0)
                        {
                            sl += ";" + p;
                        }
                    }
                    sl = sl.Trim(';');
                    DFSUtils.ChangeDFSXMLSlaveList(dfs, dfspath, sl);
                }

                string result = Exec.Shell(exe + " clustercheck " + allhosts);

                if (verbose)
                {
                    Console.Write(result);
                }
                Console.WriteLine();
                Console.WriteLine("-");
                Console.WriteLine("Test case: Non-participating surrogate:");

                string expResult = @"Non-participating surrogate: \\" + surrogate.ToUpper();
                if (result.IndexOf(expResult) > -1)
                {
                    Console.WriteLine("[PASSED] - " + string.Join(" ", args));
                }
                else
                {
                    Console.WriteLine("[FAILED] - " + string.Join(" ", args));
                }
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("Error during non-participating surrogate test case: {0}", e.Message);
            }
            finally
            {
                cont = DFSUtils.UndoFileChanges(dfspath, dfsback);
            }

            if (!cont)
            {
                return;
            }

            //Inaccessible host.
            try
            {
                string sl = allhosts + ";" + "BOGUSHOSTNAME";
                DFSUtils.ChangeDFSXMLSlaveList(dfs, dfspath, sl);

                string result = Exec.Shell(exe + " clustercheck " + sl);

                if (verbose)
                {
                    Console.Write(result);
                }
                Console.WriteLine();
                Console.WriteLine("-");
                Console.WriteLine("Test case: Inaccessible host:");

                string expResult = @"Inaccessible host: \\BOGUSHOSTNAME";
                if (result.IndexOf(expResult) > -1)
                {
                    Console.WriteLine("[PASSED] - " + string.Join(" ", args));
                }
                else
                {
                    Console.WriteLine("[FAILED] - " + string.Join(" ", args));
                }
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("Error during inaccessible host test case: {0}", e.Message);
            }
            finally
            {
                cont = DFSUtils.UndoFileChanges(dfspath, dfsback);
            }

            if (!cont)
            {
                return;
            }

            //Bad meta data backup.
            try
            {
                {
                    System.Xml.XmlDocument thisdoc = new System.Xml.XmlDocument();
                    thisdoc.Load(dfspath);
                    System.Xml.XmlNode node = thisdoc.SelectSingleNode("//MetaBackup");
                    if (node == null)
                    {
                        node = thisdoc.CreateElement("MetaBackup");
                        thisdoc.DocumentElement.AppendChild(node);
                    }
                    node.InnerText = @"\\" + surrogate + @"\c$\" + Guid.NewGuid().ToString();
                    thisdoc.Save(dfspath);
                }

                string result = Exec.Shell(exe + " clustercheck " + allhosts);

                if (verbose)
                {
                    Console.Write(result);
                }
                Console.WriteLine();
                Console.WriteLine("-");
                Console.WriteLine("Test case: Bad meta data backup:");

                string expResult = @"Bad meta backup surrogate";
                if (result.IndexOf(expResult) > -1)
                {
                    Console.WriteLine("[PASSED] - " + string.Join(" ", args));
                }
                else
                {
                    Console.WriteLine("[FAILED] - " + string.Join(" ", args));
                }
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("Error during bad meta data backup test case: {0}", e.Message);
            }
            finally
            {
                cont = DFSUtils.UndoFileChanges(dfspath, dfsback);
            }

            if (!cont)
            {
                return;
            }

            //Broken surrogate.
            string slavedat     = "";
            string slavedatback = "";
            string slave        = "";
            {
                string[] parts = slavelist.Split(new char[] { ',', ';' });
                foreach (string p in parts)
                {
                    if (string.Compare(p, surrogate, true) != 0)
                    {
                        slave = p;
                        break;
                    }
                }

                if (slave == "")
                {
                    Console.Error.WriteLine("Cannot perform broken surrogate, uninstalled host, or orphaned worker tests: must have a host in the cluster besides the surrogate itself.");
                    return;
                }

                slavedat = @"\\" + slave + @"\" + dir + @"\slave.dat";

                if (!DFSUtils.MakeFileBackup(slavedat, ref slavedatback))
                {
                    Console.Error.WriteLine("Cannot perform broken surrogate, uninstalled host, or orphaned worker tests.  Error while backing up slave.dat: {0}", slavedat);
                    return;
                }
            }

            try
            {
                System.IO.File.WriteAllText(slavedat, "master=BOGUSHOSTNAME");
                string result = Exec.Shell(exe + " clustercheck " + allhosts);

                if (verbose)
                {
                    Console.Write(result);
                }
                Console.WriteLine();
                Console.WriteLine("-");
                Console.WriteLine("Test case: Broken surrogate:");

                string expResult = @"Broken surrogate: \\" + surrogate;
                if (result.IndexOf(expResult) > -1)
                {
                    Console.WriteLine("[PASSED] - " + string.Join(" ", args));
                }
                else
                {
                    Console.WriteLine("[FAILED] - " + string.Join(" ", args));
                }
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("Error during broken surrogate test case: {0}", e.Message);
            }
            finally
            {
                cont = DFSUtils.UndoFileChanges(slavedat, slavedatback);
            }

            if (!cont)
            {
                return;
            }

            //Uninstalled host.
            try
            {
                System.IO.File.Delete(slavedat);
                string result = Exec.Shell(exe + " clustercheck " + allhosts);

                if (verbose)
                {
                    Console.Write(result);
                }
                Console.WriteLine();
                Console.WriteLine("-");
                Console.WriteLine("Test case: Uninstalled host:");

                string expResult = @"Uninstalled host: \\" + slave;
                if (result.IndexOf(expResult) > -1)
                {
                    Console.WriteLine("[PASSED] - " + string.Join(" ", args));
                }
                else
                {
                    Console.WriteLine("[FAILED] - " + string.Join(" ", args));
                }
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("Error during uninstalled host test case: {0}", e.Message);
            }
            finally
            {
                cont = DFSUtils.UndoFileChanges(slavedat, slavedatback);
            }

            if (!cont)
            {
                return;
            }

            //Orphaned worker.
            {
                string[] parts = slavelist.Split(new char[] { ',', ';' });
                string   sl    = "";
                foreach (string p in parts)
                {
                    if (string.Compare(p, slave, true) != 0)
                    {
                        sl += ";" + p;
                    }
                }
                sl = sl.Trim(';');
                if (sl.Length == 0)
                {
                    Console.Error.WriteLine("Cannot perform orphaned worker test.  Must have at least 2 machines in Slavelist tag in dfs.xml.");
                }
                else
                {
                    try
                    {
                        DFSUtils.ChangeDFSXMLSlaveList(dfs, dfspath, sl);

                        string result = Exec.Shell(exe + " clustercheck " + allhosts);
                        if (verbose)
                        {
                            Console.Write(result);
                        }
                        Console.WriteLine();
                        Console.WriteLine("-");
                        Console.WriteLine("Test case: Orphaned worker:");

                        string expResult = @"Orphaned worker: \\" + slave;
                        if (result.IndexOf(expResult) > -1)
                        {
                            Console.WriteLine("[PASSED] - " + string.Join(" ", args));
                        }
                        else
                        {
                            Console.WriteLine("[FAILED] - " + string.Join(" ", args));
                        }
                    }
                    catch (Exception e)
                    {
                        Console.Error.WriteLine("Error during orphaned worker test case: {0}", e.Message);
                    }
                    finally
                    {
                        cont = DFSUtils.UndoFileChanges(dfspath, dfsback);
                    }
                }
            }

            if (!cont)
            {
                return;
            }

            System.IO.File.Delete(dfsback);
            System.IO.File.Delete(slavedatback);
        }
Beispiel #2
0
        public static void TestAddRemoveMachineClearCache(string[] args)
        {
            if (args.Length < 2)
            {
                Console.Error.WriteLine("Error: AddRemoveMachineClearCache command needs argument: <dfsXmlPath>");
                return;
            }

            string dfspath = args[1];

            if (!dfspath.StartsWith(@"\\"))
            {
                Console.Error.WriteLine("Argument: <dfsXmlPath> must be a network path");
                return;
            }

            string slavelist = null;

            try
            {
                System.Xml.XmlDocument dfs = new System.Xml.XmlDocument();
                dfs.Load(dfspath);
                System.Xml.XmlNode node = dfs.SelectSingleNode("//SlaveList");
                if (node == null)
                {
                    Console.Error.WriteLine("SlaveList node is not found in dfs.xml");
                    return;
                }

                slavelist = node.InnerText.ToUpper();
                string[] parts = slavelist.Split(';');
                if (parts.Length < 2)
                {
                    Console.Error.WriteLine("Must have at least 2 machines in SlaveList in dfs.xml to test.");
                    return;
                }
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("Error loading dfs.xml: {0}", e.Message);
                return;
            }

            string surrogate = dfspath.Substring(2, dfspath.IndexOf(@"\", 2) - 2).ToUpper();
            int    si        = 2 + surrogate.Length + 1;
            string dspacedir = dfspath.Substring(si, dfspath.LastIndexOf(@"\") - si) + @"\";

            if (string.Compare(surrogate, System.Net.Dns.GetHostName(), true) != 0)
            {
                Console.Error.WriteLine("AddRemoveMachineClearCache test must be run from the surrogate.");
                return;
            }

            string jobdir = @"\\" + System.Net.Dns.GetHostName() + @"\" + Environment.CurrentDirectory.Replace(':', '$') + @"\RegressionTest\removeMachineClearCacheTest\";
            {
                string mr = @"<SourceCode>
  <Jobs>
    <Job Name=`local` Custodian=`` Email=``>
      <IOSettings>
        <JobType>local</JobType>
      </IOSettings>
      <Local>
        <![CDATA[
        public virtual void Local()
        {
            Shell(@`Qizmt del regressionTest_removeMachineClearCache_Input.txt`);
            Shell(@`Qizmt del regressionTest_removeMachineClearCache_Output.txt`);
            Shell(@`Qizmt del regressionTest_removeMachineClearCache_Cache`);
            Shell(@`Qizmt gen regressionTest_removeMachineClearCache_Input.txt 200B`);
        }
        ]]>
      </Local>
    </Job>
    <Job Name=`mr` Custodian=`` Email=``>
       <Delta>
        <Name>regressionTest_removeMachineClearCache_Cache</Name>
        <DFSInput>dfs://regressionTest_removeMachineClearCache_Input*.txt</DFSInput>
      </Delta>
      <IOSettings>
        <JobType>mapreduce</JobType>
        <KeyLength>100</KeyLength>
        <DFSInput></DFSInput>
        <DFSOutput>dfs://regressionTest_removeMachineClearCache_Output.txt</DFSOutput>
        <OutputMethod>grouped</OutputMethod>
      </IOSettings>
      <MapReduce>
        <Map>
          <![CDATA[
          public virtual void Map(ByteSlice line, MapOutput output)
          {
                output.Add(line, ByteSlice.Prepare());
          }
        ]]>
        </Map>
        <Reduce>
          <![CDATA[
          public override void Reduce(ByteSlice key, ByteSliceList values, ReduceOutput output)
          {
              for(int i = 0; i < values.Length; i++)
              {
                  output.Add(values[i].Value);
              }
          }
        ]]>
        </Reduce>
      </MapReduce>
    </Job>
  </Jobs>
</SourceCode>".Replace('`', '"');
                if (System.IO.Directory.Exists(jobdir))
                {
                    System.IO.Directory.Delete(jobdir, true);
                }
                System.IO.Directory.CreateDirectory(jobdir);
                System.IO.File.WriteAllText(jobdir + "regressionTest_removeMachineClearCache.xml", mr);
            }

            string nonsurrogate = null;

            {
                string[] hosts = slavelist.Split(';');
                foreach (string host in hosts)
                {
                    if (string.Compare(host, surrogate, true) != 0)
                    {
                        nonsurrogate = host;
                        break;
                    }
                }
                if (nonsurrogate == null)
                {
                    Console.Error.WriteLine("Non-surrogate is not found from SlaveList in dfs.xml");
                    return;
                }
            }

            //Remove a non-surrogate machine.
            {
                Console.WriteLine("-");
                Console.WriteLine("Testing removal of a non-surrogate machine...");

                if (!CreateCache(surrogate, jobdir))
                {
                    return;
                }

                Exec.Shell(@"Qizmt removemachine " + nonsurrogate);

                if (CacheExists(surrogate))
                {
                    Console.WriteLine("[FAILED] - " + string.Join(" ", args));
                }
                else
                {
                    Console.WriteLine("[PASSED] - " + string.Join(" ", args));
                }
            }

            //Add the machine back.
            {
                Console.WriteLine("-");
                Console.WriteLine("Testing adding of a machine...");

                if (!CreateCache(surrogate, jobdir))
                {
                    return;
                }

                Exec.Shell(@"Qizmt addmachine " + nonsurrogate);

                if (CacheExists(surrogate))
                {
                    Console.WriteLine("[FAILED] - " + string.Join(" ", args));
                }
                else
                {
                    Console.WriteLine("[PASSED] - " + string.Join(" ", args));
                }
            }

            //Removal of a non-surrogate and non-responsive machine.
            {
                Console.WriteLine("-");
                Console.WriteLine("Testing removal of a non-surrogate and non-responsive machine...");

                //Format dfs to its original state.
                Exec.Shell(@"Qizmt @format slaves=" + slavelist);

                if (!CreateCache(surrogate, jobdir))
                {
                    return;
                }

                string dummymachine = nonsurrogate + "dummy";
                string newslavelist = slavelist.Replace(nonsurrogate, dummymachine);
                DFSUtils.ChangeDFSXMLSlaveList(dfspath, newslavelist);

                Exec.Shell(@"Qizmt removemachine " + dummymachine, true);

                if (CacheExists(surrogate))
                {
                    Console.WriteLine("[FAILED] - " + string.Join(" ", args));
                }
                else
                {
                    Console.WriteLine("[PASSED] - " + string.Join(" ", args));
                }
            }

            //Remove a participating surrogate machine.
            {
                Console.WriteLine("-");
                Console.WriteLine("Testing removal of a participating surrogate...");

                //Participating surrogate.
                string newslavelist = slavelist;
                if (slavelist.IndexOf(surrogate, StringComparison.OrdinalIgnoreCase) == -1)
                {
                    newslavelist += ";" + surrogate;
                }
                Exec.Shell(@"Qizmt @format slaves=" + newslavelist);

                if (!CreateCache(surrogate, jobdir))
                {
                    return;
                }

                Exec.Shell(@"Qizmt removemachine " + surrogate);

                //Who is the new surrogate?
                string newsurrogate = LocateSurrogate(dspacedir, nonsurrogate);

                if (newsurrogate == null)
                {
                    Console.Error.WriteLine("After the removal of surrogate, cannot locate the new surrogate.");
                    return;
                }

                if (CacheExists(newsurrogate))
                {
                    Console.WriteLine("[FAILED] - " + string.Join(" ", args));
                }
                else
                {
                    Console.WriteLine("[PASSED] - " + string.Join(" ", args));
                }
            }

            //Removal of a non-participating surrogate.
            {
                Console.WriteLine("-");
                Console.WriteLine("Testing removal of a non-participating surrogate...");

                string newslavelist = "";
                if (slavelist.IndexOf(surrogate, StringComparison.OrdinalIgnoreCase) > -1)
                {
                    string[] hosts = slavelist.Split(';');
                    foreach (string host in hosts)
                    {
                        if (string.Compare(host, surrogate, true) != 0)
                        {
                            newslavelist += ";" + host;
                        }
                    }
                    newslavelist = newslavelist.Trim(new char[] { ';' });
                }
                else
                {
                    newslavelist = slavelist;
                }

                Exec.Shell(@"Qizmt @format slaves=" + newslavelist);

                if (!CreateCache(surrogate, jobdir))
                {
                    return;
                }

                Exec.Shell(@"Qizmt removemachine " + surrogate);

                string newsurrogate = LocateSurrogate(dspacedir, nonsurrogate);

                if (newsurrogate == null)
                {
                    Console.Error.WriteLine("Cannot locate new surrogate after the removal of surrogate machine.");
                    return;
                }

                if (CacheExists(newsurrogate))
                {
                    Console.WriteLine("[PASSED] - " + string.Join(" ", args));
                }
                else
                {
                    Console.WriteLine("[FAILED] - " + string.Join(" ", args));
                }
            }

            Exec.Shell(@"Qizmt @format slaves=" + slavelist);
        }
Beispiel #3
0
        public static void TestAddRefNonParticipatingCluster(string[] args)
        {
            if (args.Length < 2)
            {
                Console.Error.WriteLine("Error: LocalJobAddRefNonParticipatingCluster command needs argument: <dfsXmlPath>");
                return;
            }

            string dfspath = args[1];

            if (!dfspath.StartsWith(@"\\"))
            {
                Console.Error.WriteLine("Argument: <dfsXmlPath> must be a network path");
                return;
            }

            string surrogate = dfspath.Substring(2, dfspath.IndexOf(@"\", 2) - 2).ToUpper();

            System.Xml.XmlDocument dfs = new System.Xml.XmlDocument();
            string slavelist           = null;

            try
            {
                dfs.Load(dfspath);
                System.Xml.XmlNode node = dfs.SelectSingleNode("//SlaveList");
                if (node == null)
                {
                    Console.Error.WriteLine("SlaveList node is not found in dfs.xml");
                    return;
                }

                slavelist = node.InnerText.ToUpper();
                string[] parts = slavelist.Split(new char[] { ',', ';' });
                if (parts.Length < 2)
                {
                    Console.Error.WriteLine("Must have at least 2 hosts in SlaveList tag in dfs.xml");
                    return;
                }
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("Error loading dfs.xml: {0}", e.Message);
                return;
            }

            string dfsback = null;
            bool   ok      = false;

            try
            {
                if (slavelist.IndexOf(surrogate, StringComparison.OrdinalIgnoreCase) > -1)
                {
                    if (!DFSUtils.MakeFileBackup(dfspath, ref dfsback))
                    {
                        Console.Error.WriteLine("Error while backing up dfs.xml.");
                        return;
                    }
                    string   newslavelist = "";
                    string[] hosts        = slavelist.Split(new char[] { ',', ';' });
                    foreach (string host in hosts)
                    {
                        if (string.Compare(surrogate, host, true) != 0)
                        {
                            newslavelist = ";" + host;
                        }
                    }
                    newslavelist = newslavelist.Trim(';');
                    DFSUtils.ChangeDFSXMLSlaveList(dfs, dfspath, newslavelist);
                }

                string mr = @"<SourceCode>
  <Jobs>
    <Job>
      <Narrative>
        <Name>regression_test_put_dll_Preprocessing</Name>
        <Custodian></Custodian>
        <email></email>
      </Narrative>
      <IOSettings>
        <JobType>local</JobType>
      </IOSettings>
      <Local>
        <![CDATA[
        public virtual void Local()
        {
            Shell(@`Qizmt del regressionTestLocalJobAddRef4A30DE94_testdll.dll`);
        }
        ]]>
      </Local>
    </Job>
    <Job>
      <Narrative>
        <Name>regression_test_put_dll PUT DLL</Name>
        <Custodian></Custodian>
        <email></email>
      </Narrative>
      <IOSettings>
        <JobType>local</JobType>
      </IOSettings>
      <Local>
        <![CDATA[
        public virtual void Local()
        {
            string localdir = IOUtils.GetTempDirectory();            
            string fn = `regressionTestLocalJobAddRef4A30DE94_testdll.dll`;
            string localfn = localdir + @`\` + Guid.NewGuid().ToString() + fn;            
            string testdlldatab64 = `TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABQRQAATAEDAOMDJ0oAAAAAAAAAAOAAAiELAQgAAAgAAAAIAAAAAAAALicAAAAgAAAAQAAAAABAAAAgAAAAAgAABAAAAAAAAAAEAAAAAAAAAACAAAAAAgAAAAAAAAMAQIUAABAAABAAAAAAEAAAEAAAAAAAABAAAAAAAAAAAAAAAOAmAABLAAAAAEAAACgEAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAwAAAAsJgAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAACAAAAAAAAAAAAAAACCAAAEgAAAAAAAAAAAAAAC50ZXh0AAAANAcAAAAgAAAACAAAAAIAAAAAAAAAAAAAAAAAACAAAGAucnNyYwAAACgEAAAAQAAAAAYAAAAKAAAAAAAAAAAAAAAAAABAAABALnJlbG9jAAAMAAAAAGAAAAACAAAAEAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA`;
            byte[] testdlldata = System.Convert.FromBase64String(testdlldatab64);
            System.IO.File.WriteAllBytes(localfn, testdlldata);
            try
            {
                Shell(@`Qizmt dfs put ` + localfn + ` ` + fn);
            }
            finally
            {
                System.IO.File.Delete(localfn);
            }
        }
        ]]>
      </Local>
    </Job>
    <Job Name=`testdll` Custodian=`` email=``>
      <Add Reference=`regressionTestLocalJobAddRef4A30DE94_testdll.dll` Type=`dfs` />
      <Using>regressionTestLocalJobAddRef4A30DE94_testdll</Using>
      <IOSettings>
        <JobType>local</JobType>
      </IOSettings>
      <Local>
        <![CDATA[
        public virtual void Local()
        {
            Qizmt_Log(TestClass.SayHi());
        }
        ]]>
      </Local>
    </Job>
    <Job Name=`testdll` Custodian=`` email=``>
      <IOSettings>
        <JobType>local</JobType>
      </IOSettings>
      <Local>
        <![CDATA[
        public virtual void Local()
        {
            Shell(@`Qizmt del regressionTestLocalJobAddRef4A30DE94_testdll.dll`);
        }
        ]]>
      </Local>
    </Job>
  </Jobs>
</SourceCode>
".Replace('`', '"');

                string dir = @"\\" + System.Net.Dns.GetHostName() + @"\" + Environment.CurrentDirectory.Replace(':', '$') + @"\RegressionTest\LocalJobAddRefTest\";
                if (System.IO.Directory.Exists(dir))
                {
                    System.IO.Directory.Delete(dir, true);
                }
                System.IO.Directory.CreateDirectory(dir);

                System.IO.File.WriteAllText(dir + "regressionTest_localJobAddRef.xml", mr);

                string exe = Exec.GetQizmtExe();
                Exec.Shell(exe + " del regressionTest_localJobAddRef.xml");
                Exec.Shell(exe + " importdir " + dir);

                Console.WriteLine("-");
                Console.WriteLine("Testing add reference in a local job on a non-participating cluster...");

                string output   = Exec.Shell(exe + " exec regressionTest_localJobAddRef.xml");
                string expected = "hi there";
                if (output.IndexOf(expected, StringComparison.OrdinalIgnoreCase) > -1)
                {
                    Console.WriteLine("[PASSED] - " + string.Join(" ", args));
                }
                else
                {
                    Console.WriteLine("[FAILED] - " + string.Join(" ", args));
                }

                //Clean up
                Exec.Shell(exe + " del regressionTest_localJobAddRef.xml");
                System.IO.Directory.Delete(dir, true);
            }
            catch (Exception e)
            {
                Console.Error.WriteLine("Error during local job add reference testing: {0}", e.Message);
            }
            finally
            {
                if (dfsback != null)
                {
                    ok = DFSUtils.UndoFileChanges(dfspath, dfsback);
                }
            }

            if (dfsback != null && ok)
            {
                System.IO.File.Delete(dfsback);
            }
        }