Created
May 19, 2015 23:50
-
-
Save doubleirish/713001237292fff96079 to your computer and use it in GitHub Desktop.
No Hits on my L2 Cache ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(SpringJUnit4ClassRunner.class) | |
@TransactionConfiguration(transactionManager = "txManager", defaultRollback = true) | |
... | |
public class BookDaoTest extends AbstractTransactionalJUnit4SpringContextTests { | |
@Test public void testBookEntityCaching() { | |
bookDao.findById(3); | |
bookDao.findById(3); | |
Statistics stats = bookDao.getHibernateStatistics(); | |
String regionName = "edu.uw.data.model.Book"; | |
SecondLevelCacheStatistics level2BookEntityStats = | |
stats.getSecondLevelCacheStatistics(regionName); | |
assertNotNull("missing ehcache region or @Cache ",level2BookEntityStats); | |
assertThat(level2BookEntityStats.getHitCount(), Is.is(greaterThan(0L))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment