use of org.apache.wicket.request.mapper.parameter.PageParameters in project wicket by apache.
the class ConversationPropagatorTest method testPropagationAllHybrid.
@Test
public void testPropagationAllHybrid() {
configure(new CdiConfiguration().setPropagation(ConversationPropagation.ALL));
tester.getApplication().getRootRequestMapperAsCompound().add(new MountedMapper("segment/${pageType}", TestConversationPage.class));
tester.startPage(TestConversationPage.class, new PageParameters().add("pageType", "hybrid"));
int i;
for (i = 0; i < 3; i++) {
tester.assertCount(i);
tester.clickLink("increment");
}
tester.clickLink("next");
for (; i < 6; i++) {
tester.assertCount(i);
tester.clickLink("increment");
}
}
use of org.apache.wicket.request.mapper.parameter.PageParameters in project wicket by apache.
the class PackageMapperTest method decode4.
/**
* The tests resolves pages by id as if they were existed in the page store. These pages have no
* page parameters (i.e. page.getPageParameters() == null).
*
* Since Wicket 7.0.0 (WICKET-4441) if a new request to hybrid url (a url with both mount path
* and pageId) has different page parameters than the resolved page then a new page instance
* with the new parameters is created. This way if a user manipulates manually the product id in
* url like: /mount/path/Products/23?3 to /mount/path/Products/24?3 then Wicket will create a
* new page that will show product=24
*/
@Test
void decode4() {
Url url = Url.parse(MOUNT_PATH + '/' + PAGE_CLASS_NAME + "/i1/i2?15&a=b&b=c");
IRequestHandler handler = encoder.mapRequest(getRequest(url));
assertThat(handler).isInstanceOf(RenderPageRequestHandler.class);
RenderPageRequestHandler h = (RenderPageRequestHandler) handler;
((PageProvider) h.getPageProvider()).setPageSource(context);
IRequestablePage page = h.getPage();
checkPage(page, 1);
PageParameters p = page.getPageParameters();
assertEquals(2, p.getIndexedCount());
assertEquals(2, p.getNamedKeys().size());
}
use of org.apache.wicket.request.mapper.parameter.PageParameters in project wicket by apache.
the class PackageMapperTest method encode1.
/**
*/
@Test
void encode1() {
PageProvider provider = new PageProvider(MockPage.class, new PageParameters());
provider.setPageSource(context);
IRequestHandler handler = new BookmarkablePageRequestHandler(provider);
Url url = encoder.mapHandler(handler);
assertEquals(MOUNT_PATH + '/' + PAGE_CLASS_NAME, url.toString());
}
use of org.apache.wicket.request.mapper.parameter.PageParameters in project wicket by apache.
the class RequestCycleUrlForTest method urlForClass.
/**
* Pages should have the jsessionid encoded in the url
*
* @throws Exception
*/
@Test
void urlForClass() throws Exception {
CharSequence url = requestCycle.urlFor(MockHomePage.class, new PageParameters());
assertEquals("./bookmarkablePage" + JSESSIONID, url);
}
use of org.apache.wicket.request.mapper.parameter.PageParameters in project wicket by apache.
the class RequestCycleUrlForTest method urlForStaticResource.
/**
* IStaticCacheableResource should not have the jsessionid encoded in the url
*
* @throws Exception
*/
@Test
void urlForStaticResource() throws Exception {
IStaticCacheableResource resource = mock(IStaticCacheableResource.class);
ResourceRequestHandler handler = new ResourceRequestHandler(resource, new PageParameters());
CharSequence url = requestCycle.urlFor(handler);
assertEquals("./" + RESOURCE_URL, url);
}
Aggregations