the email isn't displayed because : your rule is associated to the mount point 
"/pages" and you don't call it.
You need to call "/pages" with a parameter (queryString) email not null. (I 
don't know how to simulate this with WicketTester)


Tremelune wrote:
> So here's a junit test:
> 
>   public void testThisThing() {
>     System.out.println("Testing...");
>     WicketTester tester = new WicketTester(new TestApp());
> 
>     System.out.println("Testing page thing");
>     tester.startPage(TestEmail.class);
>   }
> 
>   private class TestApp extends WebApplication {
>     public Class getHomePage() {
>       return TestEmail.class;
>     }
> 
>     protected void init() {
>       super.init();
> 
>       System.out.println("Initifying");
>       mount(new URIRequestTargetUrlCodingStrategy("/pages") {
>         @Override
>         public IRequestTarget decode(RequestParameters requestParameters) {
>           System.out.println("Decoderizing");
>           final ValueMap requestParams =
> decodeParameters(requestParameters);
>           PageParameters params = new PageParameters();
>           params.put("uri", requestParams.get(URI));
>           return new BookmarkablePageRequestTarget(Page.class, params) {
>             @Override
>             public void respond(RequestCycle requestCycle) {
>               System.out.println("Respondificating");
>               if (requestParams.getString("email") != null) {
>                 StringResponse emailResponse = new StringResponse();
>                 WebResponse originalResponse = (WebResponse)
> RequestCycle.get().getResponse();
>                 RequestCycle.get().setResponse(emailResponse);
>                 super.respond(requestCycle);
>                 // Here send the email instead of dumping it to stdout!
>                 System.out.println(emailResponse.toString());
>                 RequestCycle.get().setResponse(originalResponse);
>                 RequestCycle.get().setRequestTarget(new
> BookmarkablePageRequestTarget(TestEmail.class));
>               } else {
>                 super.respond(requestCycle);
>               }
>             }
>           };
>         }
>       });
>     }
>   }
> 
> Here's the output:
> 
> Testing...
> Initifying
> ********************************************************************
> *** WARNING: Wicket is running in DEVELOPMENT mode.              ***
> ***                               ^^^^^^^^^^^                    ***
> *** Do NOT deploy to your live server(s) without changing this.  ***
> *** See Application#getConfigurationType() for more information. ***
> ********************************************************************
> Testing page thing
> 
> The URIRequestTargetUrlCodingStrategy stuff just doesn't want to
> fire...Things are murky for me at this point. I'm mostly poking around at
> examples and I'm not sure what is doing what exactly.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to