return TestCacheManagerFactory.createCacheManager(cfg);
}
public void testQueryCache() throws Exception {
// persist one User object to ensure the index exists and queries can be validated against it
UserHS user = new UserHS();
user.setId(1);
user.setName("John");
cache.put("user_" + user.getId(), user);
// spy on the query cache
QueryCache queryCache = TestingUtil.extractGlobalComponent(cacheManager, QueryCache.class);
QueryCache queryCacheSpy = spy(queryCache);
TestingUtil.replaceComponent(cacheManager, QueryCache.class, queryCacheSpy, true);