コード例 #1
0
ファイル: tests.aspx.cs プロジェクト: SEDS/CUTS
        /**
         * Handle the Page_Load event.
         */
        private void Page_Load(object sender, System.EventArgs e)
        {
            this.master_ = (CUTS.Master) this.Master;

            try
            {
                // Initialize the archive for the browser.
                this.browser_.TestArchive = this.archive_;

                if (!this.IsPostBack)
                {
                    // Set the active test for the control.
                    if (Session["activeTest"] != null)
                    {
                        CUTS.UUID uuid = (CUTS.UUID)Session["activeTest"];
                        this.browser_.ActivateTest(uuid);
                    }

                    // Bind the data to the control.
                    this.browser_.DataBind();
                }
            }
            catch (Exception ex)
            {
                this.master_.Console.Add(ex);
            }
        }
コード例 #2
0
        public void CloseTest(CUTS.UUID uuid)
        {
            // Open the file to receieve the download on the server.
            string path = this.get_filename(uuid);

            if (File.Exists(path))
            {
                File.Delete(path);
            }
        }
コード例 #3
0
        public void DownloadTest(CUTS.UUID uuid)
        {
            // Open the file to receieve the download on the server.
            string       path   = this.get_filename(uuid);
            BinaryWriter writer = new BinaryWriter(File.Open(path, FileMode.Create));

            // Request a new download from the server.
            CUTS.DownloadRequest request = new DownloadRequest();
            request.uuid       = uuid;
            request.chunk_size = 1024;

            CUTS.TestRetriever retriever = this.archive_.begin_download(request);
            bool success = false;

            try
            {
                byte[] data;

                // Download the data from the archive.
                while (retriever.recv_data(out data))
                {
                    writer.Write(data);
                }

                // Set the result of the download.
                success = true;
            }
            finally
            {
                try
                {
                    if (retriever != null)
                    {
                        this.archive_.download_complete(retriever);
                    }
                }
                finally
                {
                    writer.Close();
                }
            }

            if (success)
            {
                // Save the UUID of the test.
                this.active_test_ = uuid;

                // Notify controls of the download complete.
                if (this.DownloadComplete != null)
                {
                    this.DownloadComplete(this, new EventArgs());
                }
            }
        }
コード例 #4
0
ファイル: UUID.cs プロジェクト: SEDS/CUTS
 public static bool IsEqual(CUTS.UUID u1, CUTS.UUID u2)
 {
     return(u1.data1 == u2.data1 &&
            u1.data2 == u2.data2 &&
            u1.data3 == u2.data3 &&
            u1.data4[0] == u2.data4[0] &&
            u1.data4[1] == u2.data4[1] &&
            u1.data4[2] == u2.data4[2] &&
            u1.data4[3] == u2.data4[3] &&
            u1.data4[4] == u2.data4[4] &&
            u1.data4[5] == u2.data4[5] &&
            u1.data4[6] == u2.data4[6] &&
            u1.data4[7] == u2.data4[7]);
 }
コード例 #5
0
ファイル: analysis.aspx.cs プロジェクト: SEDS/CUTS
        protected void handle_chart_unit_test(object sender, CommandEventArgs e)
        {
            if (this.master_ == null)
            {
                this.master_ = (CUTS.Master) this.Page.Master;
            }

            // Get the unit test from the argument.
            UnitTest unittest = (UnitTest)e.CommandArgument;

            // Initialize a new evaluator.
            UnitTestEvaluator evaluator = new UnitTestEvaluator(this.database_.Provider);

            evaluator.ConnectionString = this.database_.ConnectionString;
            evaluator.TempPath         = Server.MapPath("~/db/sandbox/evaluations");

            // Get the active test.
            CUTS.UUID active_test = (CUTS.UUID) this.Session["activeTest"];

            // Construct the location of the test data.
            string pathname = String.Format("~/db/sandbox/{0}.cdb",
                                            CUTS.Data.UUID.ToString(active_test));

            pathname = this.Server.MapPath(pathname);

            try
            {
                // Get the data trend from the test result.
                evaluator.Open();
                UnitTestDataTrend trend = evaluator.GetDataTrend(pathname, unittest.UnitTestId);

                // Generate the chart for the test.
                this.generate_chart(unittest, trend);

                // Show the chart and hide the test suite.
                this.trend_view_.Visible  = true;
                this.scalar_view_.Visible = false;
            }
            catch (Exception ex)
            {
                this.master_.Console.Add(ex);
            }
            finally
            {
                if (evaluator.State == ConnectionState.Open)
                {
                    evaluator.Close();
                }
            }
        }
コード例 #6
0
ファイル: UUID.cs プロジェクト: SEDS/CUTS
 public static string ToString(CUTS.UUID uuid)
 {
     return(String.Format("{0:X8}-{1:X4}-{2:X4}-{3:X2}{4:X2}-{5:X2}{6:X2}{7:X2}{8:X2}{9:X2}{10:X2}",
                          uuid.data1,
                          uuid.data2,
                          uuid.data3,
                          uuid.data4[0],
                          uuid.data4[1],
                          uuid.data4[2],
                          uuid.data4[3],
                          uuid.data4[4],
                          uuid.data4[5],
                          uuid.data4[6],
                          uuid.data4[7]));
 }
コード例 #7
0
        void handle_profile_command(object sender, CommandEventArgs e)
        {
            CUTS.UUID uuid = (CUTS.UUID)e.CommandArgument;

            switch (e.CommandName)
            {
            case "open":
                this.DownloadTest(uuid);
                break;

            case "close":
                this.CloseTest(uuid);
                break;
            }
        }
コード例 #8
0
ファイル: analysis.aspx.cs プロジェクト: SEDS/CUTS
        protected void handle_evaluate_unit_test(object sender, CommandEventArgs e)
        {
            if (this.master_ == null)
            {
                this.master_ = (CUTS.Master) this.Page.Master;
            }

            // Get the unit test from the argument.
            UnitTest unittest = (UnitTest)e.CommandArgument;

            // Initialize a new evaluator.
            UnitTestEvaluator evaluator = new UnitTestEvaluator(this.database_.Provider);

            evaluator.ConnectionString = this.database_.ConnectionString;
            evaluator.TempPath         = Server.MapPath("~/db/sandbox/evaluations");

            // Get the active test.
            CUTS.UUID active_test = (CUTS.UUID) this.Session["activeTest"];

            // Construct the location of the test data.
            string pathname = String.Format("~/db/sandbox/{0}.cdb",
                                            CUTS.Data.UUID.ToString(active_test));

            pathname = this.Server.MapPath(pathname);

            try
            {
                // Re-evalatue the unit test
                evaluator.Open();
                unittest.Result = evaluator.Reevaluate(pathname, unittest.UnitTestId, true);
            }
            catch (Exception ex)
            {
                this.master_.Console.Add(ex);
            }
            finally
            {
                if (evaluator.State == ConnectionState.Open)
                {
                    evaluator.Close();
                }
            }
        }
コード例 #9
0
ファイル: BMW.master.cs プロジェクト: SEDS/CUTS
        protected void handle_onlogout(object sender, EventArgs e)
        {
            if (Session["activeTest"] != null)
            {
                // Delete the active test.
                CUTS.UUID uuid = (CUTS.UUID)Session["activeTest"];
                string    path = this.GetFileName(uuid);

                if (File.Exists(path))
                {
                    File.Delete(path);
                }
            }

            // Delete this session.
            this.Session.Abandon();

            // Complete the logout process.
            FormsAuthentication.SignOut();
            this.Response.Redirect("~/default.aspx");
        }
コード例 #10
0
ファイル: UUID.cs プロジェクト: SEDS/CUTS
 public static bool IsNotEqual(CUTS.UUID u1, CUTS.UUID u2)
 {
     return(!IsEqual(u1, u2));
 }
コード例 #11
0
ファイル: BMW.master.cs プロジェクト: SEDS/CUTS
 public string GetFileName(CUTS.UUID uuid)
 {
     return(String.Format("{0}/{1}.cdb",
                          this.download_path_,
                          CUTS.Data.UUID.ToString(uuid)));
 }
コード例 #12
0
 public void ActivateTest(CUTS.UUID uuid)
 {
     this.active_test_ = uuid;
 }
コード例 #13
0
 private string get_filename(CUTS.UUID uuid)
 {
     return(String.Format("{0}/{1}.cdb",
                          this.download_path_,
                          CUTS.Data.UUID.ToString(uuid)));
 }