Пример #1
0
        public void serializeReportIntervalsTelemetryStatus()
        {
            ReportDescription reportDescription = new ReportDescription();

            reportDescription.addReport("specifierID", ReportName.TELEMETRY_STATUS, 0, DurationModifier.MINUTES);

            reportDescription.addIntervalResourceStatus("specifierID", DateTime.UtcNow, 0, DurationModifier.SECONDS, "rid", 1, (float)1.0, DataQuality.qualityGoodNonSpecific,
                                                        true, false, (float)1.0, (float)2.0, (float)3.0, (float)4.0, (float)5.0, (float)6.0, (float)7.0, (float)8.0, (float)9.0,
                                                        (float)10.0, (float)11.0, (float)12.0, (float)13.0, (float)14.0, (float)15.0, (float)16.0);

            oadrReportType report = reportDescription.generateReport("specifierID", DateTime.UtcNow);

            string output = SerializeOadrObject.serializeOjbect(report, typeof(oadrReportType));

            Assert.IsTrue(output.Contains("<oadrReportPayload"));
            Assert.IsTrue(output.Contains("<oadrPayloadResourceStatus"));
        }
Пример #2
0
        public void R1_3010_TH_VTN_1()
        {
            VEN2b ven = new VEN2b(new HttpWebRequestWrapper(false, System.Net.SecurityProtocolType.Tls12), TestProperties.vtnURL, TestProperties.venName, "", TestProperties.venPassword);

            QueryRegistration queryRegistration = ven.queryRegistration();

            OadrPoll poll = ven.poll();

            poll.responseTypeIs(typeof(oadrCreateReportType));

            oadrCreateReportType createReport = poll.getCreateReportResponse();

            Console.Out.WriteLine(poll.responseBody);

            ReportDescription reportDescription = new ReportDescription();

            reportDescription.addReport(createReport.oadrReportRequest[0].reportSpecifier.reportSpecifierID, ReportName.TELEMETRY_STATUS, 0, DurationModifier.MINUTES);

            DateTime dtstart = DateTime.UtcNow;

            reportDescription.addIntervalResourceStatus(createReport.oadrReportRequest[0].reportSpecifier.reportSpecifierID, dtstart,
                                                        0, DurationModifier.SECONDS, "rid", 1, (float)1.0, DataQuality.qualityGoodNonSpecific, true, false, (float)1.0, (float)1.0, (float)1.0, (float)1.0,
                                                        (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0,
                                                        (float)1.0, (float)1.0);

            CreatedReport createdReport = ven.createdReport(createReport.requestID, 200, "OK");

            Assert.IsNotNull(createdReport.response);

            List <string> reportSpecifierIDs = new List <string>();

            reportSpecifierIDs.Add(createReport.oadrReportRequest[0].reportSpecifier.reportSpecifierID);

            UpdateReport updateReport = ven.updateReport(createReport.requestID, reportDescription, reportSpecifierIDs, dtstart);

            Assert.IsNotNull(updateReport.response);
        }
Пример #3
0
        public void R1_3020_TH_VTN_1()
        {
            VEN2b ven = new VEN2b(new HttpWebRequestWrapper(false, System.Net.SecurityProtocolType.Tls12), TestProperties.vtnURL, TestProperties.venName, TestProperties.venID, TestProperties.venPassword);

            OadrPoll poll = ven.poll();

            poll.responseTypeIs(typeof(oadrCreateReportType));

            oadrCreateReportType createReport = poll.getCreateReportResponse();

            Console.Out.WriteLine(poll.responseBody);

            ReportDescription reportDescription = new ReportDescription();

            reportDescription.addReport(createReport.oadrReportRequest[0].reportSpecifier.reportSpecifierID, ReportName.TELEMETRY_STATUS, 0, DurationModifier.MINUTES);


            CreatedReport createdReport = ven.createdReport(createReport.requestID, 200, "OK");

            Assert.IsNotNull(createdReport.response);

            List <string> reportSpecifierIDs = new List <string>();

            int sleepTime = (int)(createReport.oadrReportRequest[0].reportSpecifier.reportInterval.properties.dtstart.datetime - DateTime.UtcNow).TotalSeconds;

            if (sleepTime > 0)
            {
                System.Threading.Thread.Sleep(sleepTime * 1000);
            }

            reportSpecifierIDs.Add(createReport.oadrReportRequest[0].reportSpecifier.reportSpecifierID);

            DateTime endTime = createReport.oadrReportRequest[0].reportSpecifier.reportInterval.properties.dtstart.datetime +
                               System.Xml.XmlConvert.ToTimeSpan(createReport.oadrReportRequest[0].reportSpecifier.reportInterval.properties.duration.duration);

            // convert ISO8601 duration to timespan
            // http://stackoverflow.com/questions/62804/how-to-convert-iso-8601-duration-to-timespan-in-vb-net
            // http://msdn.microsoft.com/en-us/library/system.xml.xmlconvert.totimespan.aspx
            int sleepDelay = (int)System.Xml.XmlConvert.ToTimeSpan(createReport.oadrReportRequest[0].reportSpecifier.reportBackDuration.duration).TotalSeconds;

            // the test should continue until the end time has passed, but the test set exits after it receives 2 updates
            // while (DateTime.Now < endTime)
            for (int count = 0; count < 2; count++)
            {
                DateTime dtstart = DateTime.UtcNow;

                reportDescription.addIntervalResourceStatus(createReport.oadrReportRequest[0].reportSpecifier.reportSpecifierID, dtstart,
                                                            0, DurationModifier.SECONDS, "rid", 1, (float)1.0, DataQuality.qualityGoodNonSpecific, true, false, (float)1.0, (float)1.0, (float)1.0, (float)1.0,
                                                            (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0,
                                                            (float)1.0, (float)1.0);

                UpdateReport updateReport = ven.updateReport(createReport.requestID, reportDescription, reportSpecifierIDs, dtstart);

                Assert.IsNotNull(updateReport.response);

                if (count == 0)
                {
                    System.Threading.Thread.Sleep(sleepDelay * 1000);
                }
            }
        }