use of org.apache.wicket.core.request.handler.RenderPageRequestHandler in project wicket by apache.
the class MountedMapperTest method optionPlaceholderDecode2.
/**
*/
@Test
public void optionPlaceholderDecode2() {
Url url = Url.parse("some/p1/path/p2");
IRequestHandler handler = optionPlaceholderEncoder.mapRequest(getRequest(url));
assertThat(handler, instanceOf(RenderPageRequestHandler.class));
IRequestablePage page = ((RenderPageRequestHandler) handler).getPage();
assertEquals(0, page.getPageParameters().getIndexedCount());
assertTrue(page.getPageParameters().getNamedKeys().size() == 2);
assertEquals("p1", page.getPageParameters().get("param1").toString());
assertEquals("p2", page.getPageParameters().get("param2").toString());
assertFalse("param3 should not be set", page.getPageParameters().getNamedKeys().contains("param3"));
}
use of org.apache.wicket.core.request.handler.RenderPageRequestHandler in project wicket by apache.
the class MountedMapperTest method placeholderEncode4.
/**
* WICKET-5247 page instantiated without required parameters won't be mapped
*/
@Test
public void placeholderEncode4() {
PageProvider provider = new PageProvider(MockPage.class) {
@Override
public boolean isNewPageInstance() {
return false;
}
};
provider.setPageSource(context);
IRequestHandler handler = new RenderPageRequestHandler(provider);
Url url = placeholderEncoder.mapHandler(handler);
assertNull(url);
}
use of org.apache.wicket.core.request.handler.RenderPageRequestHandler in project wicket by apache.
the class MountedMapperTest method optionPlaceholderDecodeWithIndexParams.
/**
*/
@Test
public void optionPlaceholderDecodeWithIndexParams() {
Url url = Url.parse("some/path/p2/p3/p4");
IRequestHandler handler = optionPlaceholderEncoder.mapRequest(getRequest(url));
assertThat(handler, instanceOf(RenderPageRequestHandler.class));
IRequestablePage page = ((RenderPageRequestHandler) handler).getPage();
assertEquals(1, page.getPageParameters().getIndexedCount());
assertEquals(2, page.getPageParameters().getNamedKeys().size());
assertFalse("param1 should not be set", page.getPageParameters().getNamedKeys().contains("param1"));
assertEquals("p2", page.getPageParameters().get("param2").toString());
assertEquals("p3", page.getPageParameters().get("param3").toString());
assertEquals("p4", page.getPageParameters().get(0).toString());
}
use of org.apache.wicket.core.request.handler.RenderPageRequestHandler in project wicket by apache.
the class MountedMapperTest method optionPlaceholderDecodeEagerMatchParameters.
/**
*/
@Test
public void optionPlaceholderDecodeEagerMatchParameters() {
Url url = Url.parse("some/path/path/path");
IRequestHandler handler = optionPlaceholderEncoder.mapRequest(getRequest(url));
assertThat(handler, instanceOf(RenderPageRequestHandler.class));
IRequestablePage page = ((RenderPageRequestHandler) handler).getPage();
assertEquals(0, page.getPageParameters().getIndexedCount());
assertTrue(page.getPageParameters().getNamedKeys().size() == 2);
assertEquals("path", page.getPageParameters().get("param1").toString());
assertEquals("path", page.getPageParameters().get("param2").toString());
assertFalse("param3 should not be set", page.getPageParameters().getNamedKeys().contains("param3"));
}
use of org.apache.wicket.core.request.handler.RenderPageRequestHandler in project wicket by apache.
the class MountedMapperTest method decode2.
/**
*/
@Test
public void decode2() {
Url url = Url.parse("some/mount/path/indexed1?a=b&b=c");
IRequestHandler handler = encoder.mapRequest(getRequest(url));
assertThat(handler, instanceOf(RenderPageRequestHandler.class));
IRequestablePage page = ((RenderPageRequestHandler) handler).getPage();
PageParameters p = page.getPageParameters();
assertEquals(1, p.getIndexedCount());
assertEquals("indexed1", p.get(0).toString());
assertEquals(2, p.getNamedKeys().size());
assertEquals("b", p.get("a").toString());
assertEquals("c", p.get("b").toString());
}
Aggregations