use of org.apache.wicket.MockPage in project wicket by apache.
the class TestMapperContext method cleanSessionCache.
/**
* just making sure the session cache will be empty by simulating an intermezzo request
*/
public void cleanSessionCache() {
getPageManager().getContext().setRequestData(null);
MockPage other = new MockPage();
other.setPageId(Integer.MAX_VALUE);
getPageManager().touchPage(other);
getPageManager().commitRequest();
}
use of org.apache.wicket.MockPage in project wicket by apache.
the class TestMapperContext method getPageInstance.
@Override
public IRequestablePage getPageInstance(int pageId) {
IRequestablePage requestablePage = (IRequestablePage) pageManager.getPage(pageId);
if (requestablePage == null && createMockPageIfInstanceNotFound) {
MockPage page = new MockPage();
page.setPageId(pageId);
page.setBookmarkable(bookmarkable);
page.setCreatedBookmarkable(createdBookmarkable);
page.setRenderCount(nextPageRenderCount);
requestablePage = page;
}
return requestablePage;
}
use of org.apache.wicket.MockPage in project wicket by apache.
the class BookmarkableMapperTest method encode4.
/**
*/
@Test
public void encode4() {
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(true);
IPageProvider provider = new PageProvider(page);
IRequestHandler handler = new RenderPageRequestHandler(provider);
Url url = encoder.mapHandler(handler);
assertEquals("wicket/bookmarkable/" + PAGE_CLASS_NAME + "/i1/i2?15&a=b&b=c", url.toString());
}
use of org.apache.wicket.MockPage in project wicket by apache.
the class BookmarkableMapperTest method encode6.
/**
*/
@Test
public void encode6() {
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);
// shouldn't make any difference for BookmarkableListenerRequestHandler,
// as this explicitly says the url must be bookmarkable
page.setCreatedBookmarkable(false);
IRequestableComponent c = page.get("foo:bar");
PageAndComponentProvider provider = new PageAndComponentProvider(page, c);
IRequestHandler handler = new BookmarkableListenerRequestHandler(provider);
Url url = encoder.mapHandler(handler);
assertEquals("wicket/bookmarkable/" + PAGE_CLASS_NAME + "/i1/i2?15-0.-foo-bar&a=b&b=c", url.toString());
}
use of org.apache.wicket.MockPage in project wicket by apache.
the class CryptoMapperTest method pageInstanceEncrypt.
/**
* Tests that URLs for page instances are encrypted (/wicket/page?5)
*/
@Test
public void pageInstanceEncrypt() {
MockPage page = new MockPage(5);
IRequestHandler requestHandler = new RenderPageRequestHandler(new PageProvider(page));
assertEquals(PLAIN_PAGE_INSTANCE_URL, mapper.getDelegateMapper().mapHandler(requestHandler).toString());
assertEquals(ENCRYPTED_PAGE_INSTANCE_URL, mapper.mapHandler(requestHandler).toString());
}
Aggregations