@Override
      public void run2() {
        Cache cache = getCache();

        QueryService qs = cache.getQueryService();
        LogWriter logger = cache.getLogger();

        Collection indexes = qs.getIndexes();
        for (final Object index : indexes) {
          PartitionedIndex ind = (PartitionedIndex) index;
          /*
           * List bucketIndex = ind.getBucketIndexes(); int k = 0;
           * logger.info("Total number of bucket index : "+bucketIndex.size()); while ( k <
           * bucketIndex.size() ){ Index bukInd = (Index)bucketIndex.get(k);
           * logger.info("Buket Index "+bukInd+"  usage : "+bukInd.getStatistics().getTotalUses());
           * // if number of quries on pr change in
           * getCacheSerializableRunnableForPRQueryAndCompareResults // literal 6 should change.
           * //Asif : With the optmization of Range Queries a where clause // containing something
           * like ID > 4 AND ID < 9 will be evaluated //using a single index lookup, so accordingly
           * modifying the //assert value from 7 to 6 // Anil : With aquiringReadLock during
           * Index.getSizeEstimate(), the // Index usage in case of "ID = 0 OR ID = 1" is increased
           * by 3. int indexUsageWithSizeEstimation = 3; int expectedUse = 6; long indexUse =
           * bukInd.getStatistics().getTotalUses(); // Anil : With chnages to use single index for
           * PR query evaluation, once the index // is identified the same index is used on other PR
           * buckets, the sieEstimation is // done only once, which adds additional index use for
           * only one bucket index. if (!(indexUse == expectedUse || indexUse == (expectedUse +
           * indexUsageWithSizeEstimation))){ fail
           * ("Index usage is not as expected, expected it to be either " + expectedUse + " or " +
           * (expectedUse + indexUsageWithSizeEstimation) + " it is: " + indexUse);
           * //assertIndexDetailsEquals(6 + indexUsageWithSizeEstimation,
           * bukInd.getStatistics().getTotalUses()); } k++; }
           */
          // Shobhit: Now we dont need to check stats per bucket index,
          // stats are accumulated in single pr index stats.

          // Anil : With aquiringReadLock during Index.getSizeEstimate(), the
          // Index usage in case of "ID = 0 OR ID = 1" is increased by 3.
          int indexUsageWithSizeEstimation = 3;

          logger.info("index uses for " + ind.getNumberOfIndexedBuckets() + " index "
              + ind.getName() + ": " + ind.getStatistics().getTotalUses());
          assertEquals(6, ind.getStatistics().getTotalUses());
        }

      }
Insure queries on a pr is using index if not fail.
geode-core/src/distributedTest/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java