You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by kn...@apache.org on 2009/04/11 22:06:19 UTC
svn commit: r764245 -
/wicket/sandbox/knopp/experimental/wicket-ng/src/test/java/org/apache/wicket/test/TestPageRender.java
Author: knopp
Date: Sat Apr 11 20:06:18 2009
New Revision: 764245
URL: http://svn.apache.org/viewvc?rev=764245&view=rev
Log: (empty)
Modified:
wicket/sandbox/knopp/experimental/wicket-ng/src/test/java/org/apache/wicket/test/TestPageRender.java
Modified: wicket/sandbox/knopp/experimental/wicket-ng/src/test/java/org/apache/wicket/test/TestPageRender.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/knopp/experimental/wicket-ng/src/test/java/org/apache/wicket/test/TestPageRender.java?rev=764245&r1=764244&r2=764245&view=diff
==============================================================================
--- wicket/sandbox/knopp/experimental/wicket-ng/src/test/java/org/apache/wicket/test/TestPageRender.java (original)
+++ wicket/sandbox/knopp/experimental/wicket-ng/src/test/java/org/apache/wicket/test/TestPageRender.java Sat Apr 11 20:06:18 2009
@@ -47,35 +47,42 @@
public void testRender1()
{
+ // Store current ThreadContext
ThreadContext context = ThreadContext.getAndClean();
+
+ // Create MockApplication
MockApplication app = new MockApplication();
app.setName("TestApplication1");
- app.set();
+ app.set(); // set it to ThreadContext
app.initApplication();
+ // Mount the test page
app.registerEncoder(new MountedEncoder("first-test-page", Page1.class));
+ // Construct request for first-test-page
Request request = new MockRequest(Url.parse("first-test-page"));
Response response = new StringResponse();
+ // create and execute request cycle
MockRequestCycle cycle = (MockRequestCycle) app.createRequestCycle(request, response);
cycle.processRequestAndDetach();
System.out.println("Rendered:");
System.out.println(response);
-
+ // invoke listener on the page
request = new MockRequest(Url.parse("wicket/page?0-1.ILinkListener-link"));
response = new StringResponse();
cycle = (MockRequestCycle) app.createRequestCycle(request, response);
cycle.processRequestAndDetach();
+ // invoke the listener again - without parsing the URL
cycle = (MockRequestCycle) app.createRequestCycle(request, response);
cycle.forceRequestHandler(new ListenerInterfaceRequestHandler(new PageComponentProvider(app.getEncoderContext(), 0, null, "link"), ILinkListener.INTERFACE));
cycle.processRequestAndDetach();
+ // cleanup
app.destroy();
ThreadContext.restore(context);
-
}
}