use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.
the class ResourceReferenceLambdaTest method newWicketTester.
@Override
protected WicketTester newWicketTester(WebApplication app) {
WicketTester wicketTester = super.newWicketTester(app);
IResource res = (attributes) -> attributes.getResponse().write(output);
ResourceReference resRef = ResourceReference.of("lambdares", () -> res);
app.mountResource("/test", resRef);
return wicketTester;
}
use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.
the class QueryStringWithVersionResourceCachingStrategyTest method testUrlVersionStoredInRequestCycle.
@Test
public void testUrlVersionStoredInRequestCycle() {
WicketTester tester = new WicketTester();
tester.getApplication().getResourceSettings().setCachingStrategy(strategy);
try {
PageParameters urlParameters = new PageParameters();
urlParameters.add(versionParameter, "9A0364B9E99BB480DD25E1F0284C8555", INamedParameters.Type.QUERY_STRING);
ResourceUrl resourceUrl = new ResourceUrl("some-resource.txt", urlParameters);
strategy.undecorateUrl(resourceUrl);
String version = tester.getRequestCycle().getMetaData(IResourceCachingStrategy.URL_VERSION);
assertEquals("9A0364B9E99BB480DD25E1F0284C8555", version);
} finally {
tester.destroy();
}
}
use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.
the class PageIdPoliticTest method setUp.
@Before
public void setUp() throws Exception {
application = new MockApplication();
dataStore = new InMemoryPageStore() {
@Override
public void storeData(String sessionId, int pageId, byte[] pageAsBytes) {
super.storeData(sessionId, pageId, pageAsBytes);
storeCount++;
}
};
tester = new WicketTester(application) {
@Override
protected IPageManagerProvider newTestPageManagerProvider() {
return new IPageManagerProvider() {
@Override
public IPageManager apply(IPageManagerContext pageManagerContext) {
IPageStore pageStore = new DefaultPageStore(new JavaSerializer(application.getApplicationKey()), dataStore, 4);
return new PageStoreManager(application.getName(), pageStore, pageManagerContext);
}
};
}
};
}
use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.
the class ContextRelativeResourceReferenceTest method newWicketTester.
@Override
protected WicketTester newWicketTester(WebApplication app) {
WicketTester tester = super.newWicketTester(app);
app.getResourceSettings().setUseMinifiedResources(true);
return tester;
}
use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.
the class CustomHomePageTest method defaultHomePage.
/**
* Tests no custom home page. The home page is get from {@link Application#getHomePage()}
*/
@Test
public void defaultHomePage() {
final WebApplication dummyApplication = new DummyApplication();
final WicketTester tester = new WicketTester(dummyApplication);
requestHomePage(tester);
tester.assertRenderedPage(dummyApplication.getHomePage());
tester.destroy();
}
Aggregations