Search in sources :

Example 31 with MockPage

use of org.apache.wicket.MockPage in project wicket by apache.

the class AbstractPageStoreTest method removePage.

@Test
public void removePage() {
    pageStore.storePage(sessionId, new MockPage(pageId));
    assertNotNull(pageStore.getPage(sessionId, pageId));
    pageStore.removePage(sessionId, pageId);
    assertNull(pageStore.getPage(sessionId, pageId));
}
Also used : MockPage(org.apache.wicket.MockPage) Test(org.junit.Test)

Example 32 with MockPage

use of org.apache.wicket.MockPage in project wicket by apache.

the class AbstractPageStoreTest method maxSizeSameSession.

/**
 * Verify that at most {@code maxEntries} per session can be put in the cache
 */
@Test
public void maxSizeSameSession() {
    pageStore.storePage(sessionId, new MockPage(pageId));
    assertNotNull(pageStore.getPage(sessionId, pageId));
    int pageId2 = 234;
    pageStore.storePage(sessionId, new MockPage(pageId2));
    assertNull(pageStore.getPage(sessionId, pageId));
    assertNotNull(pageStore.getPage(sessionId, pageId2));
}
Also used : MockPage(org.apache.wicket.MockPage) Test(org.junit.Test)

Example 33 with MockPage

use of org.apache.wicket.MockPage in project wicket by apache.

the class PerSessionPageStoreTest method maxSizeDifferentSessions.

/**
 * Verify that it is OK to store more pages than {@code maxEntries}
 * if they are in different sessions
 */
@Test
@Override
public void maxSizeDifferentSessions() {
    String sessionId2 = "0987654321";
    pageStore.storePage(sessionId, new MockPage(pageId));
    assertNotNull(pageStore.getPage(sessionId, pageId));
    pageStore.storePage(sessionId2, new MockPage(pageId));
    assertNotNull(pageStore.getPage(sessionId, pageId));
    assertNotNull(pageStore.getPage(sessionId2, pageId));
}
Also used : MockPage(org.apache.wicket.MockPage) Test(org.junit.Test)

Aggregations

MockPage (org.apache.wicket.MockPage)33 Test (org.junit.Test)30 IRequestHandler (org.apache.wicket.request.IRequestHandler)23 Url (org.apache.wicket.request.Url)22 PageProvider (org.apache.wicket.core.request.handler.PageProvider)13 RenderPageRequestHandler (org.apache.wicket.core.request.handler.RenderPageRequestHandler)13 IPageProvider (org.apache.wicket.core.request.handler.IPageProvider)12 PageAndComponentProvider (org.apache.wicket.core.request.handler.PageAndComponentProvider)10 IRequestableComponent (org.apache.wicket.request.component.IRequestableComponent)10 BookmarkableListenerRequestHandler (org.apache.wicket.core.request.handler.BookmarkableListenerRequestHandler)9 ListenerRequestHandler (org.apache.wicket.core.request.handler.ListenerRequestHandler)4 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 WicketRuntimeException (org.apache.wicket.WicketRuntimeException)1 RequestSettingRequestHandler (org.apache.wicket.core.request.handler.RequestSettingRequestHandler)1 MockPageManager (org.apache.wicket.mock.MockPageManager)1 PageLock (org.apache.wicket.page.PageAccessSynchronizer.PageLock)1 Request (org.apache.wicket.request.Request)1 IRequestablePage (org.apache.wicket.request.component.IRequestablePage)1