Exemplo n.º 1
0
        //Copy CS helper code into autoevaluation zone
        public void CopySupportFiles(AutoEvaluation eval)
        {
            FileSystem fs = new FileSystem(Globals.CurrentIdentity);

            //Get zone
            CFile zone = fs.GetFile(eval.ZoneID);

            //Copy CS program over
            CFile.FileList dfiles = new CFile.FileList();
            dfiles.Add(fs.GetFile(@"c:\system\checkstyle\CheckStyle.class"));
            dfiles.Add(fs.GetFile(@"c:\system\checkstyle\checksubj.xslt"));
            fs.CopyFiles(zone, dfiles, true);
        }
Exemplo n.º 2
0
        public string Discover(AutoEvaluation eval, out double points, out int time, out int count)
        {
            //Get Perl
            IExternalTool perl = ExternalToolFactory.GetInstance().CreateExternalTool("Perl",
                "5.0", ExternalToolFactory.VersionCompare.ATLEAST);
            if (perl == null)
                throw new JUnitToolException(
                    "Unable to find Perl v5.0 or later. Please check the installation or contact the administrator");

            //Get all files on the disk
            string tpath = ExportToTemp(eval);

            //Run disco program
            perl.Arguments = "jdisco.pl i";
            perl.Execute(tpath);
            Directory.Delete(tpath, true);

            //Validate XML
            string xmltests = perl.Output;
            XmlWizard xmlwiz = new XmlWizard();
            if (!xmlwiz.ValidateXml(xmltests, Path.Combine(Globals.WWWDirectory, "Xml/testsuite.xsd")))
                throw new JUnitToolException("Invalid JUnit Test Suite. Check to make sure the test suite conforms to FrontDesk standards");

            //Write XML
            FileSystem fs = new FileSystem(Globals.CurrentIdentity);
            CFile zone = fs.GetFile(eval.ZoneID);
            string tspath = Path.Combine(zone.FullPath, "__testsuite.xml");
            CFile xmldesc = fs.GetFile(tspath);
            if (xmldesc == null)
                xmldesc = fs.CreateFile(tspath, false, null);
            xmldesc.Data = xmltests.ToCharArray();
            fs.Edit(xmldesc);
            fs.Save(xmldesc);

            //Copy disco program over
            CFile.FileList dfiles = new CFile.FileList();
            dfiles.Add(fs.GetFile(@"c:\system\junit\jdisco.pl"));
            dfiles.Add(fs.GetFile(@"c:\system\junit\JUnitDiscover.class"));
            dfiles.Add(fs.GetFile(@"c:\system\junit\JUnitDiscover$ClassFileFilter.class"));
            fs.CopyFiles(zone, dfiles, true);

            //Get suite metadata
            GetSuiteInfo(xmltests, out points, out time, out count);

            //Punt all previous results
            RemoveResults(eval);

            return xmltests;
        }
Exemplo n.º 3
0
 private CFile.FileList GetFiles(string files)
 {
     string[] tokens = files.Split("|".ToCharArray());
     CFile.FileList flist = new CFile.FileList();
     FileSystem fs = new FileSystem(Globals.CurrentIdentity);
     foreach (string sfile in tokens)
         if (sfile.Length > 0)
             flist.Add(fs.GetFile(Convert.ToInt32(sfile)));
     return flist;
 }
Exemplo n.º 4
0
 private CFile.FileList GetSelectedFiles()
 {
     FileSystem fs = new FileSystem(Globals.CurrentIdentity);
     CheckBox chkSelect;
     CFile.FileList selfiles = new CFile.FileList();
     foreach (DataGridItem item in dgFiles.Items) {
         if (null != (chkSelect = (CheckBox)item.FindControl("chkSelect")))
             if (chkSelect.Checked)
                 selfiles.Add(fs.GetFile((int)dgFiles.DataKeys[item.ItemIndex]));
     }
     return selfiles;
 }
Exemplo n.º 5
0
        private void BindFileGrid()
        {
            FileSystem fs = new FileSystem(Globals.CurrentIdentity);
            string path = GetCurrentPath();
            if (path == null) return;

            CFile file = fs.GetFile(path);
            CFile.FileList dirlist;
            try {
                dirlist = fs.ListDirectory(file);
            } catch (CustomException er) {
                dirlist = new CFile.FileList();
                DisplayMessage(er.Message);
            }

            dirlist.Insert(0, file);

            m_curdir = file;
            dgFiles.DataSource = dirlist;
            dgFiles.DataBind();
        }