Exemplo n.º 1
0
        private void GeneratePage(Document document, Data.TestLogFull data)
        {
            var newLine = CreateParagraph(Environment.NewLine
                                          , FontFactory.GetFont(FontFactory.TIMES_BOLD, 10)
                                          , Element.ALIGN_CENTER);
            var title = CreateParagraph(Title
                                        , FontFactory.GetFont(FontFactory.TIMES_BOLD, 14)
                                        , Element.ALIGN_CENTER);

            document.Add(title);
            document.Add(newLine);
            var firstParagraph = CreateParagraph(FirstParagraphText
                                                 , FontFactory.GetFont("Arial", 10)
                                                 , Element.ALIGN_JUSTIFIED);

            document.Add(firstParagraph);
            document.Add(newLine);
            AddResponsibleMethodTable(document, data);
            document.Add(newLine);
            AddDeviceTable(document, data);
            document.Add(newLine);
            AddSpecificationsTable(document, data);
            document.Add(newLine);
            AddAutorizationTable(document);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates report.
        /// </summary>
        /// <param name="fileName">Path to save report.</param>
        /// <param name="log">Test execution information.</param>
        public void CreateReport(string fileName, Data.TestLogFull log)
        {
            _log = log;
            bool ok = false;

            try
            {
                _document = new Document(PageSize.A4);
                Writer    = PdfWriter.GetInstance(_document, new FileStream(fileName, FileMode.Create));

                CustomDocumentInitialization();

                _document.Open();

                GenerateDocumentContent();

                ok = true;
            }
            catch (Exception ex)
            {
                RaiseOnException(ex);
            }
            finally
            {
                if (_document.IsOpen())
                {
                    _document.Close();
                }
            }
            if (ok)
            {
                RaiseDocumentSaved();
            }
        }
Exemplo n.º 3
0
        private void AddSpecificationsTable(Document document, Data.TestLogFull data)
        {
            var maxLength           = 53;
            var countOfFailedTests  = data.TestResults.Count(item => item.Value.Log.TestStatus == TestTool.Tests.Definitions.Trace.TestStatus.Failed);
            var isConformanceFailed = countOfFailedTests > 0 ||
                                      data.InitializationData.FailedProfiles.Count > 0 ||
                                      data.InitializationData.SupportedProfiles.Count == 0;
            var rows = new Dictionary <string, string>();

            rows.Add("Profile:", (isConformanceFailed)
                                     ? new string('_', maxLength)
                                     : string.Join("; ", data.InitializationData.SupportedProfiles.Select(item => item.Name).ToArray()));
            rows.Add("ONVIF Device Test Tool version:", data.Application.ToolVersion);

            if (isConformanceFailed)
            {
                rows.Add("Tool test result:", string.Format("FAILED TEST CASES: {0} ", countOfFailedTests));
                rows.Add("Applicable Test Tool errata:", new string('_', maxLength));
            }
            var table = CreateReportTable(rows
                                          , "The device identified above conforms to the following specifications:"
                                          , FontFactory.GetFont("Arial", 10)
                                          , isConformanceFailed ? TestReportAccompanied : null
                                          , isConformanceFailed ? FontFactory.GetFont("Arial", 9) : null);

            table.SetWidthPercentage(new float[]
            {
                document.PageSize.Width * 0.32F,
                document.PageSize.Width * 0.68F
            }
                                     , document.PageSize);

            document.Add(table);
        }
Exemplo n.º 4
0
        private void AddTecnicalSupportTable(Document document, Data.TestLogFull data)
        {
            var rows = new Dictionary <string, string>();

            // mandatory value
            rows.Add("General international support contact address:", data.SupportInfo.InternationalAddress);

            // optional value
            if (!string.IsNullOrEmpty(data.SupportInfo.RegionalAddress))
            {
                rows.Add("Regional support contact address:", data.SupportInfo.RegionalAddress);
            }
            else
            {
                rows.Add("Regional support contact address:", "none");
            }

            // mandatory value
            rows.Add("Technical support website URL:", data.SupportInfo.SupportUrl);

            // optional value
            if (!string.IsNullOrEmpty(data.SupportInfo.SupportEmail))
            {
                rows.Add("Technical support email:", data.SupportInfo.SupportEmail);
            }
            else
            {
                rows.Add("Technical support email:", "none");
            }

            // optional value
            if (!string.IsNullOrEmpty(data.SupportInfo.SupportPhone))
            {
                rows.Add("Technical support phone:", data.SupportInfo.SupportPhone);
            }
            else
            {
                rows.Add("Technical support phone:", "none");
            }

            var table = CreateReportTable(
                rows,
                "Technical support contact information:",
                FontFactory.GetFont("Arial", 10),
                null,
                null);

            table.SetWidthPercentage(new float[]
            {
                document.PageSize.Width * 0.32F,
                document.PageSize.Width * 0.68F
            }
                                     , document.PageSize);

            document.Add(table);
        }
        /// <summary>
        /// Creates report
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="reportGenerator"></param>
        private void CreateReport(string fileName, IReportGenerator reportGenerator)
        {
            UpdateContext();

            Data.TestLogFull testLog = GetFullTestData();

            reportGenerator.OnException   += reportGenerator_OnException;
            reportGenerator.OnReportSaved += reportGenerator_OnReportSaved;

            reportGenerator.CreateReport(fileName, testLog);

            reportGenerator.OnException   -= reportGenerator_OnException;
            reportGenerator.OnReportSaved -= reportGenerator_OnReportSaved;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Creates report.
        /// </summary>
        /// <param name="fileName">Path to save report.</param>
        /// <param name="log">Test execution information.</param>
        public void CreateReport(string fileName, Data.TestLogFull log)
        {
            _log = log;
            bool ok = false;

            try
            {
                _document = new Document(PageSize.A4);

                PdfWriter.GetInstance(_document, new FileStream(fileName, FileMode.Create));

                _document.Open();

                // Create Footer
                _document.Footer = HeaderAndFooter();

                // Create cover page
                BuildCoverPage();

                // Create summary
                BuildSummary();

                // Create index
                BuildIndex();

                // Create test info
                AddTestGroupInfo();

                ok = true;
            }
            catch (Exception ex)
            {
                if (OnException != null)
                {
                    OnException(ex);
                }
            }
            finally
            {
                if (_document.IsOpen())
                {
                    _document.Close();
                }
            }
            if (ok && OnReportSaved != null)
            {
                OnReportSaved();
            }
        }
Exemplo n.º 7
0
        private void AddResponsibleMethodTable(Document document, Data.TestLogFull data)
        {
            var table = CreateReportTable(new Dictionary <string, string>
            {
                { "Member name:", data.MemberInfo.Name },
                { "Member address:", data.MemberInfo.Address }
            }
                                          , "Responsible member:"
                                          , FontFactory.GetFont("Arial", 10)
                                          , null, null);

            table.SetWidthPercentage(new float[]
            {
                document.PageSize.Width * 0.32F,
                document.PageSize.Width * 0.68F
            }
                                     , document.PageSize);
            document.Add(table);
        }
Exemplo n.º 8
0
        private void AddDeviceTable(Document document, Data.TestLogFull data)
        {
            var features = new []
            {
                string.Format("PTZ:   {0}"
                              , (data.Features != null && data.Features.Contains(Feature.PTZService))
                                                   ? "Yes"
                                                   : "NO"),
                string.Format("Audio: {0}"
                              , (data.Features != null && data.Features.Contains(Feature.Audio))
                                                   ? "Yes"
                                                   : "NO"),
                string.Format("I/O:   {0}"
                              , (data.Features != null && data.Features.Contains(Feature.DeviceIORelayOutputs))
                                                   ? "Yes"
                                                   : "NO"),
            };

            var table = CreateReportTable(new Dictionary <string, string>
            {
                { "Product name:", data.DeviceInfo.ProductName },
                { "Product firmware version:", data.DeviceInformation.FirmwareVersion },
                //{"Product hardware id:", data.DeviceInformation.HardwareID},
                { "Device features:", string.Join(Environment.NewLine
                                                  , features) },
            }
                                          , "Device:"
                                          , FontFactory.GetFont("Arial", 10)
                                          , null, null);

            table.SetWidthPercentage(new float[]
            {
                document.PageSize.Width * 0.32F,
                document.PageSize.Width * 0.68F
            }
                                     , document.PageSize);
            document.Add(table);
        }
Exemplo n.º 9
0
        private void AddDeviceTable(Document document, Data.TestLogFull data)
        {
            var featuresProfileS = new []
            {
                string.Format("PTZ:   {0}"
                              , (data.Features != null && data.Features.Contains(Feature.PTZService))
                                                   ? "Yes"
                                                   : "NO"),
                string.Format("Audio: {0}"
                              , (data.Features != null && data.Features.Contains(Feature.Audio))
                                                   ? "Yes"
                                                   : "NO"),
                string.Format("I/O:   {0}"
                              , (data.Features != null && data.Features.Contains(Feature.DeviceIORelayOutputs))
                                                   ? "Yes"
                                                   : "NO"),
            };

            var featuresProfileG = new[]
            {
                string.Format("Recording from local source (Video Input): {0}",
                              (data.Features != null &&
                               data.Features.Contains(Feature.MediaService) &&
                               data.Features.Contains(Feature.RecordingControlService))
                    ? "Yes"
                    : "NO"),

                string.Format("Recording from remote source (separate IP Device): {0}",
                              (data.Features != null &&
                               data.Features.Contains(Feature.ReceiverService) &&
                               data.Features.Contains(Feature.RecordingControlService))
                    ? "Yes"
                    : "NO"),

                string.Format("Audio Recording and Replay: {0}",
                              (data.Features != null &&
                               data.Features.Contains(Feature.AudioRecording) &&
                               data.Features.Contains(Feature.ReplayService))
                    ? "Yes"
                    : "NO"),

                string.Format("Reverse Replay: {0}",
                              (data.Features != null &&
                               data.Features.Contains(Feature.ReverseReplay))
                    ? "Yes"
                    : "NO"),

                string.Format("PTZ Position Search: {0}",
                              (data.Features != null &&
                               data.Features.Contains(Feature.PTZPositionSearch))
                    ? "Yes"
                    : "NO"),
            };

            Dictionary <string, string> device = new Dictionary <string, string>
            {
                { "Product type:", data.ProductTypes },
                { "Product name:", data.ProductName },
                { "Product firmware version:", data.DeviceInformation.FirmwareVersion }
            };

            bool profileS = data.InitializationData.Scopes.Contains(typeof(BasicStreamingProfile).GetProfileScope());

            if (profileS)
            {
                device.Add("Profile S features:", string.Join(Environment.NewLine, featuresProfileS));
            }

            var  T        = typeof(StorageProfile);
            bool profileG = data.InitializationData.Scopes.Contains(T.GetProfileScope()) && ProfileVersionStatus.Release == T.GetProfileVersionStatus();

            if (profileG)
            {
                device.Add("Profile G features:", string.Join(Environment.NewLine, featuresProfileG));
            }

            var table = CreateReportTable(device, "Device:", FontFactory.GetFont("Arial", 10), null, null);

            table.SetWidthPercentage(new float[]
            {
                document.PageSize.Width * 0.32F,
                document.PageSize.Width * 0.68F
            }
                                     , document.PageSize);
            document.Add(table);
        }
Exemplo n.º 10
0
        private void AddDeviceTable(Document document, Data.TestLogFull data)
        {
            var featuresProfileS = new[]
            {
                string.Format("PTZ:   {0}"
                              , (data.Features != null && data.Features.Contains(Feature.PTZService))
                                                   ? "Yes"
                                                   : "NO"),
                string.Format("Audio: {0}"
                              , (data.Features != null && data.Features.Contains(Feature.Audio))
                                                   ? "Yes"
                                                   : "NO"),
                string.Format("I/O:   {0}"
                              , (data.Features != null && data.Features.Contains(Feature.DeviceIORelayOutputs))
                                                   ? "Yes"
                                                   : "NO"),
            };

            var featuresProfileG = new[]
            {
                string.Format("Recording from local source (Video Input): {0}",
                              (data.Features != null &&
                               data.Features.Contains(Feature.MediaService) &&
                               data.Features.Contains(Feature.RecordingControlService))
                    ? "Yes"
                    : "NO"),

                string.Format("Recording from remote source (separate IP Device): {0}",
                              (data.Features != null &&
                               data.Features.Contains(Feature.ReceiverService) &&
                               data.Features.Contains(Feature.RecordingControlService))
                    ? "Yes"
                    : "NO"),

                string.Format("Audio Recording and Replay: {0}",
                              (data.Features != null &&
                               data.Features.Contains(Feature.AudioRecording) &&
                               data.Features.Contains(Feature.ReplayService))
                    ? "Yes"
                    : "NO"),

                string.Format("Reverse Replay: {0}",
                              (data.Features != null &&
                               data.Features.Contains(Feature.ReverseReplay))
                    ? "Yes"
                    : "NO"),

                string.Format("PTZ Position Search: {0}",
                              (data.Features != null &&
                               data.Features.Contains(Feature.PTZPositionSearch))
                    ? "Yes"
                    : "NO"),
            };

            var featuresProfileQ = new[]
            {
                string.Format("Firmware Upgrade : {0}",
                              (data.Features != null &&
                               data.Features.Contains(Feature.HttpFirmwareUpgrade))
                    ? "Yes"
                    : "NO"),

                string.Format("Backup and Restore : {0}",
                              (data.Features != null &&
                               data.Features.Contains(Feature.HttpSystemBackup))
                    ? "Yes"
                    : "NO"),

                string.Format("Keystore : {0}",
                              (data.Features != null &&
                               (data.Features.Contains(Feature.RSAKeyPairGeneration) ||
                                data.Features.Contains(Feature.PKCS8RSAKeyPairUpload)) &&
                               data.Features.Contains(Feature.SelfSignedCertificateCreationWithRSA) &&
                               data.Features.Contains(Feature.PKCS10ExternalCertificationWithRSA) &&
                               data.Features.Contains(Feature.MaximumNumberOfKeys) &&
                               data.Features.Contains(Feature.MaximumNumberOfCertificates))
                    ? "Yes"
                    : "NO"),

                string.Format("TLS Server Configuration : {0}",
                              (data.Features != null &&
                               (data.Features.Contains(Feature.RSAKeyPairGeneration) || data.Features.Contains(Feature.TLSServerSupport)))
                    ? "Yes"
                    : "NO"),

                string.Format("Remote User Management : {0}",
                              (data.Features != null &&
                               data.Features.Contains(Feature.RemoteUserHandling))
                    ? "Yes"
                    : "NO"),
            };

            Dictionary <string, string> device = new Dictionary <string, string>
            {
                { "Product type:", data.ProductTypes },
                { "Product name:", data.ProductName },
                { "Product firmware version:", data.DeviceInformation.FirmwareVersion }
            };

            bool profileS = typeof(BasicStreamingProfile).ScopesMatched(data.InitializationData.Scopes);

            if (profileS)
            {
                device.Add("Profile S features:", string.Join(Environment.NewLine, featuresProfileS));
            }

            var  T        = typeof(StorageProfile);
            bool profileG = T.ScopesMatched(data.InitializationData.Scopes) && ProfileVersionStatus.Release == T.GetProfileVersionStatus();

            if (profileG)
            {
                device.Add("Profile G features:", string.Join(Environment.NewLine, featuresProfileG));
            }

            var TProfileQ = typeof(ProfileQ);
            //bool profileQ = TProfileQ.ScopesMatched(data.InitializationData.Scopes) && (ProfileVersionStatus.Release == TProfileQ.GetProfileVersionStatus() || ProfileVersionStatus.ReleaseCandidate == TProfileQ.GetProfileVersionStatus());
            bool profileQ = TProfileQ.ScopesMatched(data.InitializationData.Scopes) && (ProfileVersionStatus.Release == TProfileQ.GetProfileVersionStatus());

            if (profileQ)
            {
                device.Add("Profile Q features:", string.Join(Environment.NewLine, featuresProfileQ));
            }

            var table = CreateReportTable(device, "Device:", FontFactory.GetFont("Arial", 10), null, null);

            table.SetWidthPercentage(new float[]
            {
                document.PageSize.Width * 0.32F,
                document.PageSize.Width * 0.68F
            }
                                     , document.PageSize);
            document.Add(table);
        }