@Test
  public void testIndexMaintenanceOnCacheLoadedData() throws Exception {
    IndexManager.TEST_RANGEINDEX_ONLY = true;
    Cache cache = CacheUtils.getCache();
    qs = cache.getQueryService();
    region = CacheUtils.createRegion("portfolio1", null);
    AttributesMutator am = region.getAttributesMutator();
    am.setCacheLoader(new CacheLoader() {

      @Override
      public Object load(LoaderHelper helper) throws CacheLoaderException {
        String key = (String) helper.getKey();
        Portfolio p = new Portfolio(Integer.parseInt(key));
        return p;
      }

      @Override
      public void close() {
        // nothing
      }
    });

    Index i1 =
        qs.createIndex("indx1", IndexType.FUNCTIONAL, "pf.getID()", SEPARATOR + "portfolio1 pf");
    List keys = new ArrayList();
    keys.add("1");
    keys.add("2");
    keys.add("3");
    keys.add("4");

    region.getAll(keys);
  }
Tests Index maintenance on data loaded via cache loader
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/IndexMaintenanceJUnitTest.java