use of org.apache.wicket.MockPage in project wicket by apache.
the class PackageMapperTest method encodeNamedPageParameters.
/**
*/
@Test
public void encodeNamedPageParameters() {
MockPage page = new MockPage(15);
page.setBookmarkable(true);
page.setCreatedBookmarkable(true);
page.setPageStateless(true);
IPageProvider provider = new PageProvider(page);
page.getPageParameters().set("foo", "fooValue", INamedParameters.Type.PATH);
page.getPageParameters().set("bar", "barValue", INamedParameters.Type.PATH);
IRequestHandler handler = new RenderPageRequestHandler(provider);
Url url = namedParametersEncoder.mapHandler(handler);
assertEquals(MOUNT_PATH + "/fooValue/barValue/" + PAGE_CLASS_NAME, url.toString());
}
use of org.apache.wicket.MockPage in project wicket by apache.
the class PackageMapperTest 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(MOUNT_PATH + '/' + 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 PackageMapperTest 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);
assertEquals(MOUNT_PATH + '/' + 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 PackageMapperTest method encode7.
/**
*/
@Test
public void encode7() {
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, 4);
Url url = encoder.mapHandler(handler);
assertEquals(MOUNT_PATH + '/' + PAGE_CLASS_NAME + "/i1/i2?15-0.4-foo-bar&a=b&b=c", url.toString());
}
use of org.apache.wicket.MockPage in project wicket by apache.
the class PageInstanceMapperTest method encode2.
/**
*/
@Test
public void encode2() {
MockPage page = new MockPage(15);
page.setRenderCount(5);
IRequestableComponent c = page.get("a:b:c");
PageAndComponentProvider provider = new PageAndComponentProvider(page, c);
IRequestHandler handler = new ListenerRequestHandler(provider);
Url url = encoder.mapHandler(handler);
assertEquals("wicket/page?15-5.-a-b-c", url.toString());
}
Aggregations