use of org.apache.wicket.resource.DummyApplication in project wicket by apache.
the class InternalErrorCallsAjaxOnFailureTest method callsOnFailure.
/**
* Setup {@link org.apache.wicket.settings.ExceptionSettings.AjaxErrorStrategy#INVOKE_FAILURE_HANDLER}
* so Wicket will not redirect to the configured {@link InternalErrorPage}/{@link ExceptionErrorPage}
* but will preserve the current page and send http status 500 to wicket-ajax.js
*/
@Test
public void callsOnFailure() {
WicketTester tester = new WicketTester(new DummyApplication() {
/**
* @see org.apache.wicket.protocol.http.WebApplication#init()
*/
@Override
protected void init() {
super.init();
getExceptionSettings().setAjaxErrorHandlingStrategy(ExceptionSettings.AjaxErrorStrategy.INVOKE_FAILURE_HANDLER);
}
});
tester.setExposeExceptions(false);
tester.startPage(InternalErrorCallsAjaxOnFailurePage.class);
tester.clickLink("failure-link", true);
MockHttpServletResponse errorPageResponse = tester.getLastResponse();
assertEquals(500, errorPageResponse.getStatus());
// assert that the original page is still the last rendered one
tester.assertRenderedPage(InternalErrorCallsAjaxOnFailurePage.class);
tester.destroy();
}
use of org.apache.wicket.resource.DummyApplication in project wicket by apache.
the class LocalizerTest method setUp.
/**
* @throws Exception
*/
@Before
public void setUp() throws Exception {
tester = new WicketTester(new DummyApplication());
settings = tester.getApplication().getResourceSettings();
localizer = tester.getApplication().getResourceSettings().getLocalizer();
}
use of org.apache.wicket.resource.DummyApplication in project wicket by apache.
the class ResponseFilterTest method newApplication.
@Override
protected WebApplication newApplication() {
final IResponseFilter responseFilter = new IResponseFilter() {
@Override
public AppendingStringBuffer filter(AppendingStringBuffer responseBuffer) {
counter.getAndIncrement();
return responseBuffer;
}
};
final WebApplication application = new DummyApplication() {
@Override
protected void init() {
super.init();
getRequestCycleSettings().addResponseFilter(responseFilter);
getRequestCycleSettings().addResponseFilter(AppendCommentFilter.INSTANCE);
}
};
return application;
}
use of org.apache.wicket.resource.DummyApplication in project wicket by apache.
the class CustomHomePageTest method customHomePage.
/**
* Tests mounting of a custom home page via {@link WebApplication#mountPage(String, Class)}
*/
@Test
public void customHomePage() {
final WebApplication dummyApplication = new DummyApplication() {
/**
* @see org.apache.wicket.protocol.http.WebApplication#init()
*/
@Override
protected void init() {
super.init();
// the following two lines do identical things
// getRootRequestMapperAsCompound().add(new HomePageMapper(CustomHomePage.class));
mountPage("/", CustomHomePage.class);
}
};
final WicketTester tester = new WicketTester(dummyApplication);
requestHomePage(tester);
tester.assertRenderedPage(CustomHomePage.class);
tester.destroy();
}
use of org.apache.wicket.resource.DummyApplication in project wicket by apache.
the class RequestCycleListenerTest method setUp.
/**
*/
@Before
public void setUp() {
DummyApplication application = new DummyApplication();
application.setName("dummyTestApplication");
ThreadContext.setApplication(application);
application.setServletContext(new MockServletContext(application, "/"));
application.initApplication();
errorCode = 0;
}
Aggregations