use of org.apache.wicket.mock.MockApplication in project wicket by apache.
the class SessionSizeModelTest method testToleranceOnProblematicSessions.
/**
* @see <a href="https://issues.apache.org/jira/browse/WICKET-3355">WICKET-3355</a>
*/
@Test
public void testToleranceOnProblematicSessions() {
new WicketTester(new MockApplication() {
@Override
public Session newSession(final Request request, final Response response) {
return new TestSession(request);
}
});
SessionSizeModel model = new SessionSizeModel();
assertEquals(null, model.getObject());
}
use of org.apache.wicket.mock.MockApplication in project wicket by apache.
the class LocaleAwarePageParametersTest method newApplication.
@Override
protected WebApplication newApplication() {
return new MockApplication() {
@Override
protected void init() {
super.init();
mountPage("unaware", LocaleUnawarePageParametersPage.class);
mount(new MountedMapper("aware", LocaleAwarePageParametersPage.class) {
@Override
protected Locale resolveLocale() {
return resolveUserLocale();
}
});
}
@Override
public Session newSession(Request request, Response response) {
final Session session = super.newSession(request, response);
session.setLocale(Locale.GERMANY);
return session;
}
};
}
use of org.apache.wicket.mock.MockApplication in project wicket by apache.
the class ResourceMapperWithDecoratedResourcesTest method newApplication.
@Override
protected WebApplication newApplication() {
return new MockApplication() {
@Override
public void init() {
super.init();
getResourceSettings().setCachingStrategy(new FilenameWithVersionResourceCachingStrategy(new CachingResourceVersion(new MessageDigestResourceVersion())));
mountResource("stylesheet.css", new CssResourceReference(ResourceMapperWithDecoratedResourcesTest.class, "decorated-resource.css"));
mountPage("/", HomePage.class);
}
};
}
use of org.apache.wicket.mock.MockApplication in project wicket by apache.
the class AbstractBookmarkableMapperTest method newApplication.
@Override
protected WebApplication newApplication() {
return new MockApplication() {
@Override
protected void init() {
super.init();
getSecuritySettings().setAuthorizationStrategy(new AbstractPageAuthorizationStrategy() {
@Override
protected <T extends Page> boolean isPageAuthorized(Class<T> pageClass) {
if (pageClass == EmptyPage.class) {
throw new RestartResponseAtInterceptPageException(getHomePage());
}
return true;
}
});
}
};
}
use of org.apache.wicket.mock.MockApplication in project wicket by apache.
the class WebExternalResourceTest method before.
/**
* @throws Exception
*/
@Before
public void before() throws Exception {
File tempDir = new File("target/webapp");
tempDir.mkdir();
File tempFile = new File(tempDir, "index.html");
FileOutputStream out = new FileOutputStream(tempFile);
InputStream in = WebExternalResourceTest.class.getResourceAsStream("index.html");
Streams.copy(in, out);
in.close();
out.close();
tester = new WicketTester(new MockApplication(), tempDir.getPath());
// We fake the browser URL, otherwise Wicket doesn't know the requested URL and cannot guess
// the Content-Type
tester.getRequest().setURL("index.html");
}
Aggregations