use of org.apache.wicket.mock.MockPageManager 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);
}
use of org.apache.wicket.mock.MockPageManager in project wicket by apache.
the class TransparentWebMarkupContainerTest method ajaxUpdate.
/**
* Test case for <a href="https://issues.apache.org/jira/browse/WICKET-3719">WICKET-3719</a>
*/
@Test
public void ajaxUpdate() {
WicketTester wicketTester = new WicketTester() {
@Override
protected IPageManagerProvider newTestPageManagerProvider() {
return new IPageManagerProvider() {
@Override
public IPageManager apply(IPageManagerContext context) {
return new MockPageManager() {
@Override
public void touchPage(IManageablePage page) {
page = WicketObjects.cloneObject(page);
super.touchPage(page);
}
};
}
};
}
};
wicketTester.startPage(TransparentWithAjaxUpdatePage.class);
wicketTester.clickLink("link", true);
wicketTester.destroy();
}
use of org.apache.wicket.mock.MockPageManager in project wicket by apache.
the class DontStoreNotRenderedPageTestCase method newWicketTester.
@Override
protected WicketTester newWicketTester(WebApplication app) {
app.getComponentInstantiationListeners().add(new IComponentInstantiationListener() {
@Override
public void onInstantiation(Component component) {
// WICKET-5546 behavior added before Page#init()
component.add(new Behavior() {
});
}
});
return new WicketTester(app) {
@Override
protected IPageManagerProvider newTestPageManagerProvider() {
return new IPageManagerProvider() {
@Override
public IPageManager apply(IPageManagerContext context) {
return new MockPageManager() {
@Override
public void touchPage(IManageablePage page) {
Assert.assertFalse("PageB should not be touched!", page instanceof PageB);
super.touchPage(page);
}
};
}
};
}
};
}
Aggregations