Example #1
0
        public bool SaveProcessedDataPackage(Stream filestream, ProcessedDataPackage package)
        {
            XmlDocument xml = null;

            if (package == null || (xml = package.Serialize()) == null)
            {
                return(false);
            }

            xml.Save(filestream);

            return(true);
        }
Example #2
0
        private void ProcessResults(ProcessedDataPackage package)
        {
            IConfigGetter getter = ConfigProvider.Instance.GetConfigGetter("MSFast.Global");

            if (getter == null)
            {
                SetTestRunning(false);
                SetTestStatus(TestEventType.TestEnded, false, PageDataCollectorErrors.InvalidConfiguration, -1);
            }

            #region Collected Data

            String graphResults = null;

            if (getter.GetBoolean(MSFastGlobalConfigKeys.PAGE_GRAPH))
            {
                if (package.ContainsKey(typeof(DownloadData)) != false ||
                    package.ContainsKey(typeof(RenderData)) != false ||
                    package.ContainsKey(typeof(PerformanceData)) != false)
                {
                    SerializedResultsFilesInfo srfi = new SerializedResultsFilesInfo(package);

                    if (String.IsNullOrEmpty(srfi.GetFolderNameAndCheckIfValid()))
                    {
                        SetTestRunning(false);
                        SetTestStatus(TestEventType.TestEnded, false, PageDataCollectorErrors.InvalidConfiguration, -1);
                        return;
                    }

                    package.ThumbnailsRoot = "file://" + srfi.GetFolderNameAndCheckIfValid();

                    XmlDocument x = package.Serialize();

                    if (x == null)
                    {
                        SetTestRunning(false);
                        SetTestStatus(TestEventType.TestEnded, false, PageDataCollectorErrors.Unknown, -1);
                        return;
                    }

                    try
                    {
                        x.Save(srfi.GetFullPath());
                        graphResults = srfi.GetFullPath();
                    }
                    catch
                    {
                        SetTestRunning(false);
                        SetTestStatus(TestEventType.TestEnded, false, PageDataCollectorErrors.Unknown, -1);
                        return;
                    }
                }
            }
            #endregion

            #region Validation

            ValidationResultsPackage validationResults = null;

            if (getter.GetBoolean(MSFastGlobalConfigKeys.PAGE_VALIDATION))
            {
                if (validationRunner == null)
                {
                    CreateValidationRunner();
                }

                if (validationRunner != null)
                {
                    validationResults = validationRunner.ValidateBlocking(package);
                }
            }

            #endregion

            SetTestRunning(false);
            SetTestStatus(TestEventType.TestEnded, true);

            ShowOutcome(graphResults, validationResults, package);
        }