use of org.apache.wicket.page.PageAccessSynchronizer.PageLock in project wicket by apache.
the class PageAccessSynchronizerTest method unlockIfNoSuchPage.
/**
* https://issues.apache.org/jira/browse/WICKET-4009
*/
@Test
public void unlockIfNoSuchPage() {
PageAccessSynchronizer synchronizer = new PageAccessSynchronizer(Duration.seconds(2));
IPageManager pageManager = new MockPageManager();
IPageManager synchronizedPageManager = synchronizer.adapt(pageManager);
synchronizedPageManager.getPage(0);
ConcurrentMap<Integer, PageLock> locks = synchronizer.getLocks().get();
PageLock pageLock = locks.get(Integer.valueOf(0));
assertNull(pageLock);
int pageId = 1;
IManageablePage page = new MockPage(pageId);
synchronizedPageManager.touchPage(page);
synchronizedPageManager.getPage(pageId);
PageLock pageLock2 = locks.get(Integer.valueOf(pageId));
assertNotNull(pageLock2);
}
Aggregations