Search in sources :

Example 11 with MockPage

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

the class PackageMapperTest method encodeAlias.

/**
 * https://issues.apache.org/jira/browse/WICKET-3941
 */
@Test
public void encodeAlias() {
    MockPage page = new MockPage(15);
    page.setBookmarkable(true);
    page.setCreatedBookmarkable(true);
    page.setPageStateless(true);
    IPageProvider provider = new PageProvider(page);
    IRequestHandler handler = new RenderPageRequestHandler(provider);
    Url url = aliasEncoder.mapHandler(handler);
    assertEquals(MOUNT_PATH + '/' + ALIAS, url.toString());
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) RenderPageRequestHandler(org.apache.wicket.core.request.handler.RenderPageRequestHandler) PageProvider(org.apache.wicket.core.request.handler.PageProvider) IPageProvider(org.apache.wicket.core.request.handler.IPageProvider) IPageProvider(org.apache.wicket.core.request.handler.IPageProvider) MockPage(org.apache.wicket.MockPage) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 12 with MockPage

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

the class PackageMapperTest method encode8.

/**
 */
@Test
public void encode8() {
    MockPage page = new MockPage(15);
    page.setBookmarkable(true);
    page.setCreatedBookmarkable(true);
    page.setPageStateless(true);
    IPageProvider provider = new PageProvider(page);
    IRequestHandler handler = new RenderPageRequestHandler(provider);
    Url url = encoder.mapHandler(handler);
    assertEquals(MOUNT_PATH + '/' + PAGE_CLASS_NAME, url.toString());
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) RenderPageRequestHandler(org.apache.wicket.core.request.handler.RenderPageRequestHandler) PageProvider(org.apache.wicket.core.request.handler.PageProvider) IPageProvider(org.apache.wicket.core.request.handler.IPageProvider) IPageProvider(org.apache.wicket.core.request.handler.IPageProvider) MockPage(org.apache.wicket.MockPage) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 13 with MockPage

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

the class PackageMapperTest 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(MOUNT_PATH + '/' + PAGE_CLASS_NAME + "/i1/i2?15&a=b&b=c", url.toString());
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) RenderPageRequestHandler(org.apache.wicket.core.request.handler.RenderPageRequestHandler) PageProvider(org.apache.wicket.core.request.handler.PageProvider) IPageProvider(org.apache.wicket.core.request.handler.IPageProvider) IPageProvider(org.apache.wicket.core.request.handler.IPageProvider) MockPage(org.apache.wicket.MockPage) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 14 with MockPage

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

the class PageInstanceMapperTest method encode1.

/**
 */
@Test
public void encode1() {
    MockPage page = new MockPage(15);
    IPageProvider provider = new PageProvider(page);
    IRequestHandler handler = new RenderPageRequestHandler(provider);
    Url url = encoder.mapHandler(handler);
    assertEquals("wicket/page?15", url.toString());
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) RenderPageRequestHandler(org.apache.wicket.core.request.handler.RenderPageRequestHandler) PageProvider(org.apache.wicket.core.request.handler.PageProvider) IPageProvider(org.apache.wicket.core.request.handler.IPageProvider) IPageProvider(org.apache.wicket.core.request.handler.IPageProvider) MockPage(org.apache.wicket.MockPage) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 15 with MockPage

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

the class TestMapperContext method newPageInstance.

@Override
public IRequestablePage newPageInstance(Class<? extends IRequestablePage> pageClass, PageParameters pageParameters) {
    try {
        MockPage page;
        page = (MockPage) pageClass.newInstance();
        page.setPageId(++idCounter);
        page.setBookmarkable(true);
        page.setCreatedBookmarkable(true);
        if (pageParameters != null) {
            page.getPageParameters().overwriteWith(pageParameters);
        }
        return page;
    } catch (Exception e) {
        throw new WicketRuntimeException(e);
    }
}
Also used : WicketRuntimeException(org.apache.wicket.WicketRuntimeException) MockPage(org.apache.wicket.MockPage) WicketRuntimeException(org.apache.wicket.WicketRuntimeException)

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