use of org.apache.wicket.MockPage in project wicket by apache.
the class AbstractPageStoreTest method storePage2.
/**
* Assert that storing a page twice won't keep two entries
*/
@Test
public void storePage2() {
int maxEntries = 10;
pageStore = createPageStore(serializer, dataStore, maxEntries);
pageStore.storePage(sessionId, new MockPage(pageId));
pageStore.storePage(sessionId, new MockPage(pageId));
assertNotNull(pageStore.getPage(sessionId, pageId));
pageStore.removePage(sessionId, pageId);
assertNull(pageStore.getPage(sessionId, pageId));
}
use of org.apache.wicket.MockPage in project wicket by apache.
the class AbstractPageStoreTest method storePage.
/**
* Assert that a stored page is available to be read
*/
@Test
public void storePage() {
pageStore.storePage(sessionId, new MockPage(pageId));
assertNotNull(pageStore.getPage(sessionId, pageId));
}
use of org.apache.wicket.MockPage in project wicket by apache.
the class AbstractPageStoreTest method maxSizeDifferentSessions.
/**
* Verify that it is OK to store more pages than {@code maxEntries}
* if they are in different sessions
*/
@Test
public void maxSizeDifferentSessions() {
String sessionId2 = "0987654321";
pageStore.storePage(sessionId, new MockPage(pageId));
assertNotNull(pageStore.getPage(sessionId, pageId));
pageStore.storePage(sessionId2, new MockPage(pageId));
assertNull(pageStore.getPage(sessionId, pageId));
assertNotNull(pageStore.getPage(sessionId2, pageId));
}
use of org.apache.wicket.MockPage 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.MockPage in project wicket by apache.
the class BookmarkableMapperTest method encode5.
/**
*/
@Test
public void encode5() {
MockPage page = new MockPage(15);
page.getPageParameters().set(0, "i1");
page.getPageParameters().set(1, "i2");
page.getPageParameters().set("a", "b", INamedParameters.Type.QUERY_STRING);
page.getPageParameters().set("b", "c", INamedParameters.Type.QUERY_STRING);
page.setCreatedBookmarkable(false);
IPageProvider provider = new PageProvider(page);
IRequestHandler handler = new RenderPageRequestHandler(provider);
Url url = encoder.mapHandler(handler);
// never allow bookmarkable render url for page that has not been
// created by bookmarkable
// URL
assertNull(url);
}
Aggregations