public void compareExternallySortedQueriesWithOrderBy(String[] queries, Object[][] baseResults)
      throws Exception {
    for (int i = 0; i < queries.length; i++) {
      Query q;
      try {
        String query = queries[i];
        int indexOfOrderBy = query.indexOf("order ");
        query = query.substring(0, indexOfOrderBy);
        q = CacheUtils.getQueryService().newQuery(query);
        CacheUtils.getLogger().info("Executing query: " + query);
        baseResults[i][1] = q.execute();
        int unorderedResultsSize = ((SelectResults) baseResults[i][1]).size();
        if (unorderedResultsSize == 0) {
          fail(
              "The test results size is 0. It may not be validating anything. Please rewrite the test.");
        }
        Wrapper wrapper = getOrderByComparatorAndLimitForQuery(queries[i], unorderedResultsSize);
        if (wrapper.validationLevel != ValidationLevel.NONE) {
          Object[] externallySorted = ((SelectResults) baseResults[i][1]).toArray();
          if (wrapper.validationLevel != ValidationLevel.MATCH_ONLY) {
            Arrays.sort(externallySorted, wrapper.obc);
          }
          if (wrapper.limit != -1) {
            if (externallySorted.length > wrapper.limit) {
              Object[] newExternallySorted = new Object[wrapper.limit];
              System.arraycopy(externallySorted, 0, newExternallySorted, 0, wrapper.limit);
              externallySorted = newExternallySorted;
            }
          }
          StructSetOrResultsSet ssOrrs1 = new StructSetOrResultsSet();
          ssOrrs1.compareQueryResultsWithExternallySortedResults((SelectResults) baseResults[i][0],
              externallySorted, queries[i], wrapper);


        }
      } catch (Exception e) {
        e.printStackTrace();
        throw new AssertionError(
            "query with index=" + i + " has failed. failed query=" + queries[i], e);
      }
    }
  }
Used by these tests:
<ul>
<li>EquiJoinIntegrationTest</li>
<li>IUMRCompositeIteratorJUnitTest</li>
<li>IUMRMultiIndexesMultiRegionJUnitTest</li>
<li>IUMRShuffleIteratorsJUnitTest</li>
<li>IUMRSingleRegionJUnitTest</li>
<li>IndexCreationJUnitTest</li>
<li>IndexHintJUnitTest</li>
<li>IndexMaintainceJUnitTest</li>
<li>IndexUseJUnitTest</li>
<li>IndexedMergeEquiJoinScenariosJUnitTest</li>
<li>MultiRegionIndexUsageJUnitTest</li>
<li>NonDistinctOrderByPartitionedJUnitTest</li>
<li>NonDistinctOrderByReplicatedJUnitTest</li>
<li>NonDistinctOrderByTestImplementation</li>
<li>OrderByPartitionedJUnitTest</li>
<li>OrderByReplicatedJUnitTest</li>
<li>OrderByTestImplementation</li>
<li>QueryIndexUsingXMLDUnitTest</li>
<li>QueryREUpdateInProgressJUnitTest</li>
<li>QueryUsingFunctionContextDUnitTest</li>
<li>QueryUsingPoolDUnitTest</li>
<li>TestNewFunctionSSorRSIntegrationTest</li>
</ul>
Also used by:
<ul>
<li>GroupByTestImpl</li>
<li>PdxGroupByTestImpl</li>
<li>PRQueryDUnitHelper</li>
</ul>
geode-junit/src/main/java/org/apache/geode/cache/query/functional/StructSetOrResultsSet.java