private void evaluateMapTypeIndexUsage(String indexExpression, String fromClause,
      String[] queries, String[] queriesIndexNotUsed, Class expectedIndexClass) throws Exception {
    QueryService qs = CacheUtils.getQueryService();

    Object[][] r = new Object[queries.length][2];

    // Execute Queries without Indexes
    for (int i = 0; i < queries.length; i++) {
      Query q = CacheUtils.getQueryService().newQuery(queries[i]);
      CacheUtils.getLogger().info("Executing query: " + queries[i]);
      r[i][0] = q.execute();
      CacheUtils.log("Executed query: " + queries[i]);
    }

    Index i1 = qs.createIndex("Index1", IndexType.FUNCTIONAL, indexExpression, fromClause);
    assertTrue(i1.getClass().equals(expectedIndexClass));

    // Execute Queries with Indexes
    for (int i = 0; i < queries.length; i++) {
      Query q = CacheUtils.getQueryService().newQuery(queries[i]);
      CacheUtils.getLogger().info("Executing query: " + queries[i]);
      QueryObserverImpl observer = new QueryObserverImpl();
      QueryObserverHolder.setInstance(observer);
      r[i][1] = q.execute();
      CacheUtils.log("Executing query: " + queries[i] + " with index created");
      if (!observer.isIndexesUsed) {
        fail("Index is NOT used");
      }
      Iterator itr = observer.indexesUsed.iterator();
      assertTrue(itr.hasNext());
      String temp = itr.next().toString();
      assertEquals(temp, "Index1");
    }
    StructSetOrResultsSet ssOrrs = new StructSetOrResultsSet();
    ssOrrs.CompareQueryResultsWithoutAndWithIndexes(r, queries.length, queries);

    // Test queries index not used
    for (final String s : queriesIndexNotUsed) {
      Query q = CacheUtils.getQueryService().newQuery(s);
      CacheUtils.getLogger().info("Executing query: " + s);
      QueryObserverImpl observer = new QueryObserverImpl();
      QueryObserverHolder.setInstance(observer);
      CacheUtils.log("Executing query: " + s + " with index created");
      q.execute();
      assertFalse(observer.isIndexesUsed);
      Iterator itr = observer.indexesUsed.iterator();
      assertFalse(itr.hasNext());
    }
  }
Test to check if Region short cut method is used for querying, the Primary key index
utilization occurs or not
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/IndexUseJUnitTest.java