public override void CalculateExpectedTestingTime(ICollection otherSubTests, ISubTestArgument arg) { // get the results from the prerequisite tests CdsResult_BrowseFilter FILTER_RESULTS = null; CdsResult_BrowseRange RANGE_RESULTS = null; CdsResult_BrowseSortCriteria SORT_RESULTS = null; foreach (ISubTest preTest in otherSubTests) { if (preTest.Name == this.PRE_FILTER.Name) { FILTER_RESULTS = preTest.Details as CdsResult_BrowseFilter; } else if (preTest.Name == this.PRE_RANGE.Name) { RANGE_RESULTS = preTest.Details as CdsResult_BrowseRange; } else if (preTest.Name == this.PRE_SORT.Name) { SORT_RESULTS = preTest.Details as CdsResult_BrowseSortCriteria; } } if (FILTER_RESULTS == null) { return; } if (RANGE_RESULTS == null) { return; } if (SORT_RESULTS == null) { return; } CdsResult_BrowseAll BROWSE_ALL = FILTER_RESULTS.BrowseAllResults; if (BROWSE_ALL.LargestContainer == null) { return; } if (BROWSE_ALL.MostMetadata == null) { return; } if (SORT_RESULTS.SortFields == null) { return; } int max = Math.Max(FILTER_RESULTS.Filters.Count, BROWSE_ALL.LargestContainer.ChildCount); max = Math.Max(max, SORT_RESULTS.SortFields.Count); this._ExpectedTestingTime = max * 900; }
public TestQueue(ICollection subTests, ISubTestArgument arg) { foreach (ISubTest sub in subTests) { AddTest(sub); } Arg = arg; }
public override void CalculateExpectedTestingTime(ICollection otherSubTests, ISubTestArgument arg) { // get the results from the BrowseAll test CdsResult_BrowseAll PRE = null; foreach (ISubTest preTest in otherSubTests) { if (preTest.Name == this.PRE_BROWSEALL.Name) { if (preTest.TestState >= UPnPTestStates.Pass) { PRE = preTest.Details as CdsResult_BrowseAll; break; } } } if (PRE == null) { return; } if (PRE.LargestContainer == null) { return; } if (PRE.Root == null) { return; } int totalBrowses = CalculateExpectedBrowseRequests(PRE.LargestContainer) + CalculateExpectedBrowseRequests(PRE.Root); int maxTime = 300 * totalBrowses; this._ExpectedTestingTime = maxTime; }
/// <summary> /// This test builds a <see cref="TestQueue"/> and runs /// all of the subtests identified by their name. /// </summary> /// <param name="runThese">names of tests to run; null indicates all tests of the testgroup</param> /// <param name="arg">argument to send to the <see cref="ISubTest"/> objects</param> public void RunTests(string[] runThese, ISubTestArgument arg) { TestQueue tq = null; if (runThese == null) { tq = new TestQueue(this.AllTests.Values, arg); } else { ArrayList run = new ArrayList(); foreach (string name in runThese) { bool added = false; foreach (ISubTest sub in this.AllTests.Values) { if (name == sub.Name) { run.Add(sub); added = true; break; } } if (added == false) { throw new ApplicationException("RunTests(): Specified the name of a test that does not exist in the test group."); } } tq = new TestQueue(run, arg); } // run all of the tests arg.ActiveTests = tq; tq.RunQueue(); }
public abstract void CalculateExpectedTestingTime(ICollection otherSubTests, ISubTestArgument arg);
public override void CalculateExpectedTestingTime(ICollection otherSubTests, ISubTestArgument arg) { // get the results from the BrowseAll test CdsResult_BrowseAll PRE = null; foreach (ISubTest preTest in otherSubTests) { if (preTest.Name == this.PRE_BROWSEALL.Name) { if (preTest.TestState >= UPnPTestStates.Pass) { PRE = preTest.Details as CdsResult_BrowseAll; break; } } } if (PRE == null) { return; } if (PRE.MostMetadata == null) { return; } if (PRE.MostMetadata.Properties.Count != PRE.MostMetadata.Properties.PropertyNames.Count) { return; } IUPnPMedia MM = PRE.MostMetadata; if (MM == null) { return; } IMediaContainer MC = PRE.MostMetadata.Parent; if (MC == null) { return; } int numProps = MM.Properties.Count; int numChildren = MC.ChildCount; // we browse for "res" and each possible res@attribute numProps += (2 * MediaResource.GetPossibleAttributes().Count) + 2; int expectedBrowses = 0; int inc = numProps / 4; if (inc == 0) { inc = 1; } for (int nProps = 0; nProps < numProps; nProps++) { for (int iProp = 0; iProp < numProps; iProp += inc) { expectedBrowses++; } } expectedBrowses *= 2; int maxTime = 90 * expectedBrowses; this._ExpectedTestingTime = maxTime; }
public override void CalculateExpectedTestingTime(ICollection otherSubTests, ISubTestArgument arg) { }
public override void CalculateExpectedTestingTime(ICollection otherSubTests, ISubTestArgument arg) { // get the results from the prerequisite tests CdsResult_BrowseAll BROWSE_RESULTS = null; CdsResult_GetSortCapabilities SORTCAPS = null; foreach (ISubTest preTest in otherSubTests) { if (preTest.Name == this.PRE_BROWSEALL.Name) { BROWSE_RESULTS = preTest.Details as CdsResult_BrowseAll; } else if (preTest.Name == this.PRE_SORTCAPS.Name) { SORTCAPS = preTest.Details as CdsResult_GetSortCapabilities; } } if (BROWSE_RESULTS == null) { return; } if (SORTCAPS == null) { return; } if (BROWSE_RESULTS.LargestContainer == null) { return; } MediaContainer MC = BROWSE_RESULTS.LargestContainer as MediaContainer; if (MC == null) { return; } ArrayList sortFields = new ArrayList(); if (SORTCAPS.SortCapabilities == "") { } else if (SORTCAPS.SortCapabilities == "*") { sortFields = (ArrayList)BROWSE_RESULTS.PropertyNames.Clone(); } else { sortFields.AddRange(GetSortFields(SORTCAPS.SortCapabilities)); } int fieldCount = sortFields.Count; IList childList = BROWSE_RESULTS.LargestContainer.CompleteList; uint inc = (uint)(childList.Count / 3); int firstInc = (fieldCount / 3); if (firstInc == 0) { firstInc = 1; } int totalBrowses = 0; for (int numFields = 0; numFields < fieldCount; numFields++) { for (int first = 0; first < fieldCount; first += firstInc) { //for (uint i=0; i < childList.Count; i+=inc) { totalBrowses++; } } } //add one for an unsorted browse totalBrowses++; //multiply by 2 because we have 2 rounds to check for consistency in ordered results totalBrowses *= 2; //calculate expected time this._ExpectedTestingTime = totalBrowses * 900; }
/// <summary> /// /// </summary> /// <param name="otherSubTests"> /// Collection of <see cref="ISubTest"/> objects that have run or will run /// as part of a sequence of subtests along with this test. Provided so that /// a subtest can have information about what has run before and after it. /// </param> /// <param name="arg"> /// This <see cref="ISubTestArgument"/> object can be used to pass state information /// from one subtest to another. /// </param> /// <returns>indicates the result of the test</returns> public abstract UPnPTestStates Run(ICollection otherSubTests, ISubTestArgument arg);
public override UPnPTestStates Run(ICollection otherSubTests, ISubTestArgument arg) { return(this.Run(otherSubTests, (CdsSubTestArgument)arg)); }
public override UPnPTestStates Run(ICollection otherSubTests, ISubTestArgument arg) { return this.Run(otherSubTests, (CdsSubTestArgument) arg); }
public override void CalculateExpectedTestingTime(ICollection otherSubTests, ISubTestArgument arg) { // get the results from the prerequisite tests CdsResult_BrowseAll BROWSE_RESULTS = null; CdsResult_GetSortCapabilities SORTCAPS = null; foreach (ISubTest preTest in otherSubTests) { if (preTest.Name == this.PRE_BROWSEALL.Name) { BROWSE_RESULTS = preTest.Details as CdsResult_BrowseAll; } else if (preTest.Name == this.PRE_SORTCAPS.Name) { SORTCAPS = preTest.Details as CdsResult_GetSortCapabilities; } } if (BROWSE_RESULTS == null) { return; } if (SORTCAPS == null) { return; } if (BROWSE_RESULTS.LargestContainer == null) { return; } MediaContainer MC = BROWSE_RESULTS.LargestContainer as MediaContainer; if (MC == null) { return; } ArrayList sortFields = new ArrayList(); if (SORTCAPS.SortCapabilities == "") { } else if (SORTCAPS.SortCapabilities == "*") { sortFields = (ArrayList) BROWSE_RESULTS.PropertyNames.Clone(); } else { sortFields.AddRange ( GetSortFields(SORTCAPS.SortCapabilities) ); } int fieldCount = sortFields.Count; IList childList = BROWSE_RESULTS.LargestContainer.CompleteList; uint inc = (uint) (childList.Count / 3); int firstInc = (fieldCount / 3); if (firstInc == 0) { firstInc = 1; } int totalBrowses = 0; for (int numFields = 0; numFields < fieldCount; numFields++) { for (int first = 0; first < fieldCount; first+=firstInc) { //for (uint i=0; i < childList.Count; i+=inc) { totalBrowses++; } } } //add one for an unsorted browse totalBrowses++; //multiply by 2 because we have 2 rounds to check for consistency in ordered results totalBrowses *= 2; //calculate expected time this._ExpectedTestingTime = totalBrowses * 900; }