Exemplo n.º 1
0
        protected bool CreateZone(AutoEvaluation eval)
        {
            FileSystem fs = FileSystem.GetInstance();
            DataSet desc = new DataSet();

            //Create initial zone directory
            string zpath = Path.Combine(TestConfig.LocalZonePath, eval.ZoneID.ToString());
            Directory.CreateDirectory(zpath);

            //Export the zone files into local store
            IExternalSink zdir = new OSFileSystemSink();

            m_logger.Log("Retrieving zone files for zone: " + eval.ZoneID);

            zdir.CreateSink("");
            try {
                desc = fs.ExportData(zpath, fs.GetFile(eval.ZoneID), zdir, false);

                //Write XML descriptor
                desc.Tables["Export"].Rows[0]["Mod"] = eval.ZoneModified.ToString();
                desc.WriteXml(Path.Combine(zpath, "__zone.xml"));
                m_logger.Log("Zone retrieved successfully");

            } catch (FileOperationException e) {
                m_logger.Log("File error: " + e.Message, TestLogger.LogType.ERROR);
                zdir.CloseSink();
                return false;
            } catch (DataAccessException er) {
                m_logger.Log("Data error: " + er.Message, TestLogger.LogType.ERROR);
                zdir.CloseSink();
                return false;
            } catch (Exception e) {
                m_logger.Log("Unexpected error: " + e.Message, TestLogger.LogType.ERROR);
                m_logger.Log("Trace: " + e.StackTrace, TestLogger.LogType.ERROR);
                zdir.CloseSink();
                return false;
            }

            return true;
        }
Exemplo n.º 2
0
        private string ExportToTemp(AutoEvaluation eval)
        {
            FileSystem fs = new FileSystem(Globals.CurrentIdentity);

            string tpath = Path.Combine(Globals.TempDirectory, Globals.CurrentUserName);
            try { Directory.Delete(tpath); } catch (Exception) { }
            Directory.CreateDirectory(tpath);

            IExternalSink tsink = new OSFileSystemSink();
            tsink.CreateSink("");

            //Export eval files (JUnit test suite)
            try {
                fs.ExportData(tpath, fs.GetFile(eval.ZoneID), tsink, false);
            } catch (Exception er) {
                string mike = er.Message;
            }

            //Export jdisco program
            try {
                fs.ExportData(tpath, fs.GetFile(@"c:\system\junit"), tsink, false);
            } catch (Exception er) {
                string mike = er.Message;
            }

            return tpath;
        }
Exemplo n.º 3
0
        protected bool CreateZone(IZoneComponent eval)
        {
            FileSystem fs = new FileSystem(m_ident);
            DataSet desc = new DataSet();

            //Create initial zone directory
            string zpath = Path.Combine(TestConfig.LocalZonePath,
                m_prefix + eval.GetZoneID().ToString());
            Directory.CreateDirectory(zpath);

            //Export the zone files into local store
            IExternalSink zdir = new OSFileSystemSink();

            zdir.CreateSink("");
            try {
                desc = fs.ExportData(zpath, fs.GetFile(eval.GetZoneID()), zdir, false);

                //Write XML descriptor
                desc.Tables["Export"].Rows[0]["Mod"] = eval.GetZoneModified().Ticks;
                desc.WriteXml(Path.Combine(zpath, ZONE_FILE));
                m_logger.Log("Zone retrieved successfully");

            } catch (FileOperationException e) {
                m_logger.Log("File error: " + e.Message, TestLogger.LogType.ERROR);
                zdir.CloseSink();
                return false;
            } catch (DataAccessException er) {
                m_logger.Log("Data error: " + er.Message, TestLogger.LogType.ERROR);
                zdir.CloseSink();
                return false;
            } catch (Exception e) {
                m_logger.Log("Unexpected error: " + e.Message, TestLogger.LogType.ERROR);
                m_logger.Log("Trace: " + e.StackTrace, TestLogger.LogType.ERROR);
                zdir.CloseSink();
                return false;
            }

            return true;
        }