);
}
public void testQueryCacheOverFlow() {
OpenJPAEntityManagerSPI em = emf.createEntityManager();
ConcurrentQueryCache cache =
(ConcurrentQueryCache) emf.getConfiguration().getDataCacheManagerInstance().getSystemQueryCache();
// populate entities.
em.getTransaction().begin();
for (int i = 0; i < cacheSize + 1; i++) {
CachedPerson person = new CachedPerson();
person.setId(i);
em.persist(person);
}
em.getTransaction().commit();
// Clean up persistence context.
em.clear();
// Populate query cache
for (int i = 0; i < cacheSize + 1; i++) {
em.createQuery(QUERY + i, CachedPerson.class).getSingleResult();
}
Set<?> keys = cache.getCacheMap().keySet();
assertEquals(cacheSize, keys.size());
List<String> strKeys = new ArrayList<String>();
for (Object key : keys) {
strKeys.add(key.toString());
}