use of org.apache.wicket.core.request.handler.BookmarkablePageRequestHandler in project wicket by apache.
the class MountedMapperTest method encode2.
/**
*/
@Test
public void encode2() {
PageParameters parameters = new PageParameters();
parameters.set(0, "i1");
parameters.set(1, "i2");
parameters.set("a", "b", INamedParameters.Type.QUERY_STRING);
parameters.set("b", "c", INamedParameters.Type.QUERY_STRING);
PageProvider provider = new PageProvider(MockPage.class, parameters);
provider.setPageSource(context);
IRequestHandler handler = new BookmarkablePageRequestHandler(provider);
Url url = encoder.mapHandler(handler);
assertEquals("some/mount/path/i1/i2?a=b&b=c", url.toString());
}
use of org.apache.wicket.core.request.handler.BookmarkablePageRequestHandler in project wicket by apache.
the class PackageMapperTest method encode3.
/**
*/
@Test
public void encode3() {
PageParameters parameters = new PageParameters();
parameters.set(0, "i1");
parameters.set(1, "i2");
parameters.set("a", "b", INamedParameters.Type.QUERY_STRING);
parameters.set("b", "c", INamedParameters.Type.QUERY_STRING);
PageProvider provider = new PageProvider(MockPage.class, parameters);
provider.setPageSource(context);
IRequestHandler handler = new BookmarkablePageRequestHandler(provider);
Url url = encoder.mapHandler(handler);
assertEquals(MOUNT_PATH + '/' + PAGE_CLASS_NAME + "/i1/i2?a=b&b=c", url.toString());
}
use of org.apache.wicket.core.request.handler.BookmarkablePageRequestHandler in project wicket by apache.
the class WicketTesterTest method setMultiValueQueryParameter.
/**
* Asserting that multiple parameters added in request and PageParameters get processed
*/
@Test
public void setMultiValueQueryParameter() {
PageParameters parameters = new PageParameters();
parameters.add("q_1", "q_1_value_1");
parameters.add("q_1", "q_1_value_2");
IPageProvider testPageProvider = new PageProvider(MockPageParametersAware.class, parameters);
IRequestHandler pageRequestHandler = new BookmarkablePageRequestHandler(testPageProvider);
Url url = tester.getApplication().getRootRequestMapper().mapHandler(pageRequestHandler);
tester.getRequest().addParameter("q_2", "q_2_value_1");
tester.getRequest().addParameter("q_2", "q_2_value_2");
tester.getRequest().setUrl(url);
tester.processRequest();
MockPageParametersAware page = (MockPageParametersAware) tester.getLastRenderedPage();
IRequestParameters lastQueryParameter = page.getLastQueryParameters();
List<StringValue> q1ParameterValues = lastQueryParameter.getParameterValues("q_1");
assertTrue(q1ParameterValues.contains(StringValue.valueOf("q_1_value_1")));
assertTrue(q1ParameterValues.contains(StringValue.valueOf("q_1_value_2")));
List<StringValue> q2ParameterValues = lastQueryParameter.getParameterValues("q_2");
assertTrue(q2ParameterValues.contains(StringValue.valueOf("q_2_value_1")));
assertTrue(q2ParameterValues.contains(StringValue.valueOf("q_2_value_2")));
}
Aggregations