Author: chris.laprun(a)jboss.com
Date: 2011-11-03 18:51:24 -0400 (Thu, 03 Nov 2011)
New Revision: 7964
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
Log:
- GTNPORTAL-2253: added test case, this seems to be working as expected.
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2011-11-03
22:07:30 UTC (rev 7963)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java 2011-11-03
22:51:24 UTC (rev 7964)
@@ -40,6 +40,7 @@
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.POMSessionManager;
import org.exoplatform.portal.pom.config.cache.DataCache;
+import org.exoplatform.portal.pom.data.PageKey;
import org.exoplatform.portal.pom.spi.portlet.Portlet;
import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
import org.exoplatform.services.listener.Event;
@@ -762,6 +763,33 @@
}.execute(null);
}
+ public void testCachePageEviction()
+ {
+ new UnitTest()
+ {
+ public void execute() throws Exception
+ {
+ mgr.clearCache();
+ DataCache cache = mgr.getDecorator(DataCache.class);
+ long readCount0 = cache.getReadCount();
+ userPortalConfigSer_.getPage("portal::test::test1");
+ long readCount1 = cache.getReadCount();
+ assertTrue(readCount1 > readCount0);
+ userPortalConfigSer_.getPage("portal::test::test1");
+ long readCount2 = cache.getReadCount();
+ assertEquals(readCount1, readCount2);
+
+ // schedule for eviction, we shouldn't hit the cache anymore
+ final POMSession session = mgr.getSession();
+ session.scheduleForEviction(new PageKey("portal", "test",
"test1"));
+ session.save();
+
+ userPortalConfigSer_.getPage("portal::test::test1");
+ assertTrue(readCount2 < cache.getReadCount());
+ }
+ }.execute(null);
+ }
+
private abstract class UnitTest
{
Show replies by date