public virtual void runTestQuery(SpatialMatchConcern concern, SpatialTestQuery q) { String msg = q.toString(); //"Query: " + q.args.toString(ctx); SearchResults got = executeQuery(makeQuery(q), Math.Max(100, q.ids.size() + 1)); if (storeShape && got.numFound > 0) { //check stored value is there assertNotNull(got.results[0].document.Get(strategy.FieldName)); } if (concern.orderIsImportant) { IEnumerator<String> ids = q.ids.GetEnumerator(); foreach (SearchResult r in got.results) { String id = r.document.Get("id"); if (!ids.MoveNext()) { fail(msg + " :: Did not get enough results. Expect" + q.ids + ", got: " + got.toDebugString()); } assertEquals("out of order: " + msg, ids.Current, id); } if (ids.MoveNext()) { fail(msg + " :: expect more results then we got: " + ids.Current); } } else { // We are looking at how the results overlap if (concern.resultsAreSuperset) { ISet<string> found = new JCG.HashSet<string>(); foreach (SearchResult r in got.results) { found.add(r.document.Get("id")); } foreach (String s in q.ids) { if (!found.contains(s)) { fail("Results are mising id: " + s + " :: " + found); } } } else { List<string> found = new List<string>(); foreach (SearchResult r in got.results) { found.Add(r.document.Get("id")); } // sort both so that the order is not important CollectionUtil.TimSort(q.ids); CollectionUtil.TimSort(found); assertEquals(msg, q.ids.toString(), found.toString()); } } }
protected virtual void executeQueries(SpatialMatchConcern concern, params string[] testQueryFile) { //log.info("testing queried for strategy "+strategy); foreach (String path in testQueryFile) { IEnumerator <SpatialTestQuery> testQueryIterator = getTestQueries(path, ctx); runTestQueries(testQueryIterator, concern); } }
public virtual void runTestQueries( IEnumerator <SpatialTestQuery> queries, SpatialMatchConcern concern) { while (queries.MoveNext()) { SpatialTestQuery q = queries.Current; runTestQuery(concern, q); } }